react-zoom-pan-pinch 4.0.0 → 4.0.1

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.
Files changed (82) hide show
  1. package/package.json +3 -2
  2. package/src/stories/assets/big-image.jpeg +0 -0
  3. package/src/stories/assets/map.jpg +0 -0
  4. package/src/stories/assets/medium-image.jpg +0 -0
  5. package/src/stories/assets/pin.svg +0 -1
  6. package/src/stories/assets/small-image.jpg +0 -0
  7. package/src/stories/assets/svg-example.svg +0 -14
  8. package/src/stories/docs/DocTable.tsx +0 -59
  9. package/src/stories/docs/HandlerCards.tsx +0 -102
  10. package/src/stories/docs/Introduction.stories.mdx +0 -135
  11. package/src/stories/docs/PropTable.tsx +0 -116
  12. package/src/stories/docs/docs.module.css +0 -370
  13. package/src/stories/docs/handlers.stories.mdx +0 -7
  14. package/src/stories/docs/handlers.tsx +0 -111
  15. package/src/stories/docs/props.stories.mdx +0 -11
  16. package/src/stories/docs/props.tsx +0 -571
  17. package/src/stories/examples/axis-lock/axis-lock.stories.mdx +0 -35
  18. package/src/stories/examples/axis-lock/example.tsx +0 -114
  19. package/src/stories/examples/bounds/bounds.data.tsx +0 -191
  20. package/src/stories/examples/bounds/bounds.stories.mdx +0 -99
  21. package/src/stories/examples/center-zoomed-out/center-zoomed-out.stories.mdx +0 -206
  22. package/src/stories/examples/cinema/cinema-data.tsx +0 -578
  23. package/src/stories/examples/cinema/cinema.stories.mdx +0 -30
  24. package/src/stories/examples/cinema/example.tsx +0 -378
  25. package/src/stories/examples/cinema/image.png +0 -0
  26. package/src/stories/examples/content/content.stories.mdx +0 -172
  27. package/src/stories/examples/content/mixed-content.data.tsx +0 -624
  28. package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -34
  29. package/src/stories/examples/content-rerendering/example.tsx +0 -631
  30. package/src/stories/examples/controls/controls.stories.mdx +0 -120
  31. package/src/stories/examples/image/example.tsx +0 -149
  32. package/src/stories/examples/image/image.stories.mdx +0 -46
  33. package/src/stories/examples/image-annotations/example.tsx +0 -1442
  34. package/src/stories/examples/image-annotations/image-annotations.stories.mdx +0 -39
  35. package/src/stories/examples/image-responsive/example.tsx +0 -152
  36. package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -51
  37. package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -107
  38. package/src/stories/examples/initial-transform/example.tsx +0 -233
  39. package/src/stories/examples/initial-transform/initial-transform.stories.mdx +0 -37
  40. package/src/stories/examples/keep-scale/example.tsx +0 -882
  41. package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -30
  42. package/src/stories/examples/keep-scale/map.stories.mdx +0 -28
  43. package/src/stories/examples/medical-viewer/chest-xray.tsx +0 -246
  44. package/src/stories/examples/medical-viewer/example.tsx +0 -690
  45. package/src/stories/examples/medical-viewer/medical-viewer.stories.mdx +0 -49
  46. package/src/stories/examples/mini-map/example.tsx +0 -122
  47. package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -26
  48. package/src/stories/examples/miro/example.tsx +0 -1573
  49. package/src/stories/examples/miro/miro.stories.mdx +0 -31
  50. package/src/stories/examples/padding/example.tsx +0 -147
  51. package/src/stories/examples/padding/padding.stories.mdx +0 -35
  52. package/src/stories/examples/product-card/example.tsx +0 -594
  53. package/src/stories/examples/product-card/product-card.stories.mdx +0 -29
  54. package/src/stories/examples/stadium/example.tsx +0 -1040
  55. package/src/stories/examples/stadium/stadium-data.ts +0 -224
  56. package/src/stories/examples/stadium/stadium.stories.mdx +0 -32
  57. package/src/stories/examples/stress/example.tsx +0 -59
  58. package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
  59. package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
  60. package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -95
  61. package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
  62. package/src/stories/examples/text-selection/example.tsx +0 -221
  63. package/src/stories/examples/text-selection/text-selection.stories.mdx +0 -31
  64. package/src/stories/examples/velocity/example.tsx +0 -908
  65. package/src/stories/examples/velocity/velocity.stories.mdx +0 -35
  66. package/src/stories/examples/virtualize/example.tsx +0 -239
  67. package/src/stories/examples/virtualize/virtualize.stories.mdx +0 -84
  68. package/src/stories/examples/zoom-to-element/example.tsx +0 -219
  69. package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -31
  70. package/src/stories/hooks/use-controls.stories.mdx +0 -86
  71. package/src/stories/hooks/use-transform-component.stories.mdx +0 -108
  72. package/src/stories/hooks/use-transform-context.stories.mdx +0 -92
  73. package/src/stories/hooks/use-transform-effect.stories.mdx +0 -114
  74. package/src/stories/hooks/use-transform-init.stories.mdx +0 -105
  75. package/src/stories/types/args.types.ts +0 -192
  76. package/src/stories/utils/args.utils.ts +0 -35
  77. package/src/stories/utils/bounds-overlay.tsx +0 -168
  78. package/src/stories/utils/code.utils.tsx +0 -22
  79. package/src/stories/utils/controls.utils.tsx +0 -347
  80. package/src/stories/utils/index.ts +0 -5
  81. package/src/stories/utils/styles.module.css +0 -223
  82. package/src/stories/utils/viewer.styles.ts +0 -34
