Skip to content

Commit

Permalink
add tianpan test
Browse files Browse the repository at this point in the history
  • Loading branch information
baipgydx729 committed Mar 31, 2015
1 parent 4c16313 commit 0612945
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/connect/arc_tp.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ KityMinder.registerConnectProvider('arc_tp', function(node, parent, connection,

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);

Expand Down
1 change: 1 addition & 0 deletions src/layout/fish-bone-slave.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ KityMinder.registerLayout('fish-bone-slave', kity.createClass('FishBoneSlaveLayo
this.move(children, xAdjust, yAdjust);

if (round == 2) {

children.forEach(function(child) {
var m = child.getLayoutTransform();
var cbox = child.getContentBox();
Expand Down
78 changes: 58 additions & 20 deletions src/layout/tianpan.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,75 @@
* To change this template use File | Settings | File Templates.
*/
/* global Layout:true */


function aadsf(){



}


KityMinder.registerLayout('tianpan', kity.createClass({
base: Layout,

doLayout: function(node, children) {
var child = children[0];
if (!child) return;

//console.log(node)
doLayout: function(parent, children) {
console.log(parent);
if(children.length==0) return;
var layout = this;
var pbox = node.getContentBox();
var pbox = parent.getContentBox();

var x,y;
var _theta = 5;
var _r = pbox.width / Math.PI /1.5;
var x, y,alpha;

console.log('a')
children.forEach(function(child, index) {
x = (_r) * (Math.cos(_theta) + Math.sin(_theta) * _theta);
y = (_r) * (Math.sin(_theta) - Math.cos(_theta) * _theta);
var alpha = 10;
var _theta = 5;
var _r = Math.max(pbox.width,80) / 1.5 / Math.PI;

child.setLayoutTransform(new kity.Matrix());
// child.setLayoutVectorIn(
// new kity.Vector(1, 0));
// child.setVertexIn(new kity.Point(cBox.left, cBox.cy));
var g = KityMinder.Geometry;
var _tmp_rects=[],_tempchilds=[],_do = true, _cut_rect,_cover = false;
_tmp_rects.push(pbox);

child.getLayoutTransform().translate(x, y);
_theta += 0.9;//+(-index*0.02);
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);

// while (_do) {
x = _r * (Math.cos(_theta) + Math.sin(_theta) * _theta);
y = _r * (Math.sin(_theta) - Math.cos(_theta) * _theta);
_theta += (0.9 - index * 0.02);

console.log(child.getContentBox());

child.getContentBox().translate(x, y);
console.log(child.getContentBox());
debugger

// _cut_rect = layout.getTreeBox(child);
// _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;


console.log(_tmp_rects);
return;
//child.setLayoutTransform(new kity.Matrix());
//child.getLayoutTransform().translate(x, y);

children.forEach(function(child) {
x = (_r) * (Math.cos(_theta) + Math.sin(_theta) * _theta);
y = (_r) * (Math.sin(_theta) - Math.cos(_theta) * _theta);
Expand Down

0 comments on commit 0612945

Please sign in to comment.