Skip to content

Commit f212ef8

Browse files
authored
RenderWebGL.js -- lag fix with interactive drawables
1 parent fe60875 commit f212ef8

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/RenderWebGL.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,18 @@ class RenderWebGL extends EventEmitter {
829829
skin.private = true;
830830
}
831831

832+
/**
833+
* Mark a drawable as being non-interactive by default.
834+
* @param {number} drawableID The drawable's ID
835+
*/
836+
markDrawableAsNoninteractive (drawableID) {
837+
const drawable = this._allDrawables[drawableID];
838+
if (!drawable) {
839+
return;
840+
}
841+
drawable.interactive = false;
842+
}
843+
832844
/**
833845
* Set the layer group ordering for the renderer.
834846
* @param {Array<string>} groupOrdering The ordered array of layer group
@@ -1709,12 +1721,14 @@ class RenderWebGL extends EventEmitter {
17091721

17101722
candidateIDs = (candidateIDs || this._drawList).filter(id => {
17111723
const drawable = this._allDrawables[id];
1724+
if (!candidateIDs && !drawable.interactive) {
1725+
return false;
1726+
}
17121727
// default pick list ignores visible and ghosted sprites.
17131728
if (drawable.getVisible() && drawable.getUniforms().u_ghost !== 0) {
17141729
const drawableBounds = drawable.getFastBounds();
17151730
const inRange = bounds.intersects(drawableBounds);
17161731
if (!inRange) return false;
1717-
if (drawable.skin instanceof PenSkin) return false;
17181732

17191733
drawable.updateCPURenderAttributes();
17201734
return true;

0 commit comments

Comments
 (0)