From df2461689e8c081499cb931da208167a3b9f6075 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 | 8 +++++++- src/TextBubbleSkin.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/RenderWebGL.js b/src/RenderWebGL.js index 173e08f9b..35d2ef8df 100644 --- a/src/RenderWebGL.js +++ b/src/RenderWebGL.js @@ -859,7 +859,11 @@ class RenderWebGL extends EventEmitter { gl.colorMask(true, true, true, true); this._drawThese(candidateIDs, ShaderManager.DRAW_MODE.default, projection, - {idFilterFunc: testID => testID !== drawableID} + {idFilterFunc: testID => + testID !== drawableID && + // Text bubbles aren't considered in "touching" queries + !(this._allDrawables[testID].skin instanceof TextBubbleSkin) + } ); } finally { gl.colorMask(true, true, true, true); @@ -1293,6 +1297,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.updateMatrix(); diff --git a/src/TextBubbleSkin.js b/src/TextBubbleSkin.js index 77a083194..0ce6ac1a2 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.