From ac935423afe3ba79235750eecb1e443474c6eb09 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Fri, 7 Feb 2020 10:47:30 -0500 Subject: [PATCH] Don't include text bubbles in touching queries --- src/RenderWebGL.js | 2 ++ src/TextBubbleSkin.js | 5 +++++ ...-bubble.sb2.skip => doesnt-touch-say-bubble.sb2} | Bin 3 files changed, 7 insertions(+) rename test/integration/scratch-tests/{doesnt-touch-say-bubble.sb2.skip => doesnt-touch-say-bubble.sb2} (100%) diff --git a/src/RenderWebGL.js b/src/RenderWebGL.js index c455e17..29ffc58 100644 --- a/src/RenderWebGL.js +++ b/src/RenderWebGL.js @@ -1292,6 +1292,8 @@ class RenderWebGL extends EventEmitter { const id = candidateIDs[index]; if (id !== drawableID) { const drawable = this._allDrawables[id]; + // Text bubbles aren't considered in "touching" queries + if (drawable.skin instanceof TextBubbleSkin) continue; if (drawable.skin && drawable._visible) { // Update the CPU position data drawable.updateCPURenderAttributes(); diff --git a/src/TextBubbleSkin.js b/src/TextBubbleSkin.js index 77a0831..0ce6ac1 100644 --- a/src/TextBubbleSkin.js +++ b/src/TextBubbleSkin.js @@ -241,6 +241,11 @@ class TextBubbleSkin extends Skin { this._renderedScale = scale; } + updateSilhouette (scale = [100, 100]) { + // Ensure a silhouette exists. + this.getTexture(scale); + } + /** * @param {Array} scale - The scaling factors to be used, each in the [0,100] range. * @return {WebGLTexture} The GL texture representation of this skin when drawing at the given scale. diff --git a/test/integration/scratch-tests/doesnt-touch-say-bubble.sb2.skip b/test/integration/scratch-tests/doesnt-touch-say-bubble.sb2 similarity index 100% rename from test/integration/scratch-tests/doesnt-touch-say-bubble.sb2.skip rename to test/integration/scratch-tests/doesnt-touch-say-bubble.sb2