Use proposed drawableTouching interface from render ()

* use new drawableTouching interface from render

* Fix mock renderer for new API call

* with lint fix
This commit is contained in:
Mx Corey Frang 2018-08-09 10:10:23 -04:00 committed by GitHub
parent 4b5cf6505a
commit c092fe9f83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions
src/sprites
test/fixtures

View file

@ -799,15 +799,7 @@ class RenderedTarget extends Target {
*/
isTouchingPoint (x, y) {
if (this.renderer) {
// @todo: Update once pick is in Scratch coordinates.
// Limits test to this Drawable, so this will return true
// even if the clone is obscured by another Drawable.
const pickResult = this.runtime.renderer.pick(
x, y,
null, null,
[this.drawableID]
);
return pickResult === this.drawableID;
return this.renderer.drawableTouching(this.drawableID, x, y);
}
return false;
}

View file

@ -30,6 +30,10 @@ FakeRenderer.prototype.pick = function (x, y, a, b, d) { // eslint-disable-line
return true;
};
FakeRenderer.prototype.drawableTouching = function (d, x, y, w, h) { // eslint-disable-line no-unused-vars
return true;
};
FakeRenderer.prototype.isTouchingColor = function (d, c) { // eslint-disable-line no-unused-vars
return true;
};