Skip to content

Commit

Permalink
Don't add touch blockers to circuit area when drawing custom circuit …
Browse files Browse the repository at this point in the history
…gates in toolbox
  • Loading branch information
Strilanc committed Mar 24, 2019
1 parent 6da666c commit 32efb93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/draw/Painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,25 @@ class Painter {
* @type {!RestartableRng}
*/
this.rng = rng;

this._ignoringTouchBlockers = 0;
}

startIgnoringIncomingTouchBlockers() {
this._ignoringTouchBlockers += 1
}

stopIgnoringIncomingTouchBlockers() {
this._ignoringTouchBlockers -= 1
}

/**
* @param {!{rect: !Rect, cursor: undefined|!string}} blocker
*/
noteTouchBlocker(blocker) {
this.touchBlockers.push(blocker);
if (this._ignoringTouchBlockers === 0) {
this.touchBlockers.push(blocker);
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/ui/DisplayedToolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ class DisplayedToolbox {
*/
static _paintGate(painter, gate, rect, isHighlighted, stats) {
let drawer = gate.customDrawer || GatePainting.DEFAULT_DRAWER;
painter.startIgnoringIncomingTouchBlockers();
drawer(new GateDrawParams(
painter,
true, // inToolbox
Expand All @@ -302,6 +303,7 @@ class DisplayedToolbox {
undefined, // positionInCircuit
[], // focusPoints
undefined)); // customStatsForCircuitPos
painter.stopIgnoringIncomingTouchBlockers();
}

/**
Expand Down

0 comments on commit 32efb93

Please sign in to comment.