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.
Merge branch 'dev' of https://github.com/baipgydx729/kityminder into …
…pr-233
- Loading branch information
Showing
32 changed files
with
433 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,6 @@ | |
maxImageHeight: 200, | ||
|
||
// 修改后自动保存时间间隔(单位:秒);设置为 false 不自动保存 | ||
autoSave: 2 | ||
autoSave: 1000 | ||
}; | ||
})(); |
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,53 @@ | ||
/** | ||
* @fileOverview | ||
* | ||
* 圆弧连线 | ||
* | ||
* @author: techird | ||
* @copyright: Baidu FEX, 2014 | ||
*/ | ||
|
||
var connectMarker = new kity.Marker().pipe(function() { | ||
var r = 7; | ||
var dot = new kity.Circle(r - 1); | ||
this.addShape(dot); | ||
this.setRef(r - 1, 0).setViewBox(-r, -r, r + r, r + r).setWidth(r).setHeight(r); | ||
this.dot = dot; | ||
this.node.setAttribute('markerUnits', 'userSpaceOnUse'); | ||
}); | ||
|
||
KityMinder.registerConnectProvider('arc_tp', function(node, parent, connection, width, color) { | ||
var end_box = node.getLayoutBox(), | ||
start_box = parent.getLayoutBox(); | ||
|
||
|
||
if(node.getIndex()>0){ | ||
var index = node.getIndex(); | ||
start_box = parent.getChildren()[index-1].getLayoutBox(); | ||
} | ||
|
||
|
||
var start, end, vector; | ||
var abs = Math.abs; | ||
var pathData = []; | ||
var side = end_box.x > start_box.x ? 'right' : 'left'; | ||
|
||
node.getMinder().getPaper().addResource(connectMarker); | ||
|
||
|
||
start = new kity.Point(start_box.cx, start_box.cy); | ||
end = new kity.Point(end_box.cx, end_box.cy); | ||
|
||
var jl = Math.sqrt(Math.abs(start.x -end.x) * Math.abs(start.x - end.x) + Math.abs(start.y -end.y) * Math.abs(start.y -end.y)); //两圆中心点距离 | ||
|
||
jl = node.getIndex()==0 ? jl *0.4 : jl; | ||
|
||
vector = kity.Vector.fromPoints(start, end); | ||
pathData.push('M', start); | ||
pathData.push('A', jl, jl, 0, 0 , 1, end); | ||
|
||
connection.setMarker(connectMarker); | ||
connectMarker.dot.fill(color); | ||
|
||
connection.setPathData(pathData); | ||
}); |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
|
||
/* global Layout:true */ | ||
|
||
[-1, 1].forEach(function (dir) { | ||
|
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,125 @@ | ||
/** | ||
* 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(parent, children) { | ||
if(children.length==0) return; | ||
|
||
var layout = this; | ||
var pbox = parent.getContentBox(); | ||
|
||
var x, y; | ||
var _theta = 5; | ||
var _r = Math.max(pbox.width,50); | ||
children.forEach(function(child, index) { | ||
child.setLayoutTransform(new kity.Matrix()); | ||
var box = layout.getTreeBox(child); | ||
var w = Math.max(box.width,box.height); | ||
_r = Math.max(w,_r); | ||
}) | ||
_r = _r / 1.5 / Math.PI; | ||
|
||
children.forEach(function(child, index) { | ||
// x = _r * (Math.cos(alpha) + Math.sin(alpha)* alpha * Math.PI/180); | ||
// y = _r * (Math.sin(alpha) - Math.cos(alpha)* alpha * Math.PI/180); | ||
x = _r * (Math.cos(_theta) + Math.sin(_theta) * _theta); | ||
y = _r * (Math.sin(_theta) - Math.cos(_theta) * _theta); | ||
|
||
_theta += (0.9 - index * 0.02); | ||
child.setLayoutVectorIn(new kity.Vector(1, 0)); | ||
child.setVertexIn(new kity.Point(pbox.left+15, pbox.cy+25)); | ||
child.setLayoutTransform(new kity.Matrix()); | ||
layout.move([child],x,y); | ||
|
||
// | ||
// child.getContentBox().translate(x, y); | ||
// console.log(child.getContentBox()); | ||
// debugger | ||
|
||
|
||
// _tmp_rects.forEach(function (tmpRect) { | ||
// debugger | ||
// if (g.getIntersectBox(tmpRect,_cut_rect)) { | ||
// _cover = true; | ||
// } | ||
// }) | ||
// | ||
// if (_cover) { | ||
// _r += 2; | ||
// console.log('true') | ||
// } else { | ||
// _do = false; | ||
// _tempchilds.push({child: child, r: _r, theta: _theta, area: _cut_rect}) | ||
// _theta += 0.9; | ||
// _tmp_rects.push(_cut_rect); | ||
// } | ||
// } | ||
}); | ||
|
||
|
||
|
||
return; | ||
|
||
//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
Oops, something went wrong.