Merge pull request #2293 from paulkaplan/fix-video-motion-matrix

Fix video sensing error with stale matrices
This commit is contained in:
Paul Kaplan 2019-10-17 11:07:16 -04:00 committed by GitHub
commit 5a556dd671
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -289,6 +289,11 @@ class VideoMotion {
_curr: curr _curr: curr
} = this; } = 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 // Restrict the region the amount and direction are built from to
// the area of the current frame overlapped by the given drawable's // the area of the current frame overlapped by the given drawable's
// bounding box. // bounding box.

View file

@ -87,6 +87,8 @@ const isNearAngle = (actual, expect, optMargin = 10) => (
// A fake scratch-render drawable that will be used by VideoMotion to restrain // A fake scratch-render drawable that will be used by VideoMotion to restrain
// the area considered for motion detection in VideoMotion.getLocalMotion // the area considered for motion detection in VideoMotion.getLocalMotion
const fakeDrawable = { const fakeDrawable = {
updateMatrix () {}, // no-op, since isTouching always returns true
getFastBounds () { getFastBounds () {
return { return {
left: -120, left: -120,