mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix issue with removeOnMove() calls sometimes removing items too early.
Closes #181.
This commit is contained in:
parent
c0392b837c
commit
80600d2a2b
1 changed files with 10 additions and 5 deletions
|
@ -322,10 +322,9 @@ var Tool = this.Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
|||
return true;
|
||||
},
|
||||
|
||||
_onHandleEvent: function(type, point, event) {
|
||||
// Update global reference to this scope.
|
||||
paper = this._scope;
|
||||
// Handle removeOn* calls first
|
||||
fire: function(type, event) {
|
||||
// Override Callback#fire() so we can handle items marked in removeOn*()
|
||||
// calls first,.
|
||||
var sets = Tool._removeSets;
|
||||
if (sets) {
|
||||
// Always clear the drag set on mouseup
|
||||
|
@ -339,7 +338,7 @@ var Tool = this.Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
|||
// other sets.
|
||||
for (var key in sets) {
|
||||
var other = sets[key];
|
||||
if (other && other != set && other[item._id])
|
||||
if (other && other != set)
|
||||
delete other[item._id];
|
||||
}
|
||||
item.remove();
|
||||
|
@ -347,6 +346,12 @@ var Tool = this.Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
|||
sets[type] = null;
|
||||
}
|
||||
}
|
||||
return this.base(type, event);
|
||||
},
|
||||
|
||||
_onHandleEvent: function(type, point, event) {
|
||||
// Update global reference to this scope.
|
||||
paper = this._scope;
|
||||
// Now handle event callbacks
|
||||
var called = false;
|
||||
switch (type) {
|
||||
|
|
Loading…
Reference in a new issue