From c36ff056a2d6c19a29fd9f121a21a945698adadd Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Fri, 20 Apr 2018 10:43:45 -0400 Subject: [PATCH] Add new event for all visual target changes, not just moving. --- src/sprites/rendered-target.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index 19489d575..c87f3fd72 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -193,6 +193,14 @@ class RenderedTarget extends Target { return 'TARGET_MOVED'; } + /** + * Event which fires when a target changes visually, for updating say bubbles. + * @type {string} + */ + static get EVENT_TARGET_VISUAL_CHANGE () { + return 'EVENT_TARGET_VISUAL_CHANGE'; + } + /** * Rotation style for "all around"/spinning. * @type {string} @@ -249,6 +257,7 @@ class RenderedTarget extends Target { position: position }); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } else { @@ -299,6 +308,7 @@ class RenderedTarget extends Target { scale: renderedDirectionScale.scale }); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -346,6 +356,7 @@ class RenderedTarget extends Target { visible: this.visible }); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -378,6 +389,7 @@ class RenderedTarget extends Target { scale: renderedDirectionScale.scale }); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -397,6 +409,7 @@ class RenderedTarget extends Target { props[effectName] = this.effects[effectName]; this.renderer.updateDrawableProperties(this.drawableID, props); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -413,6 +426,7 @@ class RenderedTarget extends Target { if (this.renderer) { this.renderer.updateDrawableProperties(this.drawableID, this.effects); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -446,6 +460,7 @@ class RenderedTarget extends Target { } this.renderer.updateDrawableProperties(this.drawableID, drawableProperties); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -573,6 +588,7 @@ class RenderedTarget extends Target { scale: renderedDirectionScale.scale }); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -645,6 +661,7 @@ class RenderedTarget extends Target { } this.renderer.updateDrawableProperties(this.drawableID, props); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } } @@ -1034,6 +1051,7 @@ class RenderedTarget extends Target { if (this.renderer && this.drawableID !== null) { this.renderer.destroyDrawable(this.drawableID); if (this.visible) { + this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this); this.runtime.requestRedraw(); } }