Skip to content

Commit fcaf99f

Browse files
authored
Fix zoom behavior in circuit diagrams (#2979)
- Expanding/collapsing a box via the UI should *not* change the zoom level. - When a box is expanded/collapsed via the UI, we should disable zoom-to-fit if the window is subsequently resized. - We already disable zoom-to-fit today, when the user sets the zoom level manually throught the control. Keep that behavior. To achieve this, we had to push all the zooming code in `circuit.tsx` one level deeper into `circuit-vis/sqore.ts` so that we can be aware of the expand/collapse interactions. IMO this makes the code more well-encapsulated overall. Tested VS code and widgets. Co-authored-by: Mine Starks <>
1 parent 95af095 commit fcaf99f

17 files changed

Lines changed: 112 additions & 124 deletions

source/npm/qsharp/test/circuits-cases/bell-pair.qs.snapshot.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class="qviz"
1616
width="341"
1717
height="308"
18-
style="max-width: fit-content"
1918
viewBox="0 0 341 308"
2019
>
2120
<g class="qubit-input-states">
@@ -325,7 +324,6 @@
325324
class="qviz"
326325
width="341"
327326
height="344"
328-
style="max-width: fit-content"
329327
viewBox="0 0 341 344"
330328
>
331329
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/conditionals.qsc.snapshot.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ <h2 class="title">Toolbox</h2>
260260
class="qviz"
261261
width="1386"
262262
height="4852"
263-
style="max-width: fit-content"
264263
viewBox="0 0 1386 4852"
265264
>
266265
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/empty.qsc.snapshot.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ <h2 class="title">Toolbox</h2>
260260
class="qviz"
261261
width="92"
262262
height="116"
263-
style="max-width: fit-content"
264263
viewBox="0 0 92 116"
265264
>
266265
<g class="qubit-input-states" />

source/npm/qsharp/test/circuits-cases/functors.qs.snapshot.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class="qviz"
1616
width="320"
1717
height="204"
18-
style="max-width: fit-content"
1918
viewBox="0 0 320 204"
2019
>
2120
<g class="qubit-input-states">
@@ -238,7 +237,6 @@
238237
class="qviz"
239238
width="354"
240239
height="240"
241-
style="max-width: fit-content"
242240
viewBox="0 0 354 240"
243241
>
244242
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/gate-and-measure.qsc.snapshot.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ <h2 class="title">Toolbox</h2>
260260
class="qviz"
261261
width="190"
262262
height="220"
263-
style="max-width: fit-content"
264263
viewBox="0 0 190 220"
265264
>
266265
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/if-else.qsc.snapshot.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ <h2 class="title">Toolbox</h2>
260260
class="qviz"
261261
width="560"
262262
height="396"
263-
style="max-width: fit-content"
264263
viewBox="0 0 560 396"
265264
>
266265
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/intersecting-wires.qs.snapshot.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class="qviz"
1616
width="612"
1717
height="880"
18-
style="max-width: fit-content"
1918
viewBox="0 0 612 880"
2019
>
2120
<g class="qubit-input-states">
@@ -1111,7 +1110,6 @@
11111110
class="qviz"
11121111
width="1128"
11131112
height="1060"
1114-
style="max-width: fit-content"
11151113
viewBox="0 0 1128 1060"
11161114
>
11171115
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/intrinsics.qs.snapshot.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class="qviz"
1616
width="508"
1717
height="204"
18-
style="max-width: fit-content"
1918
viewBox="0 0 508 204"
2019
>
2120
<g class="qubit-input-states">
@@ -233,7 +232,6 @@
233232
class="qviz"
234233
width="508"
235234
height="240"
236-
style="max-width: fit-content"
237235
viewBox="0 0 508 240"
238236
>
239237
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/lambda.qs.snapshot.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class="qviz"
1616
width="350"
1717
height="204"
18-
style="max-width: fit-content"
1918
viewBox="0 0 350 204"
2019
>
2120
<g class="qubit-input-states">
@@ -235,7 +234,6 @@
235234
class="qviz"
236235
width="386"
237236
height="240"
238-
style="max-width: fit-content"
239237
viewBox="0 0 386 240"
240238
>
241239
<g class="qubit-input-states">

source/npm/qsharp/test/circuits-cases/loops.qs.snapshot.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class="qviz"
1616
width="408"
1717
height="1072"
18-
style="max-width: fit-content"
1918
viewBox="0 0 408 1072"
2019
>
2120
<g class="qubit-input-states">
@@ -1151,7 +1150,6 @@
11511150
class="qviz"
11521151
width="1860"
11531152
height="1144"
1154-
style="max-width: fit-content"
11551153
viewBox="0 0 1860 1144"
11561154
>
11571155
<g class="qubit-input-states">

0 commit comments

Comments
 (0)