Skip to content

Commit 8d55eab

Browse files
committed
Return earlier in isTouchingDrawables if invisible
1 parent 7961940 commit 8d55eab

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/RenderWebGL.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,11 +1251,15 @@ class RenderWebGL extends EventEmitter {
12511251
* @returns {boolean} True if the Drawable is touching one of candidateIDs.
12521252
*/
12531253
isTouchingDrawables (drawableID, candidateIDs = this._drawList) {
1254+
// if we are invisible we don't touch anything.
1255+
if (!this._allDrawables[drawableID]._visible) {
1256+
return false;
1257+
}
1258+
12541259
const candidates = this._candidatesTouching(drawableID,
12551260
// even if passed an invisible drawable, we will NEVER touch it!
12561261
candidateIDs.filter(id => this._allDrawables[id]._visible));
1257-
// if we are invisble we don't touch anything.
1258-
if (candidates.length === 0 || !this._allDrawables[drawableID]._visible) {
1262+
if (candidates.length === 0) {
12591263
return false;
12601264
}
12611265

@@ -1670,8 +1674,6 @@ class RenderWebGL extends EventEmitter {
16701674
const id = candidateIDs[index];
16711675
if (id !== drawableID) {
16721676
const drawable = this._allDrawables[id];
1673-
// Text bubbles aren't considered in "touching" queries
1674-
if (drawable.skin instanceof TextBubbleSkin) continue;
16751677
if (drawable.skin && drawable._visible) {
16761678
// If private skin access is disabled, do not allow projects to use touching blocks to guess the
16771679
// contents of a private skin.

0 commit comments

Comments
 (0)