copper3d 3.11.3 → 3.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -606,9 +606,13 @@ window.addEventListener('keydown', (e) => {
606
606
  | Redo | `y` |
607
607
  | Contrast adjust | `Ctrl` / `Meta` (hold) |
608
608
  | Crosshair | `s` |
609
- | Sphere mode | `q` |
610
609
  | Mouse wheel | Zoom |
611
610
 
611
+ > **Breaking:** sphere mode no longer has a shortcut. `sphere: "q"` is gone and `sphere` has
612
+ > been removed from `IKeyBoardSettings` — it toggled the mode behind the host's back, clearing
613
+ > the masks from the view while the host's UI still showed its own tool as selected. Enter it
614
+ > with `setMode('sphere')` and bind your own key if you want one.
615
+
612
616
  ```typescript
613
617
  nrrdTools.setKeyboardSettings({ undo: 'u', mouseWheel: 'Scroll:Slice' });
614
618
  const settings = nrrdTools.getKeyboardSettings();
@@ -769,7 +773,6 @@ interface IKeyBoardSettings {
769
773
  redo: string;
770
774
  contrast: string[];
771
775
  crosshair: string;
772
- sphere: string;
773
776
  mouseWheel: 'Scroll:Zoom' | 'Scroll:Slice';
774
777
  }
775
778
 
@@ -522,7 +522,7 @@ const type = nrrdTools.getActiveSphereType();
522
522
  ##### Interaction Flow
523
523
 
524
524
  ```
525
- Sphere mode activated (gui_states.mode.sphere = true, keyboard shortcut: 'q'):
525
+ Sphere mode activated (gui_states.mode.sphere = true, via setMode("sphere")):
526
526
  ├─ Shift key DISABLED (no draw mode)
527
527
  ├─ Crosshair toggle allowed (S key)
528
528
  │
@@ -1181,11 +1181,29 @@ window.addEventListener('keydown', (e) => {
1181
1181
  | Redo | `y` |
1182
1182
  | Contrast adjust | `Ctrl` / `Meta` (hold) |
1183
1183
  | Crosshair | `s` |
1184
- | Sphere mode | `q` |
1185
1184
  | Mouse wheel | Zoom |
1186
1185
  | Scroll:Zoom shortcut | `Ctrl+1` |
1187
1186
  | Scroll:Slice shortcut | `Ctrl+2` |
1188
1187
 
1188
+ ::: warning Sphere mode no longer has a shortcut <Badge type="warning" text="breaking in 3.11.5" />
1189
+ The `sphere: "q"` binding is **gone**, and `sphere` has been removed from
1190
+ `IKeyBoardSettings`. Sphere mode is now entered only through `setMode("sphere")` — which is
1191
+ also how the calculator reaches it — so the host always knows which tool is active.
1192
+
1193
+ The shortcut toggled the mode behind the host's back: pressing `q` cleared the masks from the
1194
+ view while the host's own UI still showed whatever tool it thought was selected.
1195
+
1196
+ If you passed `sphere` to `setKeyboardSettings`, drop it — it is no longer part of the type:
1197
+
1198
+ ```typescript
1199
+ // before
1200
+ nrrdTools.setKeyboardSettings({ sphere: 'e', crosshair: 'x' });
1201
+ // after
1202
+ nrrdTools.setKeyboardSettings({ crosshair: 'x' });
1203
+ nrrdTools.setMode('sphere'); // bind your own key to this if you want one
1204
+ ```
1205
+ :::
1206
+
1189
1207
  #### Reading current settings
1190
1208
 
1191
1209
  ```typescript
@@ -1308,6 +1326,13 @@ Everything that moves the zoom respects it: `setMainAreaSize`, wheel zoom, and
1308
1326
  `NrrdState.setZoomFactor`. The `"mainAreaSize"` GUI slider's `min` is updated too, so a
1309
1327
  connected dat.GUI / lil-gui panel can reach the new range.
1310
1328
 
1329
+ ::: tip Wheel zoom follows scroll distance <Badge type="tip" text="3.11.4" />
1330
+ One notch (100px of scroll) zooms by 10%, and a single event is capped at 2×. Because the
1331
+ ratio comes from the distance scrolled rather than from the number of events, a trackpad's
1332
+ small deltas zoom smoothly, and a busy page — where the browser coalesces wheel events and
1333
+ sums their deltas — zooms at the same rate as an idle one. Nothing to configure.
1334
+ :::
1335
+
1311
1336
  If the current factor is **below** the new minimum it is raised to it and the view repaints
1312
1337
  immediately, so you can lower and raise the floor freely without leaving the view in an
1313
1338
  invalid state.
@@ -1758,7 +1783,6 @@ interface IKeyBoardSettings {
1758
1783
  redo: string;
1759
1784
  contrast: string[]; // always an array, e.g. ["Control", "Meta"]
1760
1785
  crosshair: string;
1761
- sphere: string;
1762
1786
  mouseWheel: 'Scroll:Zoom' | 'Scroll:Slice';
1763
1787
  }
1764
1788
 
@@ -1284,6 +1284,30 @@ EventRouter permanently binds all pointer/keyboard/wheel events to the drawingCa
1284
1284
  | `'sphereBrush'` | Set by sphereBrush/sphereEraser mouseDown | `handleSphereBrushWheel` (adjusts `sphereBrushRadius`) |
1285
1285
  | `'none'` | Set by mouseDown in draw mode | No-op (wheel suppressed) |
1286
1286
 
1287
+ #### Wheel zoom ratio <Badge type="tip" text="3.11.4" />
1288
+
1289
+ `ZoomTool`'s `wheelZoomRatio(e)` derives the zoom ratio for one wheel event from **how far it
1290
+ scrolled**, not from the fact that it happened. It replaces a flat `±10%` per event.
1291
+
1292
+ ```
1293
+ 100px scrolled = one notch = ×1.1 (LOG_STEP_PER_PIXEL = ln(1.1) / 100)
1294
+ deltaMode 1 × 33px (lines, Firefox)
1295
+ deltaMode 2 × 800px (pages)
1296
+ no deltaY → one notch, direction from `detail` / `wheelDelta` (legacy events)
1297
+ ```
1298
+
1299
+ Positive `deltaY` (scrolling down) zooms out. The ratio is computed in log space and clamped
1300
+ to `MAX_RATIO_PER_EVENT = 2`, so a single runaway delta cannot jump the view.
1301
+
1302
+ **Why distance rather than event count.** A busy page makes the browser coalesce wheel events
1303
+ and sum their deltas. Counting events therefore zoomed a heavy view *slower* than a light one —
1304
+ the same physical scroll produced less zoom exactly when the app was under load. Following the
1305
+ distance zooms both alike, and it is what lets a trackpad's many small deltas zoom smoothly
1306
+ instead of in 10% jumps.
1307
+
1308
+ The result still passes through the `[minSizeFactor, 8]` clamp and the same
1309
+ `requestAnimationFrame` coalescing as before; only the per-event ratio changed.
1310
+
1287
1311
  ### 8.4 Default Keyboard Settings
1288
1312
 
1289
1313
  ```ts
@@ -1293,7 +1317,6 @@ IKeyBoardSettings = {
1293
1317
  redo: "y",
1294
1318
  contrast: ["Control", "Meta"],
1295
1319
  crosshair: "s",
1296
- sphere: "q",
1297
1320
  mouseWheel: "Scroll:Zoom", // or "Scroll:Slice"
1298
1321
  }
1299
1322
 
@@ -1302,6 +1325,20 @@ IKeyBoardSettings = {
1302
1325
  // Ctrl+2 → switch to Scroll:Slice
1303
1326
  ```
1304
1327
 
1328
+ ::: warning No `sphere` key <Badge type="warning" text="breaking in 3.11.5" />
1329
+ `sphere: "q"` has been removed from `IKeyBoardSettings`, from `EventRouter`'s
1330
+ `DEFAULT_KEYBOARD_SETTINGS`, and the toggle branch is gone from `DrawToolCore`'s keydown
1331
+ handler.
1332
+
1333
+ Sphere mode is entered only through `setMode("sphere")` — the path the calculator already
1334
+ uses — so the active tool is always something the host chose. The shortcut changed
1335
+ `gui_states.mode.sphere` directly, which runs `enterSphereMode()` and clears the masks from
1336
+ the view, while the host's UI still reported its own tool as selected. There was no event to
1337
+ tell it otherwise.
1338
+
1339
+ A host that wants a key for it binds one itself and calls `setMode`.
1340
+ :::
1341
+
1305
1342
  ---
1306
1343
 
1307
1344
  ## 9. Undo/Redo System
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "copper3dVersion": "3.11.3",
4
- "generatedAt": "2026-09-30T00:54:40.159Z",
5
- "symbolCount": 1199,
3
+ "copper3dVersion": "3.11.4",
4
+ "generatedAt": "2026-09-30T02:19:02.822Z",
5
+ "symbolCount": 1198,
6
6
  "guides": [
7
7
  {
8
8
  "id": "4D-MRI-LV-rendering",
@@ -90,7 +90,7 @@
90
90
  "title": "NrrdTools Usage Guide",
91
91
  "summary": "Copper3D `NrrdTools` — Medical Image Segmentation Annotation Engine",
92
92
  "lang": "en",
93
- "bytes": 74550
93
+ "bytes": 75810
94
94
  },
95
95
  {
96
96
  "id": "on-demand-controls",
@@ -122,7 +122,7 @@
122
122
  "title": "Segmentation Module Documentation",
123
123
  "summary": "⚠️ **Note**: All line number references in this document are from historical versions. After multiple rounds of refactoring (State Management Refactor, NrrdTools God Class Split, inheritance → composition refactor), these references are ou…",
124
124
  "lang": "en",
125
- "bytes": 74638
125
+ "bytes": 76560
126
126
  },
127
127
  {
128
128
  "id": "surface-annotation-api",