mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-04 02:00:29 -04:00
Use proposed drawableTouching interface from render (#1419)
* use new drawableTouching interface from render * Fix mock renderer for new API call * with lint fix
This commit is contained in:
parent
4b5cf6505a
commit
c092fe9f83
2 changed files with 5 additions and 9 deletions
|
@ -799,15 +799,7 @@ class RenderedTarget extends Target {
|
||||||
*/
|
*/
|
||||||
isTouchingPoint (x, y) {
|
isTouchingPoint (x, y) {
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
// @todo: Update once pick is in Scratch coordinates.
|
return this.renderer.drawableTouching(this.drawableID, x, y);
|
||||||
// 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 false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
4
test/fixtures/fake-renderer.js
vendored
4
test/fixtures/fake-renderer.js
vendored
|
@ -30,6 +30,10 @@ FakeRenderer.prototype.pick = function (x, y, a, b, d) { // eslint-disable-line
|
||||||
return true;
|
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
|
FakeRenderer.prototype.isTouchingColor = function (d, c) { // eslint-disable-line no-unused-vars
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue