mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-30 15:49:50 -04:00
Reverse direction of child-looping in hit-tests, so items that get drawn last are tested first.
This commit is contained in:
parent
48d61b46bf
commit
a580b23f2a
2 changed files with 4 additions and 2 deletions
src/project
|
@ -183,7 +183,8 @@ var Project = this.Project = Base.extend(/** @lends Project# */{
|
|||
|
||||
hitTest: function(point, options) {
|
||||
options = HitResult.getOptions(options);
|
||||
for (var i = 0, l = this.layers.length; i < l; i++) {
|
||||
// Loop backwards, so layers that get drawn last are tested first
|
||||
for (var i = this.layers.length - 1; i >= 0; i--) {
|
||||
var res = this.layers[i].hitTest(point, options);
|
||||
if (res)
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue