Commit 2c4bd20a authored by campaign's avatar campaign

修改了select功能

parent 1a6a1dce
......@@ -31,20 +31,17 @@ kity.extendClass( Minder, function () {
} );
this._selectedNodes = [];
},
select: function ( nodes ) {
this.removeAllSelectedNodes();
select: function ( nodes,isToggleSelect ) {
isToggleSelect && this.removeAllSelectedNodes();
var me = this;
Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) {
if ( me._selectedNodes.indexOf( n ) !== -1 )return;
me._selectedNodes.push( n );
highlightNode( me, n );
} );
return this;
},
addSelect: function ( node ) {
var me = this;
if ( me._selectedNodes.indexOf( node ) === -1 ) me._selectedNodes.push( node );
highlightNode( me, node );
},
isNodeSelected: function ( node ) {
return node.getData( 'highlight' ) === true;
},
......
......@@ -10,44 +10,45 @@ KityMinder.registerModule( "TextEditModule", function () {
this.getPaper().addShape(cursor);
},
"events": {
'aftermousedown':function(e){
if(this.isSingleSelect()){
debugger
var node = this.getSelectedNode();
var node_rc = node.getRenderContainer();
var position = e.getPosition();
if(node_rc.getType() != 'Text'){
var offset = e.getPosition();
cursor.setShow().setPosition(offset);
// receiver.clear()
// .setTextShape()
// .setTextShapeSize(cursor.height)
// .appendTextShapeToPaper(this.getPaper())
// .setPosition(position)
// .setRange(range,0)
// .setCursor(cursor)
receiver.setCursor(cursor)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(node_rc)
.setCursorHeight()
.setCurrentIndex(position)
.updateCursor()
.setRange(range,0);
}else{
'beforemousedown':function(e){
//
// if(this.isSingleSelect()){
// console.log('isSelect')
// var node = this.getSelectedNode();
// var node_rc = node.getRenderContainer();
// var position = e.getPosition();
// if(node_rc.getType() != 'Text'){
// var offset = e.getPosition();
// cursor.setShow().setPosition(offset);
//// receiver.clear()
//// .setTextShape()
//// .setTextShapeSize(cursor.height)
//// .appendTextShapeToPaper(this.getPaper())
//// .setPosition(position)
//// .setRange(range,0)
//// .setCursor(cursor)
// receiver.setCursor(cursor)
// .setKityMinder(this)
// .setMinderNode(e.getTargetNode())
// .setMinderNode(node)
// .setTextShape(node_rc)
// .setCursorHeight()
// .setCurrentIndex(position)
// .updateCursor()
// .setRange(range);
}
}
// .setRange(range,0);
// }else{
//
//
//// receiver.setCursor(cursor)
//// .setKityMinder(this)
//// .setMinderNode(e.getTargetNode())
//// .setTextShape(node_rc)
//// .setCursorHeight()
//// .setCurrentIndex(position)
//// .updateCursor()
//// .setRange(range);
//
// }
// }
}
}
......
......@@ -85,7 +85,7 @@ KityMinder.registerModule( "LayoutModule", function () {
execute: function ( km, node ) {
var parent = km.getSelectedNode();
km.appendChildNode( parent, node );
km.select( node );
km.select( node,true );
return node;
}
};
......@@ -100,7 +100,7 @@ KityMinder.registerModule( "LayoutModule", function () {
} else {
km.appendSiblingNode( selectedNode, node );
}
km.select( node );
km.select( node,true );
return node;
}
};
......
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