@idetik/core 0.41.0 → 0.42.0

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/dist/index.d.ts CHANGED
@@ -1302,6 +1302,14 @@ interface CameraControls {
1302
1302
  */
1303
1303
  onEvent(event: EventContext): void;
1304
1304
  }
1305
+ type ScrollZoomMode = "always" | "modifier" | "never";
1306
+ /**
1307
+ * Initialization properties for constructing pan and zoom controls.
1308
+ */
1309
+ type PanZoomControlsProps = {
1310
+ /** When the scroll wheel zooms. Defaults to `"always"`. */
1311
+ scrollZoom?: ScrollZoomMode;
1312
+ };
1305
1313
  /**
1306
1314
  * Camera controls for 2D pan and zoom with an orthographic camera.
1307
1315
  *
@@ -1331,14 +1339,16 @@ interface CameraControls {
1331
1339
  */
1332
1340
  declare class PanZoomControls implements CameraControls {
1333
1341
  private readonly camera_;
1342
+ private readonly scrollZoom_;
1334
1343
  private dragActive_;
1335
1344
  private dragStart_;
1336
1345
  /**
1337
1346
  * Creates pan and zoom controls for the given camera.
1338
1347
  *
1339
1348
  * @param camera - The orthographic camera to control.
1349
+ * @param params - Initialization properties.
1340
1350
  */
1341
- constructor(camera: OrthographicCamera);
1351
+ constructor(camera: OrthographicCamera, params?: PanZoomControlsProps);
1342
1352
  /** Whether a pan drag is in progress. */
1343
1353
  get isMoving(): boolean;
1344
1354
  /**
@@ -3368,6 +3378,8 @@ type OrbitControlsProps = {
3368
3378
  target?: vec3;
3369
3379
  /** Velocity decay rate between `0` and `1`. Defaults to `0.5`. */
3370
3380
  dampingFactor?: number;
3381
+ /** When the scroll wheel zooms. Defaults to `"always"`. */
3382
+ scrollZoom?: ScrollZoomMode;
3371
3383
  };
3372
3384
  /**
3373
3385
  * Camera controls for orbiting a perspective camera around a target.
@@ -3401,6 +3413,7 @@ declare class OrbitControls implements CameraControls {
3401
3413
  private readonly currPos_;
3402
3414
  private readonly currCenter_;
3403
3415
  private readonly dampingFactor_;
3416
+ private readonly scrollZoom_;
3404
3417
  private currMouseButton_;
3405
3418
  /**
3406
3419
  * Creates orbit controls and moves the camera to the initial pose.
@@ -3445,4 +3458,4 @@ declare class OrbitControls implements CameraControls {
3445
3458
  }
3446
3459
 
3447
3460
  export { AxesLayer, Box2, Box3, Camera, Color, Frustum, Idetik, ImageLayer, ImageRenderable, LabelImageRenderable, LabelLayer, Layer, OmeZarrImageSource, OrbitControls, OrthographicCamera, PanZoomControls, PerspectiveCamera, PointsRenderable, ProjectedLineRenderable, RenderableObject, TrsTransform, Viewport, VolumeLayer, VolumeRenderable, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults };
3448
- export type { AxesLayerProps, BlendMode, CameraControls, CameraType, ChannelProps, ColorLike, FileSystemOmeZarrImageSourceProps, HttpOmeZarrImageSourceProps, IdetikProps, ImageLayerProps, ImageRenderableProps, ImageSourcePolicy, ImageSourcePolicyProps, LabelColorMap, LabelColorMapProps, LabelImageRenderableProps, LabelLayerProps, LayerProps, LayerState, MemoryStats, OrbitControlsProps, OrthographicCameraFrame, OrthographicCameraProps, Overlay, PerspectiveCameraProps, PointPickingResult, PointProps, PriorityCategory, ProjectedLineRenderableProps, QueueStats, SliceCoordinates, SliceOrientation, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportProps, VolumeLayerProps, VolumeRenderableProps };
3461
+ export type { AxesLayerProps, BlendMode, CameraControls, CameraType, ChannelProps, ColorLike, FileSystemOmeZarrImageSourceProps, HttpOmeZarrImageSourceProps, IdetikProps, ImageLayerProps, ImageRenderableProps, ImageSourcePolicy, ImageSourcePolicyProps, LabelColorMap, LabelColorMapProps, LabelImageRenderableProps, LabelLayerProps, LayerProps, LayerState, MemoryStats, OrbitControlsProps, OrthographicCameraFrame, OrthographicCameraProps, Overlay, PanZoomControlsProps, PerspectiveCameraProps, PointPickingResult, PointProps, PriorityCategory, ProjectedLineRenderableProps, QueueStats, SliceCoordinates, SliceOrientation, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportProps, VolumeLayerProps, VolumeRenderableProps };
package/dist/index.js CHANGED
@@ -14537,6 +14537,7 @@ class Lo {
14537
14537
  currPos_;
14538
14538
  currCenter_ = d();
14539
14539
  dampingFactor_;
14540
+ scrollZoom_;
14540
14541
  currMouseButton_ = vI;
14541
14542
  /**
14542
14543
  * Creates orbit controls and moves the camera to the initial pose.
@@ -14553,7 +14554,7 @@ class Lo {
14553
14554
  I?.dampingFactor ?? so,
14554
14555
  0,
14555
14556
  1
14556
- ), this.updateCamera();
14557
+ ), this.scrollZoom_ = I?.scrollZoom ?? "always", this.updateCamera();
14557
14558
  }
14558
14559
  /** The current distance from the target in world units. */
14559
14560
  get radius() {
@@ -14624,6 +14625,7 @@ class Lo {
14624
14625
  }
14625
14626
  onWheel(A) {
14626
14627
  const I = A.event;
14628
+ if (this.scrollZoom_ === "never" || this.scrollZoom_ === "modifier" && !(I.ctrlKey || I.metaKey)) return;
14627
14629
  I.preventDefault();
14628
14630
  const B = I.deltaY ?? 0;
14629
14631
  this.zoom(B);
@@ -14771,15 +14773,17 @@ class Jo extends cC {
14771
14773
  const PB = 0;
14772
14774
  class Yo {
14773
14775
  camera_;
14776
+ scrollZoom_;
14774
14777
  dragActive_ = !1;
14775
14778
  dragStart_ = d();
14776
14779
  /**
14777
14780
  * Creates pan and zoom controls for the given camera.
14778
14781
  *
14779
14782
  * @param camera - The orthographic camera to control.
14783
+ * @param params - Initialization properties.
14780
14784
  */
14781
- constructor(A) {
14782
- this.camera_ = A;
14785
+ constructor(A, I) {
14786
+ this.camera_ = A, this.scrollZoom_ = I?.scrollZoom ?? "always";
14783
14787
  }
14784
14788
  /** Whether a pan drag is in progress. */
14785
14789
  get isMoving() {
@@ -14818,6 +14822,7 @@ class Yo {
14818
14822
  onWheel(A) {
14819
14823
  if (!A.worldPos || !A.clipPos) return;
14820
14824
  const I = A.event;
14825
+ if (this.scrollZoom_ === "never" || this.scrollZoom_ === "modifier" && !(I.ctrlKey || I.metaKey)) return;
14821
14826
  I.preventDefault();
14822
14827
  const B = EA(A.worldPos), C = I.deltaY < 0 ? 1.05 : 0.95;
14823
14828
  this.camera_.zoom(C);