react-zoom-pan-pinch 3.6.1 → 4.0.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.cjs.js +770 -277
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +116 -22
- package/dist/index.esm.js +766 -269
- package/dist/index.esm.js.map +1 -1
- package/package.json +73 -60
- package/src/components/index.ts +5 -0
- package/src/components/keep-scale/keep-scale.tsx +28 -0
- package/src/components/mini-map/mini-map.tsx +292 -0
- package/src/components/mini-map/use-resize.hook.ts +74 -0
- package/src/components/transform-component/transform-component.module.css +43 -0
- package/src/components/transform-component/transform-component.tsx +96 -0
- package/src/components/transform-wrapper/transform-wrapper.tsx +39 -0
- package/src/components/virtualize/virtualize.tsx +133 -0
- package/src/components/virtualize/virtualize.utils.ts +104 -0
- package/src/constants/state.constants.ts +99 -0
- package/src/core/animations/animations.constants.ts +78 -0
- package/src/core/animations/animations.utils.ts +115 -0
- package/src/core/bounds/bounds.types.ts +8 -0
- package/src/core/bounds/bounds.utils.ts +226 -0
- package/src/core/double-click/double-click.logic.ts +127 -0
- package/src/core/handlers/handlers.logic.ts +122 -0
- package/src/core/handlers/handlers.utils.ts +243 -0
- package/src/core/instance.core.ts +704 -0
- package/src/core/pan/panning.logic.ts +122 -0
- package/src/core/pan/panning.utils.ts +216 -0
- package/src/core/pan/velocity.logic.ts +187 -0
- package/src/core/pan/velocity.utils.ts +83 -0
- package/src/core/pinch/pinch.logic.ts +139 -0
- package/src/core/pinch/pinch.utils.ts +95 -0
- package/src/core/wheel/wheel.logic.ts +161 -0
- package/src/core/wheel/wheel.utils.ts +157 -0
- package/src/core/zoom/zoom.logic.ts +71 -0
- package/src/core/zoom/zoom.utils.ts +62 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-controls.tsx +9 -0
- package/src/hooks/use-transform-component.tsx +30 -0
- package/src/hooks/use-transform-context.tsx +13 -0
- package/src/hooks/use-transform-effect.tsx +22 -0
- package/src/hooks/use-transform-init.tsx +28 -0
- package/src/hooks/use-zoom-pan-pinch.tsx +48 -0
- package/src/index.ts +6 -0
- package/src/models/calculations.model.ts +34 -0
- package/src/models/context.model.ts +218 -0
- package/src/models/helpers.model.ts +15 -0
- package/src/models/index.ts +3 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/stories/assets/big-image.jpeg +0 -0
- package/src/stories/assets/map.jpg +0 -0
- package/src/stories/assets/medium-image.jpg +0 -0
- package/src/stories/assets/pin.svg +1 -0
- package/src/stories/assets/small-image.jpg +0 -0
- package/src/stories/assets/svg-example.svg +14 -0
- package/src/stories/docs/DocTable.tsx +59 -0
- package/src/stories/docs/HandlerCards.tsx +102 -0
- package/src/stories/docs/Introduction.stories.mdx +135 -0
- package/src/stories/docs/PropTable.tsx +116 -0
- package/src/stories/docs/docs.module.css +370 -0
- package/src/stories/docs/handlers.stories.mdx +7 -0
- package/src/stories/docs/handlers.tsx +111 -0
- package/src/stories/docs/props.stories.mdx +11 -0
- package/src/stories/docs/props.tsx +571 -0
- package/src/stories/examples/axis-lock/axis-lock.stories.mdx +35 -0
- package/src/stories/examples/axis-lock/example.tsx +114 -0
- package/src/stories/examples/bounds/bounds.data.tsx +191 -0
- package/src/stories/examples/bounds/bounds.stories.mdx +99 -0
- package/src/stories/examples/center-zoomed-out/center-zoomed-out.stories.mdx +206 -0
- package/src/stories/examples/cinema/cinema-data.tsx +578 -0
- package/src/stories/examples/cinema/cinema.stories.mdx +30 -0
- package/src/stories/examples/cinema/example.tsx +378 -0
- package/src/stories/examples/cinema/image.png +0 -0
- package/src/stories/examples/content/content.stories.mdx +172 -0
- package/src/stories/examples/content/mixed-content.data.tsx +624 -0
- package/src/stories/examples/content-rerendering/content-updating.stories.mdx +34 -0
- package/src/stories/examples/content-rerendering/example.tsx +631 -0
- package/src/stories/examples/controls/controls.stories.mdx +120 -0
- package/src/stories/examples/image/example.tsx +149 -0
- package/src/stories/examples/image/image.stories.mdx +46 -0
- package/src/stories/examples/image-annotations/example.tsx +1442 -0
- package/src/stories/examples/image-annotations/image-annotations.stories.mdx +39 -0
- package/src/stories/examples/image-responsive/example.tsx +152 -0
- package/src/stories/examples/image-responsive/image-responsive.stories.mdx +51 -0
- package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +107 -0
- package/src/stories/examples/initial-transform/example.tsx +233 -0
- package/src/stories/examples/initial-transform/initial-transform.stories.mdx +37 -0
- package/src/stories/examples/keep-scale/example.tsx +882 -0
- package/src/stories/examples/keep-scale/keep-scale.stories.mdx +30 -0
- package/src/stories/examples/keep-scale/map.stories.mdx +28 -0
- package/src/stories/examples/medical-viewer/chest-xray.tsx +246 -0
- package/src/stories/examples/medical-viewer/example.tsx +690 -0
- package/src/stories/examples/medical-viewer/medical-viewer.stories.mdx +49 -0
- package/src/stories/examples/mini-map/example.tsx +122 -0
- package/src/stories/examples/mini-map/mini-map.stories.mdx +26 -0
- package/src/stories/examples/miro/example.tsx +1573 -0
- package/src/stories/examples/miro/miro.stories.mdx +31 -0
- package/src/stories/examples/padding/example.tsx +147 -0
- package/src/stories/examples/padding/padding.stories.mdx +35 -0
- package/src/stories/examples/product-card/example.tsx +594 -0
- package/src/stories/examples/product-card/product-card.stories.mdx +29 -0
- package/src/stories/examples/stadium/example.tsx +1040 -0
- package/src/stories/examples/stadium/stadium-data.ts +224 -0
- package/src/stories/examples/stadium/stadium.stories.mdx +32 -0
- package/src/stories/examples/stress/example.tsx +59 -0
- package/src/stories/examples/stress/stress-test.stories.mdx +28 -0
- package/src/stories/examples/svg-zoom-to-element/creativity.svg +143 -0
- package/src/stories/examples/svg-zoom-to-element/example.tsx +95 -0
- package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +28 -0
- package/src/stories/examples/text-selection/example.tsx +221 -0
- package/src/stories/examples/text-selection/text-selection.stories.mdx +31 -0
- package/src/stories/examples/velocity/example.tsx +908 -0
- package/src/stories/examples/velocity/velocity.stories.mdx +35 -0
- package/src/stories/examples/virtualize/example.tsx +239 -0
- package/src/stories/examples/virtualize/virtualize.stories.mdx +84 -0
- package/src/stories/examples/zoom-to-element/example.tsx +219 -0
- package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +31 -0
- package/src/stories/hooks/use-controls.stories.mdx +86 -0
- package/src/stories/hooks/use-transform-component.stories.mdx +108 -0
- package/src/stories/hooks/use-transform-context.stories.mdx +92 -0
- package/src/stories/hooks/use-transform-effect.stories.mdx +114 -0
- package/src/stories/hooks/use-transform-init.stories.mdx +105 -0
- package/src/stories/types/args.types.ts +192 -0
- package/src/stories/utils/args.utils.ts +35 -0
- package/src/stories/utils/bounds-overlay.tsx +168 -0
- package/src/stories/utils/code.utils.tsx +22 -0
- package/src/stories/utils/controls.utils.tsx +347 -0
- package/src/stories/utils/index.ts +5 -0
- package/src/stories/utils/styles.module.css +223 -0
- package/src/stories/utils/viewer.styles.ts +34 -0
- package/src/styles.css +8 -0
- package/src/typings.d.ts +21 -0
- package/src/utils/calculations.utils.ts +16 -0
- package/src/utils/callback.utils.ts +11 -0
- package/src/utils/context.utils.ts +49 -0
- package/src/utils/event.utils.ts +38 -0
- package/src/utils/helpers.utils.ts +22 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/ref.utils.ts +32 -0
- package/src/utils/state.utils.ts +77 -0
- package/src/utils/styles.utils.ts +49 -0
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare const zoomOut: (contextInstance: ReactZoomPanPinchContext) => (step?: nu
|
|
|
28
28
|
declare const setTransform: (contextInstance: ReactZoomPanPinchContext) => (newPositionX: number, newPositionY: number, newScale: number, animationTime?: number, animationType?: keyof typeof animations) => void;
|
|
29
29
|
declare const resetTransform: (contextInstance: ReactZoomPanPinchContext) => (animationTime?: number, animationType?: keyof typeof animations) => void;
|
|
30
30
|
declare const centerView: (contextInstance: ReactZoomPanPinchContext) => (scale?: number, animationTime?: number, animationType?: keyof typeof animations) => void;
|
|
31
|
-
declare const zoomToElement: (contextInstance: ReactZoomPanPinchContext) => (node: HTMLElement | string, scale?: number, animationTime?: number, animationType?: keyof typeof animations) => void;
|
|
31
|
+
declare const zoomToElement: (contextInstance: ReactZoomPanPinchContext) => (node: HTMLElement | string, scale?: number, animationTime?: number, animationType?: keyof typeof animations, offsetX?: number, offsetY?: number) => void;
|
|
32
32
|
|
|
33
33
|
type StartCoordsType = {
|
|
34
34
|
x: number;
|
|
@@ -37,13 +37,18 @@ type StartCoordsType = {
|
|
|
37
37
|
declare class ZoomPanPinch {
|
|
38
38
|
props: ReactZoomPanPinchProps;
|
|
39
39
|
mounted: boolean;
|
|
40
|
-
|
|
41
|
-
pinchLastCenterY: number | null;
|
|
42
|
-
transformState: ReactZoomPanPinchState;
|
|
40
|
+
state: ReactZoomPanPinchState;
|
|
43
41
|
setup: LibrarySetup;
|
|
44
42
|
observer?: ResizeObserver;
|
|
45
43
|
onChangeCallbacks: Set<(ctx: ReactZoomPanPinchRef) => void>;
|
|
46
44
|
onInitCallbacks: Set<(ctx: ReactZoomPanPinchRef) => void>;
|
|
45
|
+
onTransformCallbacks: Set<(data: {
|
|
46
|
+
scale: number;
|
|
47
|
+
positionX: number;
|
|
48
|
+
positionY: number;
|
|
49
|
+
previousScale: number;
|
|
50
|
+
ref: ReactZoomPanPinchRef;
|
|
51
|
+
}) => void>;
|
|
47
52
|
wrapperComponent: HTMLDivElement | null;
|
|
48
53
|
contentComponent: HTMLDivElement | null;
|
|
49
54
|
isInitialized: boolean;
|
|
@@ -54,19 +59,24 @@ declare class ZoomPanPinch {
|
|
|
54
59
|
isPanning: boolean;
|
|
55
60
|
isWheelPanning: boolean;
|
|
56
61
|
startCoords: StartCoordsType;
|
|
62
|
+
panStartPosition: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
} | null;
|
|
57
66
|
lastTouch: number | null;
|
|
67
|
+
isPinching: boolean;
|
|
58
68
|
distance: null | number;
|
|
59
69
|
lastDistance: null | number;
|
|
60
70
|
pinchStartDistance: null | number;
|
|
61
71
|
pinchStartScale: null | number;
|
|
62
72
|
pinchMidpoint: null | PositionType;
|
|
73
|
+
pinchPreviousCenter: null | PositionType;
|
|
63
74
|
doubleClickStopEventTimer: ReturnType<typeof setTimeout> | null;
|
|
64
75
|
velocity: VelocityType | null;
|
|
65
76
|
velocityTime: number | null;
|
|
66
77
|
lastMousePosition: PositionType | null;
|
|
67
|
-
|
|
78
|
+
isAnimating: boolean;
|
|
68
79
|
animation: AnimationType | null;
|
|
69
|
-
maxBounds: BoundsType | null;
|
|
70
80
|
pressedKeys: {
|
|
71
81
|
[key: string]: boolean;
|
|
72
82
|
};
|
|
@@ -91,17 +101,26 @@ declare class ZoomPanPinch {
|
|
|
91
101
|
onTouchPanningStop: (event: TouchEvent) => void;
|
|
92
102
|
onDoubleClick: (event: MouseEvent | TouchEvent) => void;
|
|
93
103
|
clearPanning: (event: MouseEvent) => void;
|
|
104
|
+
handleWindowBlur: () => void;
|
|
105
|
+
syncModifierKeys: (event: MouseEvent | WheelEvent | TouchEvent) => void;
|
|
94
106
|
setKeyPressed: (e: KeyboardEvent) => void;
|
|
95
107
|
setKeyUnPressed: (e: KeyboardEvent) => void;
|
|
96
|
-
isPressingKeys: (keys: string[]) => boolean;
|
|
97
|
-
setTransformState: (scale: number, positionX: number, positionY: number) => void;
|
|
108
|
+
isPressingKeys: (keys: string[] | ((keys: string[]) => boolean)) => boolean;
|
|
98
109
|
setCenter: () => void;
|
|
99
110
|
handleTransformStyles: (x: number, y: number, scale: number) => string;
|
|
100
|
-
applyTransformation: () => void;
|
|
101
111
|
getContext: () => ReactZoomPanPinchRef;
|
|
112
|
+
applyTransformation: () => void;
|
|
113
|
+
setState: (scale: number, positionX: number, positionY: number) => void;
|
|
102
114
|
/**
|
|
103
115
|
* Hooks
|
|
104
116
|
*/
|
|
117
|
+
onTransform: (callback: (data: {
|
|
118
|
+
scale: number;
|
|
119
|
+
positionX: number;
|
|
120
|
+
positionY: number;
|
|
121
|
+
previousScale: number;
|
|
122
|
+
ref: ReactZoomPanPinchRef;
|
|
123
|
+
}) => void) => () => void;
|
|
105
124
|
onChange: (callback: (ref: ReactZoomPanPinchRef) => void) => () => void;
|
|
106
125
|
onInit: (callback: (ref: ReactZoomPanPinchRef) => void) => () => void;
|
|
107
126
|
/**
|
|
@@ -117,6 +136,7 @@ type ReactZoomPanPinchContextState = {
|
|
|
117
136
|
};
|
|
118
137
|
type ReactZoomPanPinchContentRef = {
|
|
119
138
|
instance: ReactZoomPanPinchContext;
|
|
139
|
+
state: ReactZoomPanPinchState;
|
|
120
140
|
} & ReactZoomPanPinchHandlers;
|
|
121
141
|
type ReactZoomPanPinchRef = ReactZoomPanPinchContextState & ReactZoomPanPinchHandlers;
|
|
122
142
|
type ReactZoomPanPinchState = {
|
|
@@ -139,6 +159,7 @@ type ReactZoomPanPinchRefProps = {
|
|
|
139
159
|
type ReactZoomPanPinchProps = {
|
|
140
160
|
children?: React.ReactNode | ((ref: ReactZoomPanPinchContentRef) => React.ReactNode);
|
|
141
161
|
ref?: React.Ref<ReactZoomPanPinchRef>;
|
|
162
|
+
detached?: boolean;
|
|
142
163
|
initialScale?: number;
|
|
143
164
|
initialPositionX?: number;
|
|
144
165
|
initialPositionY?: number;
|
|
@@ -157,11 +178,10 @@ type ReactZoomPanPinchProps = {
|
|
|
157
178
|
smooth?: boolean;
|
|
158
179
|
wheel?: {
|
|
159
180
|
step?: number;
|
|
160
|
-
smoothStep?: number;
|
|
161
181
|
disabled?: boolean;
|
|
162
182
|
wheelDisabled?: boolean;
|
|
163
183
|
touchPadDisabled?: boolean;
|
|
164
|
-
activationKeys?: string[];
|
|
184
|
+
activationKeys?: string[] | ((keys: string[]) => boolean);
|
|
165
185
|
excluded?: string[];
|
|
166
186
|
};
|
|
167
187
|
panning?: {
|
|
@@ -172,13 +192,21 @@ type ReactZoomPanPinchProps = {
|
|
|
172
192
|
allowLeftClickPan?: boolean;
|
|
173
193
|
allowMiddleClickPan?: boolean;
|
|
174
194
|
allowRightClickPan?: boolean;
|
|
175
|
-
activationKeys?: string[];
|
|
195
|
+
activationKeys?: string[] | ((keys: string[]) => boolean);
|
|
176
196
|
excluded?: string[];
|
|
177
|
-
wheelPanning?: boolean;
|
|
178
197
|
};
|
|
179
198
|
pinch?: {
|
|
180
199
|
step?: number;
|
|
181
200
|
disabled?: boolean;
|
|
201
|
+
allowPanning?: boolean;
|
|
202
|
+
excluded?: string[];
|
|
203
|
+
};
|
|
204
|
+
trackPadPanning?: {
|
|
205
|
+
disabled?: boolean;
|
|
206
|
+
velocityDisabled?: boolean;
|
|
207
|
+
lockAxisX?: boolean;
|
|
208
|
+
lockAxisY?: boolean;
|
|
209
|
+
activationKeys?: string[] | ((keys: string[]) => boolean);
|
|
182
210
|
excluded?: string[];
|
|
183
211
|
};
|
|
184
212
|
doubleClick?: {
|
|
@@ -195,7 +223,7 @@ type ReactZoomPanPinchProps = {
|
|
|
195
223
|
animationTime?: number;
|
|
196
224
|
animationType?: keyof typeof animations;
|
|
197
225
|
};
|
|
198
|
-
|
|
226
|
+
autoAlignment?: {
|
|
199
227
|
disabled?: boolean;
|
|
200
228
|
sizeX?: number;
|
|
201
229
|
sizeY?: number;
|
|
@@ -205,10 +233,14 @@ type ReactZoomPanPinchProps = {
|
|
|
205
233
|
};
|
|
206
234
|
velocityAnimation?: {
|
|
207
235
|
disabled?: boolean;
|
|
208
|
-
|
|
236
|
+
sensitivityTouch?: number;
|
|
237
|
+
sensitivityMouse?: number;
|
|
238
|
+
maxStrengthMouse?: number;
|
|
239
|
+
maxStrengthTouch?: number;
|
|
240
|
+
inertia?: number;
|
|
209
241
|
animationTime?: number;
|
|
242
|
+
maxAnimationTime?: number;
|
|
210
243
|
animationType?: keyof typeof animations;
|
|
211
|
-
equalToMove?: boolean;
|
|
212
244
|
};
|
|
213
245
|
onWheelStart?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void;
|
|
214
246
|
onWheel?: (ref: ReactZoomPanPinchRef, event: WheelEvent) => void;
|
|
@@ -216,13 +248,13 @@ type ReactZoomPanPinchProps = {
|
|
|
216
248
|
onPanningStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
|
|
217
249
|
onPanning?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
|
|
218
250
|
onPanningStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
251
|
+
onPinchStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void;
|
|
252
|
+
onPinch?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void;
|
|
253
|
+
onPinchStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent) => void;
|
|
222
254
|
onZoomStart?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
|
|
223
255
|
onZoom?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
|
|
224
256
|
onZoomStop?: (ref: ReactZoomPanPinchRef, event: TouchEvent | MouseEvent) => void;
|
|
225
|
-
|
|
257
|
+
onTransform?: (ref: ReactZoomPanPinchRef, state: {
|
|
226
258
|
scale: number;
|
|
227
259
|
positionX: number;
|
|
228
260
|
positionY: number;
|
|
@@ -232,7 +264,7 @@ type ReactZoomPanPinchProps = {
|
|
|
232
264
|
type ReactZoomPanPinchComponentHelpers = {
|
|
233
265
|
setComponents: (wrapper: HTMLDivElement, content: HTMLDivElement) => void;
|
|
234
266
|
};
|
|
235
|
-
type LibrarySetup = Pick<ReactZoomPanPinchProps, "minPositionX" | "maxPositionX" | "minPositionY" | "maxPositionY"> & DeepNonNullable<Omit<ReactZoomPanPinchProps, "ref" | "initialScale" | "initialPositionX" | "initialPositionY" | "minPositionX" | "maxPositionX" | "minPositionY" | "maxPositionY" | "children" | "defaultPositionX" | "defaultPositionY" | "defaultScale" | "wrapperClass" | "contentClass" | "onWheelStart" | "onWheel" | "onWheelStop" | "onPanningStart" | "onPanning" | "onPanningStop" | "
|
|
267
|
+
type LibrarySetup = Pick<ReactZoomPanPinchProps, "minPositionX" | "maxPositionX" | "minPositionY" | "maxPositionY"> & DeepNonNullable<Omit<ReactZoomPanPinchProps, "ref" | "initialScale" | "initialPositionX" | "initialPositionY" | "minPositionX" | "maxPositionX" | "minPositionY" | "maxPositionY" | "children" | "defaultPositionX" | "defaultPositionY" | "defaultScale" | "wrapperClass" | "contentClass" | "onWheelStart" | "onWheel" | "onWheelStop" | "onPanningStart" | "onPanning" | "onPanningStop" | "onPinchStart" | "onPinch" | "onPinchStop" | "onZoomStart" | "onZoom" | "onZoomStop" | "onTransform" | "onInit" | "customTransform">>;
|
|
236
268
|
type ReactZoomPanPinchBaseClasses = {
|
|
237
269
|
wrapperClass: string;
|
|
238
270
|
contentClass: string;
|
|
@@ -261,8 +293,15 @@ type BoundsType = {
|
|
|
261
293
|
maxPositionX: number;
|
|
262
294
|
minPositionY: number;
|
|
263
295
|
maxPositionY: number;
|
|
296
|
+
scaleWidthFactor: number;
|
|
297
|
+
scaleHeightFactor: number;
|
|
264
298
|
};
|
|
265
299
|
type AnimationType = () => void | number;
|
|
300
|
+
declare enum DeviceType {
|
|
301
|
+
TRACK_PAD = "track_pad",
|
|
302
|
+
MOUSE = "mouse",
|
|
303
|
+
TOUCH = "touch"
|
|
304
|
+
}
|
|
266
305
|
|
|
267
306
|
declare const useControls: () => ReactZoomPanPinchContentRef;
|
|
268
307
|
|
|
@@ -281,6 +320,13 @@ type MiniMapProps = {
|
|
|
281
320
|
width?: number;
|
|
282
321
|
height?: number;
|
|
283
322
|
borderColor?: string;
|
|
323
|
+
/** Merged onto the viewport indicator (`.rzpp-minimap-preview`). */
|
|
324
|
+
previewStyle?: React.CSSProperties;
|
|
325
|
+
/** Extra class name(s) appended to `.rzpp-minimap-wrapper`. */
|
|
326
|
+
wrapperClassName?: string;
|
|
327
|
+
/** Extra class name(s) appended to `.rzpp-minimap-preview`. */
|
|
328
|
+
previewClassName?: string;
|
|
329
|
+
panning?: boolean;
|
|
284
330
|
} & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
285
331
|
declare const MiniMap: React.FC<MiniMapProps>;
|
|
286
332
|
|
|
@@ -292,14 +338,62 @@ type Props = {
|
|
|
292
338
|
contentStyle?: React.CSSProperties;
|
|
293
339
|
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
294
340
|
contentProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
341
|
+
/**
|
|
342
|
+
* When true, renders an infinite dot-grid background behind the content
|
|
343
|
+
* that scales and pans in sync with the transform. Pair with
|
|
344
|
+
* `limitToBounds={false}` on TransformWrapper for full effect.
|
|
345
|
+
*/
|
|
346
|
+
infinite?: boolean;
|
|
295
347
|
};
|
|
296
348
|
declare const TransformComponent: React.FC<Props>;
|
|
297
349
|
|
|
298
350
|
declare const Context: React.Context<ZoomPanPinch>;
|
|
299
351
|
declare const TransformWrapper: React.ForwardRefExoticComponent<Omit<ReactZoomPanPinchProps, "ref"> & React.RefAttributes<ReactZoomPanPinchContentRef>>;
|
|
300
352
|
|
|
353
|
+
type VirtualizeProps = {
|
|
354
|
+
/** Horizontal position of the element in content (unscaled) space. */
|
|
355
|
+
x: number;
|
|
356
|
+
/** Vertical position of the element in content (unscaled) space. */
|
|
357
|
+
y: number;
|
|
358
|
+
/** Width of the element in content (unscaled) space. */
|
|
359
|
+
width: number;
|
|
360
|
+
/** Height of the element in content (unscaled) space. */
|
|
361
|
+
height: number;
|
|
362
|
+
/**
|
|
363
|
+
* Extra pixels around the viewport that still count as "visible".
|
|
364
|
+
* Positive values mount children before they scroll into view,
|
|
365
|
+
* acting like `IntersectionObserver`'s `rootMargin`.
|
|
366
|
+
* @default 0
|
|
367
|
+
*/
|
|
368
|
+
margin?: number;
|
|
369
|
+
/**
|
|
370
|
+
* Fraction of the element area (0-1) that must overlap the (expanded)
|
|
371
|
+
* viewport for the children to be mounted.
|
|
372
|
+
*
|
|
373
|
+
* - `0` — any overlap is enough (default).
|
|
374
|
+
* - `1` — the element must be fully inside the viewport.
|
|
375
|
+
* @default 0
|
|
376
|
+
*/
|
|
377
|
+
threshold?: number;
|
|
378
|
+
/**
|
|
379
|
+
* Content rendered in place of children when the element is outside
|
|
380
|
+
* the viewport. Defaults to `null` (nothing rendered).
|
|
381
|
+
*/
|
|
382
|
+
placeholder?: React.ReactNode;
|
|
383
|
+
/** Fires when the element enters the viewport and children are mounted. */
|
|
384
|
+
onShow?: () => void;
|
|
385
|
+
/** Fires when the element leaves the viewport and children are unmounted. */
|
|
386
|
+
onHide?: () => void;
|
|
387
|
+
children: React.ReactNode;
|
|
388
|
+
className?: string;
|
|
389
|
+
style?: React.CSSProperties;
|
|
390
|
+
};
|
|
391
|
+
declare const Virtualize: React.ForwardRefExoticComponent<VirtualizeProps & React.RefAttributes<HTMLDivElement>>;
|
|
392
|
+
|
|
393
|
+
/** Drop binary float noise on scale (e.g. 1.5000000000000002) without clipping real zoom values. */
|
|
394
|
+
declare const roundScaleForTransform: (scale: number) => number;
|
|
301
395
|
declare const getTransformStyles: (x: number, y: number, scale: number) => string;
|
|
302
396
|
declare const getMatrixTransformStyles: (x: number, y: number, scale: number) => string;
|
|
303
397
|
declare const getCenterPosition: (scale: number, wrapperComponent: HTMLDivElement, contentComponent: HTMLDivElement) => StateType;
|
|
304
398
|
|
|
305
|
-
export { AnimationType, BoundsType, Context, KeepScale, LibrarySetup, MiniMap, MiniMapProps, PositionType, ReactZoomPanPinchBaseClasses, ReactZoomPanPinchComponentHelpers, ReactZoomPanPinchContentRef, ReactZoomPanPinchContext, ReactZoomPanPinchContextState, ReactZoomPanPinchHandlers, ReactZoomPanPinchProps, ReactZoomPanPinchRef, ReactZoomPanPinchRefProps, ReactZoomPanPinchState, SizeType, StateType, TransformComponent, TransformWrapper, VelocityType, getCenterPosition, getMatrixTransformStyles, getTransformStyles, useControls, useTransformComponent, useTransformContext, useTransformEffect, useTransformInit };
|
|
399
|
+
export { type AnimationType, type BoundsType, Context, DeviceType, KeepScale, type LibrarySetup, MiniMap, type MiniMapProps, type PositionType, type ReactZoomPanPinchBaseClasses, type ReactZoomPanPinchComponentHelpers, type ReactZoomPanPinchContentRef, type ReactZoomPanPinchContext, type ReactZoomPanPinchContextState, type ReactZoomPanPinchHandlers, type ReactZoomPanPinchProps, type ReactZoomPanPinchRef, type ReactZoomPanPinchRefProps, type ReactZoomPanPinchState, type SizeType, type StateType, TransformComponent, TransformWrapper, type VelocityType, Virtualize, type VirtualizeProps, getCenterPosition, getMatrixTransformStyles, getTransformStyles, roundScaleForTransform, useControls, useTransformComponent, useTransformContext, useTransformEffect, useTransformInit };
|