Skip to content

Commit bd14d53

Browse files
committed
make sure drawable matrix and silhouette for mouse touching
RenderWebGL methods that test drawable touching should call updateMatrix and updateSilhouette before calling drwaable.isTouching. These methods are called by RenderWebGL instead of isTouching because isTouching can be called repeatedly in quick succession. Calling update methods in isTouching would waste a lot of cycles.
1 parent 5f9ca5b commit bd14d53

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/RenderWebGL.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,9 @@ class RenderWebGL extends EventEmitter {
930930
const bounds = this.clientSpaceToScratchBounds(centerX, centerY, touchWidth, touchHeight);
931931
const worldPos = twgl.v3.create();
932932

933+
drawable.updateMatrix();
934+
drawable.skin.updateSilhouette();
935+
933936
for (worldPos[1] = bounds.bottom; worldPos[1] <= bounds.top; worldPos[1]++) {
934937
for (worldPos[0] = bounds.left; worldPos[0] <= bounds.right; worldPos[0]++) {
935938
if (drawable.isTouching(worldPos)) {

0 commit comments

Comments
 (0)