forked from fex-team/kityminder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
113ac81
commit e4e1487
Showing
11 changed files
with
230 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Created with JetBrains WebStorm. | ||
* User: chenbaolong | ||
* Date: 15-3-20 | ||
* Time: 上午11:04 | ||
* To change this template use File | Settings | File Templates. | ||
*/ | ||
/* global Layout:true */ | ||
KityMinder.registerLayout('tianpan', kity.createClass({ | ||
base: Layout, | ||
|
||
doLayout: function(node, children) { | ||
//debugger | ||
var layout = this; | ||
var half = Math.ceil(node.children.length / 2); | ||
var right = []; | ||
var left = []; | ||
|
||
children.forEach(function(child) { | ||
if (child.getIndex() < half) right.push(child); | ||
else left.push(child); | ||
}); | ||
|
||
var leftLayout = KityMinder.getLayoutInstance('left'); | ||
var rightLayout = KityMinder.getLayoutInstance('right'); | ||
|
||
leftLayout.doLayout(node, left); | ||
rightLayout.doLayout(node, right); | ||
|
||
var box = node.getContentBox(); | ||
node.setVertexOut(new kity.Point(box.cx, box.cy)); | ||
node.setLayoutVectorOut(new kity.Vector(0, 0)); | ||
}, | ||
|
||
getOrderHint: function(node) { | ||
var hint = []; | ||
var box = node.getLayoutBox(); | ||
var offset = 5; | ||
|
||
hint.push({ | ||
type: 'up', | ||
node: node, | ||
area: { | ||
x: box.x, | ||
y: box.top - node.getStyle('margin-top') - offset, | ||
width: box.width, | ||
height: node.getStyle('margin-top') | ||
}, | ||
path: ['M', box.x, box.top - offset, 'L', box.right, box.top - offset] | ||
}); | ||
|
||
hint.push({ | ||
type: 'down', | ||
node: node, | ||
area: { | ||
x: box.x, | ||
y: box.bottom + offset, | ||
width: box.width, | ||
height: node.getStyle('margin-bottom') | ||
}, | ||
path: ['M', box.x, box.bottom + offset, 'L', box.right, box.bottom + offset] | ||
}); | ||
return hint; | ||
} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,33 +3,35 @@ | |
* | ||
* 天盘模板 | ||
* | ||
* @author: techird | ||
* @copyright: Baidu FEX, 2014 | ||
* @author: along | ||
* @copyright: [email protected], 2015 | ||
*/ | ||
|
||
KityMinder.registerTemplate('tianpan', { | ||
|
||
getLayout: function(node) { | ||
console.log(node) | ||
|
||
if (node.getData('layout')) return node.getData('layout'); | ||
|
||
var level = node.getLevel(); | ||
|
||
// 根节点 | ||
if (level === 0) { | ||
return 'mind'; | ||
return 'tianpan'; | ||
} | ||
|
||
// 一级节点 | ||
if (level === 1) { | ||
return node.getLayoutPointPreview().x > 0 ? 'right': 'left'; | ||
return 'tianpan'; | ||
// return node.getLayoutPointPreview().x > 0 ? 'right': 'left'; | ||
} | ||
|
||
return node.parent.getLayout(); | ||
}, | ||
|
||
getConnect: function(node) { | ||
if (node.getLevel() == 1) return 'arc'; | ||
return 'bezier'; | ||
return null; | ||
//if (node.getLevel() == 1) return 'arc'; | ||
//return 'arc'; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
['tianpan', 'tianpan-compact'].forEach(function(name) { | ||
var compact = name == 'tianpan-compact'; | ||
|
||
KityMinder.registerTheme(name, { | ||
'background': '#3A4144 url(ui/theme/default/images/grid.png) repeat', | ||
|
||
'root-color': '#430', | ||
'root-background': '#e9df98', | ||
'root-stroke': '#e9df98', | ||
'root-font-size': 25, | ||
'root-padding': compact ? [10, 25] : 25, | ||
'root-margin': compact ? [15, 25] : 100, | ||
'root-radius': 30, | ||
'root-space': 10, | ||
'root-shadow': 'rgba(0, 0, 0, .25)', | ||
'root-shape':'circle', | ||
|
||
'main-color': '#333', | ||
'main-background': '#a4c5c0', | ||
'main-stroke': '#a4c5c0', | ||
'main-font-size': 16, | ||
'main-padding': compact ? [5, 15] : 20, | ||
'main-margin': compact ? [5, 10] : 20, | ||
'main-radius': 10, | ||
'main-space': 5, | ||
'main-shadow': 'rgba(0, 0, 0, .25)', | ||
'main-shape':'circle', | ||
|
||
'sub-color': '#333', | ||
'sub-background': '#99ca6a', | ||
'sub-stroke': '#a4c5c0', | ||
'sub-font-size': 13, | ||
'sub-padding': 20, | ||
'sub-margin': compact ? [5, 10] : 20, | ||
'sub-tree-margin': 30, | ||
'sub-radius': 5, | ||
'sub-space': 5, | ||
'sub-shadow': 'rgba(0, 0, 0, .25)', | ||
'sub-shape':'circle', | ||
|
||
'connect-color': 'white', | ||
'connect-width': 2, | ||
'main-connect-width': 3, | ||
'connect-radius': 5, | ||
|
||
'selected-background': 'rgb(254, 219, 0)', | ||
'selected-stroke': 'rgb(254, 219, 0)', | ||
'selected-color': 'black', | ||
|
||
'marquee-background': 'rgba(255,255,255,.3)', | ||
'marquee-stroke': 'white', | ||
|
||
'drop-hint-color': 'yellow', | ||
'sub-drop-hint-width': 2, | ||
'main-drop-hint-width': 4, | ||
'root-drop-hint-width': 4, | ||
|
||
'order-hint-area-color': 'rgba(0, 255, 0, .5)', | ||
'order-hint-path-color': '#0f0', | ||
'order-hint-path-width': 1, | ||
|
||
'text-selection-color': 'rgb(27,171,255)', | ||
'line-height':1.4 | ||
}); | ||
}); |