react-zoom-pan-pinch 4.2.0 → 4.3.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/README.md +2 -2
- package/dist/index.cjs.js +438 -165
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.esm.js +439 -166
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/mini-map/mini-map.tsx +386 -171
- package/src/core/bounds/bounds.utils.ts +88 -0
- package/src/core/instance.core.ts +12 -9
- package/src/core/pan/panning.logic.ts +7 -1
- package/src/core/pan/panning.utils.ts +76 -24
- package/src/core/pan/velocity.logic.ts +10 -3
- package/src/hooks/initial-layout.utils.ts +21 -0
- package/src/hooks/use-transform-component.tsx +22 -4
- package/src/hooks/use-transform-effect.tsx +20 -1
package/dist/index.d.ts
CHANGED
|
@@ -443,17 +443,48 @@ declare const KeepScale: React.ForwardRefExoticComponent<React.HTMLAttributes<HT
|
|
|
443
443
|
|
|
444
444
|
type MiniMapProps = {
|
|
445
445
|
children: React.ReactNode;
|
|
446
|
+
/** Width of the mini map box in px. */
|
|
446
447
|
width?: number;
|
|
448
|
+
/** Height of the mini map box in px. */
|
|
447
449
|
height?: number;
|
|
450
|
+
/** Border colour of the viewport indicator. */
|
|
448
451
|
borderColor?: string;
|
|
452
|
+
/**
|
|
453
|
+
* Colour of the overlay that dims everything outside the viewport
|
|
454
|
+
* (`.rzpp-minimap-mask`).
|
|
455
|
+
*/
|
|
456
|
+
maskColor?: string;
|
|
449
457
|
/** Merged onto the viewport indicator (`.rzpp-minimap-preview`). */
|
|
450
458
|
previewStyle?: React.CSSProperties;
|
|
451
459
|
/** Extra class name(s) appended to `.rzpp-minimap-wrapper`. */
|
|
452
460
|
wrapperClassName?: string;
|
|
453
461
|
/** Extra class name(s) appended to `.rzpp-minimap-preview`. */
|
|
454
462
|
previewClassName?: string;
|
|
463
|
+
/**
|
|
464
|
+
* Dragging anywhere on the mini map grabs the viewport indicator and moves
|
|
465
|
+
* it with the pointer (mouse and touch).
|
|
466
|
+
*/
|
|
455
467
|
panning?: boolean;
|
|
456
|
-
|
|
468
|
+
/**
|
|
469
|
+
* Flips the drag direction: instead of grabbing the viewport indicator the
|
|
470
|
+
* drag moves the content, like panning the main view.
|
|
471
|
+
*/
|
|
472
|
+
inversePan?: boolean;
|
|
473
|
+
/** Wheel over the mini map zooms the main view around its centre. */
|
|
474
|
+
zoomable?: boolean;
|
|
475
|
+
/** Scale increment applied per wheel notch when `zoomable` is on. */
|
|
476
|
+
zoomStep?: number;
|
|
477
|
+
/**
|
|
478
|
+
* Padding around the mapped area, in mini map px at the current map scale
|
|
479
|
+
* (same meaning as React Flow's `offsetScale`).
|
|
480
|
+
*/
|
|
481
|
+
offsetScale?: number;
|
|
482
|
+
/**
|
|
483
|
+
* Fired for a click (or tap) that did not turn into a drag. `position` is
|
|
484
|
+
* the clicked point in content coordinates, ready for `zoomToPoint`.
|
|
485
|
+
*/
|
|
486
|
+
onClick?: (event: MouseEvent | TouchEvent, position: PositionType) => void;
|
|
487
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onClick">;
|
|
457
488
|
declare const MiniMap: React.FC<MiniMapProps>;
|
|
458
489
|
|
|
459
490
|
type Props = {
|