Commit 408f2ed0 authored by campaign's avatar campaign

by zhanyi

parent ca15319e
...@@ -14,15 +14,11 @@ kity.extendClass( Minder, function () { ...@@ -14,15 +14,11 @@ kity.extendClass( Minder, function () {
this._selectedNodes = []; this._selectedNodes = [];
}, },
getSelectedNodes: function () { getSelectedNodes: function () {
//如果没有选中节点,默认是root节点
if ( this._selectedNodes.length === 0 ) {
this._selectedNodes.push( this.getRoot() );
}
//不能克隆返回,会对当前选区操作,从而影响querycommand //不能克隆返回,会对当前选区操作,从而影响querycommand
return this._selectedNodes; return this._selectedNodes;
}, },
getSelectedNode: function () { getSelectedNode: function () {
return this.getSelectedNodes()[ 0 ]; return this.getSelectedNodes()[ 0 ] || null;
}, },
removeAllSelectedNodes: function () { removeAllSelectedNodes: function () {
var me = this; var me = this;
......
...@@ -12,7 +12,7 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -12,7 +12,7 @@ KityMinder.registerModule( "TextEditModule", function () {
"events": { "events": {
'beforemousedown':function(e){ 'beforemousedown':function(e){
cursor.setHide(); cursor.setHide();
var node = e.getTargetNode(); var node = this.getSelectedNode();
if(node){ if(node){
var textShape = node.getTextShape(); var textShape = node.getTextShape();
textShape.setStyle('cursor','default'); textShape.setStyle('cursor','default');
......
...@@ -71,10 +71,7 @@ KityMinder.registerModule( "MouseModule", function () { ...@@ -71,10 +71,7 @@ KityMinder.registerModule( "MouseModule", function () {
}; };
} )(); } )();
return { return {
"init": function () {
// kity.extendClass( kity.Paper, Draggable );
// this._paper.drag();
},
"events": { "events": {
'mousedown touchstart': function ( e ) { 'mousedown touchstart': function ( e ) {
if ( e.originEvent.touches && e.originEvent.touches.length != 1 ) return; if ( e.originEvent.touches && e.originEvent.touches.length != 1 ) return;
...@@ -97,8 +94,7 @@ KityMinder.registerModule( "MouseModule", function () { ...@@ -97,8 +94,7 @@ KityMinder.registerModule( "MouseModule", function () {
var node = e.getTargetNode(); var node = e.getTargetNode();
if ( !node ) return; if ( !node ) return;
this._touchTimeout = setTimeout( function () { this._touchTimeout = setTimeout( function () {
me.clearSelect();
me.execCommand( 'kbCreateAndEdit', 'child', node );
}, 200 ); }, 200 );
} }
}, },
......
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