Skip to content

Commit

Permalink
Allow dragging columns out of the circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
Strilanc committed Mar 23, 2019
1 parent f09cd08 commit 6da666c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ui/DisplayedCircuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class DisplayedCircuit {
}

/**
* The number of wires that were in the circuit before picking up a gate, or the number that will be in the circuit
* after dropping a gate; whichever is larger.
* @returns {!int}
* @private
*/
Expand Down Expand Up @@ -661,6 +663,13 @@ class DisplayedCircuit {
if (hand.pos === undefined) {
return this;
}
let handWire = this.wireIndexAt(hand.pos.y);
if (handWire < 0 || handWire >= Config.MAX_WIRE_COUNT || hand.pos.x <= 1) {
// Dragged the gate column out of the circuit.
return this;
}


let halfCol = this.findOpHalfColumnAt(new Point(hand.pos.x, this.top));
let mustInsert = halfCol % 1 === 0 &&
this.circuitDefinition.columns[halfCol] !== undefined &&
Expand Down

0 comments on commit 6da666c

Please sign in to comment.