mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Simplify injection scope for removeOn* methods.
This commit is contained in:
parent
a326b189b4
commit
b1332331b0
1 changed files with 17 additions and 20 deletions
|
@ -1820,7 +1820,13 @@ var Item = this.Item = Base.extend(/** @lends Item# */{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, new function() {
|
}, Base.each(['down', 'drag', 'up', 'move'], function(name) {
|
||||||
|
this['removeOn' + Base.capitalize(name)] = function() {
|
||||||
|
var hash = {};
|
||||||
|
hash[name] = true;
|
||||||
|
return this.removeOn(hash);
|
||||||
|
};
|
||||||
|
}, /** @lends Item# */{
|
||||||
/**
|
/**
|
||||||
* {@grouptitle Remove On Event}
|
* {@grouptitle Remove On Event}
|
||||||
*
|
*
|
||||||
|
@ -1934,15 +1940,7 @@ var Item = this.Item = Base.extend(/** @lends Item# */{
|
||||||
* path.removeOnUp();
|
* path.removeOnUp();
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: implement Item#removeOnFrame
|
// TODO: implement Item#removeOnFrame
|
||||||
return Base.each(['down', 'drag', 'up', 'move'], function(name) {
|
|
||||||
this['removeOn' + Base.capitalize(name)] = function() {
|
|
||||||
var hash = {};
|
|
||||||
hash[name] = true;
|
|
||||||
return this.removeOn(hash);
|
|
||||||
};
|
|
||||||
}, {
|
|
||||||
removeOn: function(obj) {
|
removeOn: function(obj) {
|
||||||
for (var name in obj) {
|
for (var name in obj) {
|
||||||
if (obj[name]) {
|
if (obj[name]) {
|
||||||
|
@ -1954,5 +1952,4 @@ var Item = this.Item = Base.extend(/** @lends Item# */{
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in a new issue