Skip to content

Commit

Permalink
NexusKitten/moremotion: use exported renderer.Rectangle (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin authored Aug 22, 2023
1 parent cea21c5 commit 20a23e8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions extensions/NexusKitten/moremotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand All @@ -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++) {
Expand Down

0 comments on commit 20a23e8

Please sign in to comment.