Skip to content

Commit

Permalink
Don't include text bubbles in touching queries
Browse files Browse the repository at this point in the history
  • Loading branch information
adroitwhiz committed Feb 7, 2020
1 parent b3bcbe4 commit 375c0d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/RenderWebGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/TextBubbleSkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ class TextBubbleSkin extends Skin {
this._renderedScale = scale;
}

updateSilhouette (scale = [100, 100]) {
// Ensure a silhouette exists.
this.getTexture(scale);
}

/**
* @param {Array<number>} 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.
Expand Down

0 comments on commit 375c0d5

Please sign in to comment.