diff --git a/src/main.js b/src/main.js index 099b744c..1b8bac24 100644 --- a/src/main.js +++ b/src/main.js @@ -233,7 +233,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 43a6f6e2..f4f86741 100644 --- a/src/ui/DisplayedCircuit.js +++ b/src/ui/DisplayedCircuit.js @@ -934,13 +934,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 1a50cffe..8c428447 100644 --- a/src/ui/DisplayedInspector.js +++ b/src/ui/DisplayedInspector.js @@ -132,15 +132,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;