@@ -1,30 +0,0 @@
1
- import { Meta, Story, ArgsTable, Canvas } from "@storybook/blocks";
2
-
3
- import { TransformWrapper, TransformComponent } from "../../../components";
4
- import { argsTypes } from "../../types/args.types";
5
- import { Example } from "./example";
6
-
7
- export const Template = (args) => <Example {...args} />;
8
-
9
- <Meta
10
- title="Components/Keep Scale"
11
- component={TransformWrapper}
12
- argTypes={argsTypes}
13
- />
14
-
15
- # Keep Scale
16
-
17
- The `KeepScale` component wraps child elements so they **maintain their visual
18
- size** regardless of the current zoom level. As you zoom into the map, the
19
- pin markers stay the same size on screen while the terrain scales normally.
20
-
21
- Click any **marker on the map** or a **location card** below to zoom in.
22
- The pins remain crisp and legible at every zoom level — even at 100×.
23
-
24
- <Canvas>
25
- <Story name="Keep Scale">{(args) => <Template {...args} />}</Story>
26
- </Canvas>
27
-
28
- ## Component API
29
-
30
- <ArgsTable story="Keep Scale" />
@@ -1,28 +0,0 @@
1
- import { Meta, Story, ArgsTable, Canvas } from "@storybook/blocks";
2
-
3
- import { TransformWrapper } from "../../../components";
4
- import { argsTypes } from "../../types/args.types";
5
- import { Example } from "./example";
6
-
7
- export const Template = (args) => <Example {...args} />;
8
-
9
- <Meta
10
- title="Examples/Map"
11
- component={TransformWrapper}
12
- argTypes={argsTypes}
13
- />
14
-
15
- # Map
16
-
17
- An interactive **island map** with points of interest that stay readable at
18
- every zoom level thanks to `KeepScale`. Click any **pin** or pick a
19
- **location card** from the bar below to fly to that spot. Zoom out to see the
20
- full archipelago, zoom in for street-level detail.
21
-
22
- <Canvas>
23
- <Story name="Map">{(args) => <Template {...args} />}</Story>
24
- </Canvas>
25
-
26
- ## Component API
27
-
28
- <ArgsTable story="Map" />
@@ -1,246 +0,0 @@
1
- import React from "react";
2
-
3
- export const XRAY_W = 1024;
4
- export const XRAY_H = 1280;
5
-
6
- const CX = XRAY_W / 2;
7
-
8
- export const ChestXray: React.FC = () => (
9
- <svg
10
- xmlns="http://www.w3.org/2000/svg"
11
- width={XRAY_W}
12
- height={XRAY_H}
13
- viewBox={`0 0 ${XRAY_W} ${XRAY_H}`}
14
- style={{ display: "block" }}
15
- >
16
- <defs>
17
- <radialGradient id="xray-bg" cx="50%" cy="44%" r="55%">
18
- <stop offset="0%" stopColor="#1a1a1a" />
19
- <stop offset="100%" stopColor="#050505" />
20
- </radialGradient>
21
-
22
- <radialGradient id="lung-l" cx="38%" cy="50%" r="32%">
23
- <stop offset="0%" stopColor="#222" />
24
- <stop offset="70%" stopColor="#181818" />
25
- <stop offset="100%" stopColor="#111" />
26
- </radialGradient>
27
- <radialGradient id="lung-r" cx="62%" cy="50%" r="32%">
28
- <stop offset="0%" stopColor="#222" />
29
- <stop offset="70%" stopColor="#181818" />
30
- <stop offset="100%" stopColor="#111" />
31
- </radialGradient>
32
-
33
- <radialGradient id="heart-g" cx="52%" cy="54%" r="24%">
34
- <stop offset="0%" stopColor="#444" />
35
- <stop offset="100%" stopColor="#2a2a2a" />
36
- </radialGradient>
37
-
38
- <linearGradient id="bone-fill" x1="0" y1="0" x2="0" y2="1">
39
- <stop offset="0%" stopColor="#bbb" />
40
- <stop offset="100%" stopColor="#888" />
41
- </linearGradient>
42
-
43
- <filter id="film-grain">
44
- <feTurbulence
45
- type="fractalNoise"
46
- baseFrequency="0.65"
47
- numOctaves="3"
48
- result="noise"
49
- />
50
- <feColorMatrix type="saturate" values="0" in="noise" result="mono" />
51
- <feBlend in="SourceGraphic" in2="mono" mode="multiply" />
52
- </filter>
53
- </defs>
54
-
55
- <rect width={XRAY_W} height={XRAY_H} fill="url(#xray-bg)" />
56
-
57
- {/* Soft tissue silhouette */}
58
- <ellipse cx={CX} cy={540} rx={340} ry={380} fill="#151515" opacity={0.85} />
59
-
60
- {/* Lung fields */}
61
- <path
62
- d="M 200 310 C 170 440, 180 680, 280 820 Q 340 870, 400 840 C 440 760, 460 520, 430 350 Q 410 280, 340 260 Q 260 250, 200 310 Z"
63
- fill="url(#lung-l)"
64
- opacity={0.8}
65
- />
66
- <path
67
- d="M 824 310 C 854 440, 844 680, 744 820 Q 684 870, 624 840 C 584 760, 564 520, 594 350 Q 614 280, 684 260 Q 764 250, 824 310 Z"
68
- fill="url(#lung-r)"
69
- opacity={0.8}
70
- />
71
-
72
- {/* Mediastinum / heart shadow */}
73
- <ellipse
74
- cx={CX + 20}
75
- cy={580}
76
- rx={140}
77
- ry={160}
78
- fill="url(#heart-g)"
79
- opacity={0.9}
80
- />
81
- <ellipse
82
- cx={CX - 10}
83
- cy={520}
84
- rx={50}
85
- ry={80}
86
- fill="#383838"
87
- opacity={0.5}
88
- />
89
-
90
- {/* Trachea + bronchi */}
91
- <path
92
- d={`M ${CX} 180 L ${CX} 360 Q ${CX - 40} 410, ${CX - 100} 450`}
93
- fill="none"
94
- stroke="#777"
95
- strokeWidth={6}
96
- strokeLinecap="round"
97
- opacity={0.5}
98
- />
99
- <path
100
- d={`M ${CX} 360 Q ${CX + 40} 410, ${CX + 90} 440`}
101
- fill="none"
102
- stroke="#777"
103
- strokeWidth={5}
104
- strokeLinecap="round"
105
- opacity={0.45}
106
- />
107
-
108
- {/* Spine / vertebrae */}
109
- {Array.from({ length: 12 }, (_, i) => {
110
- const y = 260 + i * 58;
111
- const w = 28 - i * 0.4;
112
- return (
113
- <React.Fragment key={`vert-${i}`}>
114
- <rect
115
- x={CX - w / 2}
116
- y={y}
117
- width={w}
118
- height={46}
119
- rx={5}
120
- fill="url(#bone-fill)"
121
- opacity={0.55 + i * 0.015}
122
- />
123
- <rect
124
- x={CX - w / 2 + 2}
125
- y={y + 44}
126
- width={w - 4}
127
- height={12}
128
- rx={3}
129
- fill="#888"
130
- opacity={0.3}
131
- />
132
- </React.Fragment>
133
- );
134
- })}
135
-
136
- {/* Ribs */}
137
- {Array.from({ length: 10 }, (_, i) => {
138
- const y = 310 + i * 52;
139
- const curve = 6 + i * 1.2;
140
- const span = 180 + i * 14;
141
- return (
142
- <React.Fragment key={`rib-${i}`}>
143
- <path
144
- d={`M ${CX - 20} ${y} Q ${CX - span * 0.5} ${y + curve}, ${CX - span} ${y + curve * 2.5}`}
145
- fill="none"
146
- stroke="url(#bone-fill)"
147
- strokeWidth={i < 2 ? 3.5 : 3}
148
- strokeLinecap="round"
149
- opacity={0.52 + i * 0.02}
150
- />
151
- <path
152
- d={`M ${CX + 20} ${y} Q ${CX + span * 0.5} ${y + curve}, ${CX + span} ${y + curve * 2.5}`}
153
- fill="none"
154
- stroke="url(#bone-fill)"
155
- strokeWidth={i < 2 ? 3.5 : 3}
156
- strokeLinecap="round"
157
- opacity={0.52 + i * 0.02}
158
- />
159
- </React.Fragment>
160
- );
161
- })}
162
-
163
- {/* Clavicles */}
164
- <path
165
- d={`M ${CX - 14} 260 Q ${CX - 120} 240, ${CX - 260} 275`}
166
- fill="none"
167
- stroke="url(#bone-fill)"
168
- strokeWidth={5}
169
- strokeLinecap="round"
170
- opacity={0.65}
171
- />
172
- <path
173
- d={`M ${CX + 14} 260 Q ${CX + 120} 240, ${CX + 260} 275`}
174
- fill="none"
175
- stroke="url(#bone-fill)"
176
- strokeWidth={5}
177
- strokeLinecap="round"
178
- opacity={0.65}
179
- />
180
-
181
- {/* Scapulae (hints) */}
182
- <path
183
- d={`M ${CX - 280} 310 Q ${CX - 320} 420, ${CX - 280} 600`}
184
- fill="none"
185
- stroke="#666"
186
- strokeWidth={3}
187
- strokeLinecap="round"
188
- opacity={0.25}
189
- />
190
- <path
191
- d={`M ${CX + 280} 310 Q ${CX + 320} 420, ${CX + 280} 600`}
192
- fill="none"
193
- stroke="#666"
194
- strokeWidth={3}
195
- strokeLinecap="round"
196
- opacity={0.25}
197
- />
198
-
199
- {/* Diaphragm domes */}
200
- <path
201
- d={`M 180 830 Q 350 760, ${CX} 820 Q 680 760, 850 830`}
202
- fill="none"
203
- stroke="#777"
204
- strokeWidth={3}
205
- opacity={0.4}
206
- />
207
-
208
- {/* Costophrenic angles */}
209
- <path
210
- d="M 190 830 Q 210 900, 280 910"
211
- fill="none"
212
- stroke="#555"
213
- strokeWidth={2}
214
- opacity={0.3}
215
- />
216
- <path
217
- d="M 840 830 Q 820 900, 750 910"
218
- fill="none"
219
- stroke="#555"
220
- strokeWidth={2}
221
- opacity={0.3}
222
- />
223
-
224
- {/* Film grain overlay */}
225
- <rect
226
- width={XRAY_W}
227
- height={XRAY_H}
228
- fill="transparent"
229
- filter="url(#film-grain)"
230
- opacity={0.08}
231
- />
232
-
233
- {/* L marker */}
234
- <text
235
- x={XRAY_W - 60}
236
- y={220}
237
- fill="#ccc"
238
- fontSize={32}
239
- fontWeight={700}
240
- fontFamily="ui-serif, Georgia, serif"
241
- opacity={0.75}
242
- >
243
- L
244
- </text>
245
- </svg>
246
- );