Skip to content

Commit 80600d2

Browse files
committed
Fix issue with removeOnMove() calls sometimes removing items too early.
Closes paperjs#181.
1 parent c0392b8 commit 80600d2

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/tool/Tool.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,9 @@ var Tool = this.Tool = PaperScopeItem.extend(/** @lends Tool# */{
322322
return true;
323323
},
324324

325-
_onHandleEvent: function(type, point, event) {
326-
// Update global reference to this scope.
327-
paper = this._scope;
328-
// Handle removeOn* calls first
325+
fire: function(type, event) {
326+
// Override Callback#fire() so we can handle items marked in removeOn*()
327+
// calls first,.
329328
var sets = Tool._removeSets;
330329
if (sets) {
331330
// Always clear the drag set on mouseup
@@ -339,14 +338,20 @@ var Tool = this.Tool = PaperScopeItem.extend(/** @lends Tool# */{
339338
// other sets.
340339
for (var key in sets) {
341340
var other = sets[key];
342-
if (other && other != set && other[item._id])
341+
if (other && other != set)
343342
delete other[item._id];
344343
}
345344
item.remove();
346345
}
347346
sets[type] = null;
348347
}
349348
}
349+
return this.base(type, event);
350+
},
351+
352+
_onHandleEvent: function(type, point, event) {
353+
// Update global reference to this scope.
354+
paper = this._scope;
350355
// Now handle event callbacks
351356
var called = false;
352357
switch (type) {

0 commit comments

Comments
 (0)