From 20a23e89c72616321c2808c215819b259fa5752f Mon Sep 17 00:00:00 2001 From: GarboMuffin Date: Tue, 22 Aug 2023 00:58:54 -0500 Subject: [PATCH] NexusKitten/moremotion: use exported renderer.Rectangle (#800) --- extensions/NexusKitten/moremotion.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/extensions/NexusKitten/moremotion.js b/extensions/NexusKitten/moremotion.js index 324751ac3f..96f4c6a4c3 100644 --- a/extensions/NexusKitten/moremotion.js +++ b/extensions/NexusKitten/moremotion.js @@ -10,6 +10,9 @@ throw new Error('More Motion must run unsandboxed'); } + // @ts-expect-error - not typed yet + const Rectangle = Scratch.vm.renderer.exports.Rectangle; + class nkmoremotion { getInfo() { return { @@ -303,10 +306,6 @@ const drawableBounds = drawable.getFastBounds(); drawableBounds.snapToInt(); - // This is bad, need to rewrite this when renderer exports Rectangle - const Rectangle = Object.getPrototypeOf(drawableBounds).constructor; - - /** @type {RenderWebGL.Rectangle} */ const containsBounds = new Rectangle(); containsBounds.initFromBounds(left, right, bottom, top); containsBounds.snapToInt(); @@ -317,7 +316,6 @@ drawable.updateCPURenderAttributes(); - /** @type {RenderWebGL.Rectangle} */ const intersectingBounds = Rectangle.intersect(drawableBounds, containsBounds); for (let x = intersectingBounds.left; x < intersectingBounds.right; x++) { for (let y = intersectingBounds.bottom; y < intersectingBounds.top; y++) {