diff --git a/src/extensions/scratch3_video_sensing/library.js b/src/extensions/scratch3_video_sensing/library.js index 04abc20ea..5a6ac344e 100644 --- a/src/extensions/scratch3_video_sensing/library.js +++ b/src/extensions/scratch3_video_sensing/library.js @@ -289,6 +289,11 @@ class VideoMotion { _curr: curr } = this; + // The public APIs for Renderer#isTouching manage keeping the matrix and + // silhouette up-to-date, which is needed for drawable#isTouching to work (used below) + drawable.updateMatrix(); + if (drawable.skin) drawable.skin.updateSilhouette(); + // Restrict the region the amount and direction are built from to // the area of the current frame overlapped by the given drawable's // bounding box. diff --git a/test/unit/extension_video_sensing.js b/test/unit/extension_video_sensing.js index 5a217589f..197c06e87 100644 --- a/test/unit/extension_video_sensing.js +++ b/test/unit/extension_video_sensing.js @@ -87,6 +87,8 @@ const isNearAngle = (actual, expect, optMargin = 10) => ( // A fake scratch-render drawable that will be used by VideoMotion to restrain // the area considered for motion detection in VideoMotion.getLocalMotion const fakeDrawable = { + updateMatrix () {}, // no-op, since isTouching always returns true + getFastBounds () { return { left: -120,