Commit 163c528d authored by techird's avatar techird

rename cancel to stopPropagation

parent 8b7c0bfa
......@@ -86,9 +86,9 @@ kity.extendClass( KityMinder, ( function () {
commandArgs: cmdArgs
};
var canceled = me._fire( new MinderEvent( 'beforecommand', eventParams, true ) );
var stoped = me._fire( new MinderEvent( 'beforecommand', eventParams, true ) );
if ( !canceled ) {
if ( !stoped ) {
me._fire( new MinderEvent( "precommand", eventParams, false ) );
......@@ -213,8 +213,8 @@ kity.extendClass( KityMinder, {
var minder = this;
clearTimeout( this.interactTimeout );
this.interactTimeout = setTimeout( function () {
var canceled = minder._fire( new MinderEvent( 'beforeinteractchange' ) );
if ( canceled ) {
var stoped = minder._fire( new MinderEvent( 'beforeinteractchange' ) );
if ( stoped ) {
return;
}
minder._fire( new MinderEvent( 'preinteractchange' ) );
......@@ -232,11 +232,11 @@ kity.extendClass( KityMinder, {
}
for ( var i = 0; i < callbacks.length; i++ ) {
callbacks[ i ].call( this, e );
if ( e.shouldCancelImmediately() ) {
if ( e.shouldStopPropagationImmediately() ) {
break;
}
}
return e.shouldCancel();
return e.shouldStopPropagation();
},
on: function ( name, callback ) {
var types = name.split( ' ' );
......@@ -307,9 +307,9 @@ kity.extendClass( KityMinder, {
importData: treeData
};
var canceled = this._fire( new MinderEvent( 'beforeimport', params, true ) );
var stoped = this._fire( new MinderEvent( 'beforeimport', params, true ) );
if ( canceled ) return this;
if ( stoped ) return this;
this._fire( new MinderEvent( 'preimport', params, false ) );
......
var MinderEvent = kity.createClass( 'MindEvent', {
constructor: function ( type, params, cancelable ) {
constructor: function ( type, params, canstop ) {
params = params || {};
if ( params.getType && params.getType() == 'ShapeEvent' ) {
this.kityEvent = params;
......@@ -8,7 +8,7 @@ var MinderEvent = kity.createClass( 'MindEvent', {
kity.Utils.extend( this, params );
}
this.type = type;
this._cancelable = cancelable || false;
this._canstop = canstop || false;
if ( params.targetShape ) {
this.getTargetNode = function () {
var findShape = params.targetShape;
......@@ -20,20 +20,20 @@ var MinderEvent = kity.createClass( 'MindEvent', {
}
},
cancel: function () {
this._canceled = true;
stopPropagation: function () {
this._stoped = true;
},
cancelImmediately: function () {
this._immediatelyCanceld = true;
this._canceled = true;
stopPropagationImmediately: function () {
this._immediatelyStoped = true;
this._stoped = true;
},
shouldCancel: function () {
return this._cancelable && this._canceled;
shouldStopPropagation: function () {
return this._canstop && this._stoped;
},
shouldCancelImmediately: function () {
return this._cancelable && this._immediatelyCanceld;
shouldStopPropagationImmediately: function () {
return this._canstop && this._immediatelyStoped;
}
} );
\ No newline at end of file
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