From e6b79e44da13fc559c83e2289992688e777b63b2 Mon Sep 17 00:00:00 2001 From: raycosine <17799860+Raycosine@users.noreply.github.com> Date: Wed, 8 Apr 2026 00:52:13 -0700 Subject: [PATCH 1/4] Add pan and zoom controls to Crumble (#1040) --- glue/crumble/README.md | 21 ++++++- glue/crumble/crumble.html | 5 ++ glue/crumble/draw/config.js | 4 +- glue/crumble/draw/main_draw.js | 81 +++++++++++++++++-------- glue/crumble/draw/state_snapshot.js | 6 +- glue/crumble/draw/timeline_viewer.js | 2 +- glue/crumble/editor/editor_state.js | 72 +++++++++++++++++++--- glue/crumble/main.js | 90 +++++++++++++++++++++++++++- 8 files changed, 240 insertions(+), 41 deletions(-) diff --git a/glue/crumble/README.md b/glue/crumble/README.md index 1b402a6f8..2189760f0 100644 --- a/glue/crumble/README.md +++ b/glue/crumble/README.md @@ -11,11 +11,13 @@ Crumble is not polished.** ## Index +- [Crumble](#crumble) + - [Index](#index) - [Accessing Crumble](#accessing-crumble) - [Using Crumble](#using-crumble) - - [Loading and Saving Circuits](#loading-saving) - - [Keyboard Controls](#keyboard-commands) - - [Mouse Controls](#mouse-commands) + - [Loading and Saving Circuits](#loading-and-saving-circuits) + - [Keyboard Controls](#keyboard-controls) + - [Mouse Controls](#mouse-controls) - [Building Crumble](#building-crumble) - [Testing Crumble](#testing-crumble) @@ -222,6 +224,13 @@ of the **two qubit variant** (c) of the **square root** (s) of the **Y gate** (y) (i.e. the gate `SQRT_YY_DAG 1 2`). +**Interaction** + +- `Arrow Keys (Up/Down/Left/Right)`: Pan the Planar Layout view. +- `ctrl+0`: Reset View (reset both the planar view and the timeline scroll) +- `ctrl+-`: Zoom out +- `ctrl++` or `ctrl+=`: Zoom in + ### Mouse Controls @@ -245,6 +254,12 @@ box selection action. The specific parity being used depends on context. For example, when selecting a column of qubits, the row parity is used. When selecting a 2d region, the subgrid parity is used. +- `shift+MMB` (Middle Mouse Button): + - Drag on the left (planar layout) to pan the planar layout view + - Drag on the right to scroll vertically through the wires +- `ctrl+MMB`: + - Drag vertically on the left (planar layout) to zoom in/out + # Building Crumble diff --git a/glue/crumble/crumble.html b/glue/crumble/crumble.html index 4dff02ecc..0192b72f4 100644 --- a/glue/crumble/crumble.html +++ b/glue/crumble/crumble.html @@ -227,6 +227,11 @@ +
+
+ +
+