Merge pull request #1040 from paulkaplan/filter-dragging-touching

Filter out dragging targets from touching sprite check.
This commit is contained in:
Paul Kaplan 2018-04-11 09:17:52 -04:00 committed by GitHub
commit 2478f2ff8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -734,7 +734,11 @@ class RenderedTarget extends Target {
if (!firstClone || !this.renderer) { if (!firstClone || !this.renderer) {
return false; return false;
} }
const drawableCandidates = firstClone.sprite.clones.map(clone => clone.drawableID); // Filter out dragging targets. This means a sprite that is being dragged
// can detect other sprites using touching <sprite>, but cannot be detected
// by other sprites while it is being dragged. This matches Scratch 2.0 behavior.
const drawableCandidates = firstClone.sprite.clones.filter(clone => !clone.dragging)
.map(clone => clone.drawableID);
return this.renderer.isTouchingDrawables( return this.renderer.isTouchingDrawables(
this.drawableID, drawableCandidates); this.drawableID, drawableCandidates);
} }