From d943c89aa589c6fee63c92d771a15981a1ea49e5 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Mon, 9 Nov 2020 17:57:19 -0500 Subject: [PATCH] Set convex hull dirty when silhouettes update --- src/Drawable.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Drawable.js b/src/Drawable.js index 907654571..70a117ca0 100644 --- a/src/Drawable.js +++ b/src/Drawable.js @@ -123,6 +123,7 @@ class Drawable { this._transformedHullDirty = true; this._skinWasAltered = this._skinWasAltered.bind(this); + this._silhouetteWasUpdated = this._silhouetteWasUpdated.bind(this); this.isTouching = this._isTouchingNever; } @@ -166,10 +167,12 @@ class Drawable { if (this._skin !== newSkin) { if (this._skin) { this._skin.removeListener(Skin.Events.WasAltered, this._skinWasAltered); + this._skin.removeListener(Skin.Events.SilhouetteUpdated, this._silhouetteWasUpdated); } this._skin = newSkin; if (this._skin) { this._skin.addListener(Skin.Events.WasAltered, this._skinWasAltered); + this._skin.addListener(Skin.Events.SilhouetteUpdated, this._silhouetteWasUpdated); } this._skinWasAltered(); } @@ -696,6 +699,14 @@ class Drawable { this.setTransformDirty(); } + /** + * Respond to an internal change in the current Skin's silhouette. + * @private + */ + _silhouetteWasUpdated () { + this.setConvexHullDirty(); + } + /** * Calculate a color to represent the given ID number. At least one component of * the resulting color will be non-zero if the ID is not RenderConstants.ID_NONE.