Skip to content

Commit

Permalink
fix: set convex hull dirty when silhouettes update
Browse files Browse the repository at this point in the history
  • Loading branch information
adroitwhiz committed Mar 3, 2024
1 parent 799fd18 commit b911304
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Drawable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit b911304

Please sign in to comment.