Commit 163c528d authored by techird's avatar techird

rename cancel to stopPropagation

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