Commit f608c0ab authored by campaign's avatar campaign

Merge branch 'kity-2.0' of https://github.com/fex-team/kityminder into dev

parents 59ce68ec fffdc644
Subproject commit 741dc07c2094ea45a1d622763a64f4c021476dc1
Subproject commit d478b95aca324ffc1c45f2dd6e1315fcf762a5fa
......@@ -228,7 +228,7 @@ var DragBox = kity.createClass( "DragBox", {
var movement = kity.Vector.fromPoints( this._startPosition, this._dragPosition );
this.setTransform( new kity.Matrix().translate( movement.x, movement.y ) );
this.setTranslate( movement );
this._dropTest();
this._updateDropHint();
......
......@@ -66,6 +66,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
setMinderNode: function ( node ) {
this.minderNode = node;
node.addShape(this.textShape);
return this;
},
keyboardEvents: function ( e ) {
......
......@@ -22,7 +22,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this.width = 1;
this.collapsed = true;
if(toEnd){
this.startOffset = this.endOffset
this.startOffset = this.endOffset;
}else{
this.endOffset = this.startOffset;
}
......
......@@ -6,9 +6,9 @@ KityMinder.registerModule( "IconModule", function () {
var _rc = new kity.Group();
_rc.addShapes( [ _bg, _number ] );
node.getContRc().addShape( _rc );
_number.setTransform( new kity.Matrix().translate( 6, 15 ) );
_number.setTranslate( 6, 15 );
var rcHeight = _rc.getHeight();
_rc.setTransform( new kity.Matrix().translate( 0, -rcHeight / 2 ) );
_rc.setTranslate( 0, -rcHeight / 2 );
};
var renderProgressIcon = function ( node, val ) {
......@@ -27,13 +27,13 @@ KityMinder.registerModule( "IconModule", function () {
case 1:
break;
case 2:
d.carcTo( 6, 0, -6 );
d.carcTo( 6, 0, 0, 0, -6 );
break;
case 3:
d.carcTo( 6, -6, 0 );
d.carcTo( 6, 0, 0, -6, 0 );
break;
case 4:
d.carcTo( 6, 0, 6, 1, 0 );
d.carcTo( 6, 1, 0, 0, 6 );
break;
case 5:
var check = new kity.Path();
......@@ -44,7 +44,7 @@ KityMinder.registerModule( "IconModule", function () {
}
if ( val < 5 ) d.close();
_percent.fill( "#29A6BD" );
_rc.setTransform( new kity.Matrix().translate( _contRc.getWidth() + 5, 0 ) );
_rc.setTranslate( _contRc.getWidth() + 5, 0 );
};
var setPriorityCommand = kity.createClass( "SetPriorityCommand", ( function () {
return {
......
......@@ -57,7 +57,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
var nodeType = node.getType();
var nodeX = nodeShape.getRenderBox().closurePoints[ 1 ].x + 5;
var nodeY = nodeShape.getRenderBox().closurePoints[ 0 ].y;
this.shape.setTransform( new kity.Matrix().translate( nodeX, nodeY ) );
this.shape.setTranslate( nodeX, nodeY );
},
remove: function () {
this.shape.remove();
......@@ -154,7 +154,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
default:
break;
}
contRc.setTransform( new kity.Matrix().translate( nodeStyle.padding[ 3 ], nodeStyle.padding[ 0 ] + _contRCHeight / 2 ) );
contRc.setTranslate( nodeStyle.padding[ 3 ], nodeStyle.padding[ 0 ] + _contRCHeight / 2 );
};
var updateLayoutMain = function () {
var _root = minder.getRoot();
......@@ -260,17 +260,17 @@ KityMinder.registerModule( "LayoutBottom", function () {
var _rectWidth = nodeShape.getWidth();
switch ( align ) {
case "right":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth, Layout.y ) );
nodeShape.setTranslate( Layout.x - _rectWidth, Layout.y );
break;
case "center":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth / 2, Layout.y ) );
nodeShape.setTranslate( Layout.x - _rectWidth / 2, Layout.y );
break;
default:
nodeShape.setTransform( new kity.Matrix().translate( Layout.x, Layout.y ) );
nodeShape.setTranslate( Layout.x, Layout.y );
break;
}
if ( node.getType() === "main" ) {
Layout.subgroup.setTransform( new kity.Matrix().translate( Layout.x, Layout.y + node.getRenderContainer().getHeight() ) );
Layout.subgroup.setTranslate( Layout.x, Layout.y + node.getRenderContainer().getHeight() );
}
node.setPoint( Layout.x, Layout.y );
};
......
......@@ -58,7 +58,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
nodeX = nodeShape.getRenderBox().closurePoints[ 0 ].x + 6;
if ( node.getType() === "main" ) nodeX -= 3;
}
this.shape.setTransform( new kity.Matrix().translate( nodeX, nodeY ) );
this.shape.setTranslate( nodeX, nodeY );
},
remove: function () {
this.shape.remove();
......@@ -176,7 +176,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
default:
break;
}
contRc.setTransform( new kity.Matrix().translate( nodeStyle.padding[ 3 ], nodeStyle.padding[ 0 ] + _contRCHeight / 2 ) );
contRc.setTranslate( nodeStyle.padding[ 3 ], nodeStyle.padding[ 0 ] + _contRCHeight / 2 );
};
//计算节点在垂直方向的位置
var updateLayoutVertical = function ( node, parent, action ) {
......@@ -326,13 +326,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
var _rectWidth = nodeShape.getWidth();
switch ( align ) {
case "right":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth, Layout.y - _rectHeight / 2 ) );
nodeShape.setTranslate( Layout.x - _rectWidth, Layout.y - _rectHeight / 2 );
break;
case "center":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth / 2, Layout.y - _rectHeight / 2 ) );
nodeShape.setTranslate( Layout.x - _rectWidth / 2, Layout.y - _rectHeight / 2 );
break;
default:
nodeShape.setTransform( new kity.Matrix().translate( Layout.x, Layout.y - _rectHeight / 2 ) );
nodeShape.setTranslate( Layout.x, Layout.y - _rectHeight / 2 );
break;
}
node.setPoint( Layout.x, Layout.y );
......@@ -392,8 +392,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
.clear()
.moveTo( sX, sY )
.lineTo( sX, nodeY > sY ? ( nodeY - nodeStyle.margin[ 3 ] ) : ( nodeY + nodeStyle.margin[ 3 ] ) );
if ( nodeY > sY ) connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY, 0, 1 );
else connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY );
if ( nodeY > sY ) connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], 0, 0, nodeX, nodeY, 0, 1 );
else connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], 0, 0, nodeX, nodeY );
connect.stroke( nodeStyle.stroke );
} else {
sX = parentBox.closurePoints[ 0 ].x + parentStyle.margin[ 1 ];
......@@ -402,8 +402,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
.clear()
.moveTo( sX, sY )
.lineTo( sX, nodeY > sY ? ( nodeY - nodeStyle.margin[ 3 ] ) : ( nodeY + nodeStyle.margin[ 3 ] ) );
if ( nodeY > sY ) connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY );
else connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY, 0, 1 );
if ( nodeY > sY ) connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], 0, 0, nodeX, nodeY );
else connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], 0, 1, nodeX, nodeY );
connect.stroke( nodeStyle.stroke );
}
}
......
......@@ -34,9 +34,8 @@ KityMinder.registerModule( "LayoutModule", function () {
},
initStyle: function () {
var curStyle = this.getCurrentStyle();
var lastTransform = this._rc.getTransform();
this._rc.remove();
this._rc = new kity.Group().setTransform( lastTransform );
this._rc = new kity.Group();
this._paper.addShape( this._rc );
var _root = this.getRoot();
......
......@@ -102,7 +102,7 @@ KityMinder.registerModule( 'View', function () {
base: Command,
execute: function ( km, focusNode ) {
var viewport = km.getPaper().getViewPort();
var offset = focusNode.getRenderContainer().getRenderBox( km.getRenderContainer() );
var offset = focusNode.getRenderContainer().getRenderBox( 'paper' );
var dx = viewport.center.x - offset.x - offset.width / 2,
dy = viewport.center.y - offset.y;
km.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment