Commit 679bf01a authored by Akikonata's avatar Akikonata

added highlight

parent f965a887
......@@ -44,7 +44,7 @@ kity.extendClass( Minder, {
stroke: "orange",
color: "black",
padding: [ 5, 10, 5, 10 ],
fontSize: 20,
fontSize: 20
};
var kR = node.getRenderContainer();
......@@ -79,6 +79,11 @@ kity.extendClass( Minder, {
nodeShape.shape.setTransform( new kity.Matrix().translate( node.getData( "x" ), node.getData( "y" ) - _rectHeight / 2 ) );
break;
}
if ( node.getData( "highlight" ) ) {
nodeShape.highlight();
} else {
nodeShape.unhighlight();
}
},
renderNodes: function ( nodes ) {
var km = this;
......
......@@ -14,16 +14,21 @@ kity.extendClass( Minder, {
for ( var i = 0; i < nodes.length; i++ ) {
if ( selection.indexOf( nodes[ i ] ) === -1 ) {
selection.push( nodes[ i ] );
this.highlightNode( nodes[ i ] );
}
}
return this;
},
highlightNode: function ( node ) {
node.setData( "highlight", true );
this.renderNode( node );
},
isNodeSelected: function ( node ) {
return !!~this._selectedNodes.indexOf( node );
},
selectSingle: function ( node ) {
this.highlightNode( node );
return this.clearSelect().select( node );
},
......@@ -35,8 +40,10 @@ kity.extendClass( Minder, {
for ( var i = 0; i < nodes.length; i++ ) {
if ( selection.indexOf( nodes[ i ] ) === -1 ) {
needAdd.push( nodes[ i ] );
this.highlightNode( nodes[ i ] );
} else {
needRemove.push( nodes[ i ] );
this.unhighlightNode( nodes[ i ] );
}
}
return this.clearSelect( needRemove ).select( needAdd );
......@@ -57,5 +64,9 @@ kity.extendClass( Minder, {
}
this._selectedNodes = newSelection;
return this;
},
unhighlightNode: function ( node ) {
node.setData( "highlight", false );
this.renderNode( node );
}
} );
\ No newline at end of file
......@@ -83,7 +83,6 @@ KityMinder.registerModule( "LayoutModule", function () {
};
var createChildNode = function ( km, parent, index ) {
console.log( "cc" );
var root = km.getRoot();
var appendSide = parent.getData( "appendside" );
var _node = new MinderNode();
......
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