Circuit-Editor Multi-Target Gate Support#3426
Draft
ScottCarda-MS wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Circuit Editor: multi-target / group drag-editing
At a glance
source/npm/qsharp/.mjstests. No Rust, no VS Code host.What this PR adds
The multi-target / group drag-editing behavior, layered onto the
single-target editing foundation:
Rigid unit-move. Dragging a multi-target gate or a group shifts the
gate's own
.targetsand recursively remaps every register reference inits child grid by the same delta, so the box and its contents stay aligned.
Classical controls anchor correctly:
classical control anchors on the original wire;
consumer's classical control shifts in lockstep, and
numResultsbookkeeping follows the measurement.
without mutating the model.
Clone-as-unit (Ctrl-drag). Ctrl-dragging a multi-target gate / group
leaves the source in place and drops a full copy at the target, with the same
child-register remap as a unit-move.
Shift-to-extend. Holding Shift while dragging a child out of an expanded
group offers dropzones on wires outside the group's span (skipping wires
blocked by ancestor-column siblings) and paints a ghost border showing the
extended bounds — extending the group onto new wires.
Files changed
Source (4):
actions/circuit-actions/move.tsmoveAsUnit,shiftAllRegisters, subtree wire-swap helpers; the unit-shift branch ofmoveY; group-body target handling.actions/circuitActions.tsmoveOperationunit-shift wire-growth;addOperationclone-as-unit +sourceWireparam.editor/controllers/dragController.tssetupShiftExtend/spawn/paintGhostBorder/tearDown) + the per-op multi-leg dropzone loop.editor/draggable.tsmakeShiftExtendGhostgeometry helper.Tests (4):
test/circuit-editor/circuit-actions/groupClone.test.mjstest/circuit-editor/circuit-actions/groupMove.test.mjstest/circuit-editor/dragController.test.mjstest/circuit-editor/draggable.test.mjsmakeShiftExtendGhostgeometry tests.Testing
+26 circuit-editor tests across the 4 test files above, all passing.
Run locally from
source/npm/qsharp/: