diff --git a/src/main.js b/src/main.js index 78f1361f..bdb556d3 100644 --- a/src/main.js +++ b/src/main.js @@ -247,7 +247,7 @@ canvasDiv.addEventListener('mousedown', ev => { let newHand = displayed.get().hand.withPos(eventPosRelativeTo(ev, canvas)); let newInspector = syncArea(displayed.get()). withHand(newHand). - afterGrabbing(false, false). // Grab the gate. + afterGrabbing(false, false, true). // Grab the gate. withHand(newHand). // Lose the gate. afterTidyingUp(). withJustEnoughWires(newHand, 0); diff --git a/src/ui/DisplayedCircuit.js b/src/ui/DisplayedCircuit.js index 9b1d35a8..970b952a 100644 --- a/src/ui/DisplayedCircuit.js +++ b/src/ui/DisplayedCircuit.js @@ -948,13 +948,24 @@ class DisplayedCircuit { * @param {!Hand} hand * @param {!boolean=false} duplicate * @param {!boolean=false} wholeColumn + * @param {!boolean=false} ignoreResizeTabs * @returns {!{newCircuit: !DisplayedCircuit, newHand: !Hand}} */ - tryGrab(hand, duplicate=false, wholeColumn=false) { + tryGrab(hand, duplicate=false, wholeColumn=false, ignoreResizeTabs=false) { if (wholeColumn) { return this._tryGrabWholeColumn(hand, duplicate) || {newCircuit: this, newHand: hand}; } - let {newCircuit, newHand} = this._tryGrabResizeTab(hand) || {newCircuit: this, newHand: hand}; + + let newHand = hand; + let newCircuit = this; + if (!ignoreResizeTabs) { + let resizing = this._tryGrabResizeTab(hand); + if (resizing !== undefined) { + newHand = resizing.newHand; + newCircuit = resizing.newCircuit; + } + } + return newCircuit._tryGrabGate(newHand, duplicate) || {newCircuit, newHand}; } diff --git a/src/ui/DisplayedInspector.js b/src/ui/DisplayedInspector.js index daae2b71..296166d8 100644 --- a/src/ui/DisplayedInspector.js +++ b/src/ui/DisplayedInspector.js @@ -146,15 +146,16 @@ class DisplayedInspector { /** * @param {!boolean=false} duplicate * @param {!boolean=false} wholeCol + * @param {!boolean=false} ignoreResizeTabs * @returns {!DisplayedInspector} */ - afterGrabbing(duplicate=false, wholeCol=false) { + afterGrabbing(duplicate=false, wholeCol=false, ignoreResizeTabs=false) { let hand = this.hand; let circuit = this.displayedCircuit; hand = this.displayedToolboxTop.tryGrab(hand); hand = this.displayedToolboxBottom.tryGrab(hand); - let obj = circuit.tryGrab(hand, duplicate, wholeCol); + let obj = circuit.tryGrab(hand, duplicate, wholeCol, ignoreResizeTabs); hand = obj.newHand; circuit = obj.newCircuit;