Skip to content

Commit d989824

Browse files
committed
Improve performance of renderer.pick() calls
Only consider drawables that correspond to a target in the VM. Related to TurboWarp/scratch-gui#1026
1 parent 90ddd5f commit d989824

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/scaffolding/scaffolding.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ class Scaffolding extends EventTarget {
133133

134134
_startDragging (x, y) {
135135
if (this._draggingId) return;
136-
const drawableId = this.renderer.pick(x, y);
136+
const drawableId = this.renderer.pick(
137+
x,
138+
y,
139+
1,
140+
1,
141+
// Disregard pen, video sensing, and other drawables added by extensions.
142+
this.vm.runtime.targets.map(i => i.drawableID)
143+
);
137144
if (drawableId === -1 || drawableId === false) return;
138145
const targetId = this.vm.getTargetIdForDrawableId(drawableId);
139146
if (targetId === null) return;

0 commit comments

Comments
 (0)