react-zoom-pan-pinch 4.0.0 → 4.0.2
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/package.json +4 -3
- 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 +0 -1
- package/src/stories/assets/small-image.jpg +0 -0
- package/src/stories/assets/svg-example.svg +0 -14
- package/src/stories/docs/DocTable.tsx +0 -59
- package/src/stories/docs/HandlerCards.tsx +0 -102
- package/src/stories/docs/Introduction.stories.mdx +0 -135
- package/src/stories/docs/PropTable.tsx +0 -116
- package/src/stories/docs/docs.module.css +0 -370
- package/src/stories/docs/handlers.stories.mdx +0 -7
- package/src/stories/docs/handlers.tsx +0 -111
- package/src/stories/docs/props.stories.mdx +0 -11
- package/src/stories/docs/props.tsx +0 -571
- package/src/stories/examples/axis-lock/axis-lock.stories.mdx +0 -35
- package/src/stories/examples/axis-lock/example.tsx +0 -114
- package/src/stories/examples/bounds/bounds.data.tsx +0 -191
- package/src/stories/examples/bounds/bounds.stories.mdx +0 -99
- package/src/stories/examples/center-zoomed-out/center-zoomed-out.stories.mdx +0 -206
- package/src/stories/examples/cinema/cinema-data.tsx +0 -578
- package/src/stories/examples/cinema/cinema.stories.mdx +0 -30
- package/src/stories/examples/cinema/example.tsx +0 -378
- package/src/stories/examples/cinema/image.png +0 -0
- package/src/stories/examples/content/content.stories.mdx +0 -172
- package/src/stories/examples/content/mixed-content.data.tsx +0 -624
- package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -34
- package/src/stories/examples/content-rerendering/example.tsx +0 -631
- package/src/stories/examples/controls/controls.stories.mdx +0 -120
- package/src/stories/examples/image/example.tsx +0 -149
- package/src/stories/examples/image/image.stories.mdx +0 -46
- package/src/stories/examples/image-annotations/example.tsx +0 -1442
- package/src/stories/examples/image-annotations/image-annotations.stories.mdx +0 -39
- package/src/stories/examples/image-responsive/example.tsx +0 -152
- package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -51
- package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -107
- package/src/stories/examples/initial-transform/example.tsx +0 -233
- package/src/stories/examples/initial-transform/initial-transform.stories.mdx +0 -37
- package/src/stories/examples/keep-scale/example.tsx +0 -882
- package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -30
- package/src/stories/examples/keep-scale/map.stories.mdx +0 -28
- package/src/stories/examples/medical-viewer/chest-xray.tsx +0 -246
- package/src/stories/examples/medical-viewer/example.tsx +0 -690
- package/src/stories/examples/medical-viewer/medical-viewer.stories.mdx +0 -49
- package/src/stories/examples/mini-map/example.tsx +0 -122
- package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -26
- package/src/stories/examples/miro/example.tsx +0 -1573
- package/src/stories/examples/miro/miro.stories.mdx +0 -31
- package/src/stories/examples/padding/example.tsx +0 -147
- package/src/stories/examples/padding/padding.stories.mdx +0 -35
- package/src/stories/examples/product-card/example.tsx +0 -594
- package/src/stories/examples/product-card/product-card.stories.mdx +0 -29
- package/src/stories/examples/stadium/example.tsx +0 -1040
- package/src/stories/examples/stadium/stadium-data.ts +0 -224
- package/src/stories/examples/stadium/stadium.stories.mdx +0 -32
- package/src/stories/examples/stress/example.tsx +0 -59
- package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
- package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
- package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -95
- package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
- package/src/stories/examples/text-selection/example.tsx +0 -221
- package/src/stories/examples/text-selection/text-selection.stories.mdx +0 -31
- package/src/stories/examples/velocity/example.tsx +0 -908
- package/src/stories/examples/velocity/velocity.stories.mdx +0 -35
- package/src/stories/examples/virtualize/example.tsx +0 -239
- package/src/stories/examples/virtualize/virtualize.stories.mdx +0 -84
- package/src/stories/examples/zoom-to-element/example.tsx +0 -219
- package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -31
- package/src/stories/hooks/use-controls.stories.mdx +0 -86
- package/src/stories/hooks/use-transform-component.stories.mdx +0 -108
- package/src/stories/hooks/use-transform-context.stories.mdx +0 -92
- package/src/stories/hooks/use-transform-effect.stories.mdx +0 -114
- package/src/stories/hooks/use-transform-init.stories.mdx +0 -105
- package/src/stories/types/args.types.ts +0 -192
- package/src/stories/utils/args.utils.ts +0 -35
- package/src/stories/utils/bounds-overlay.tsx +0 -168
- package/src/stories/utils/code.utils.tsx +0 -22
- package/src/stories/utils/controls.utils.tsx +0 -347
- package/src/stories/utils/index.ts +0 -5
- package/src/stories/utils/styles.module.css +0 -223
- package/src/stories/utils/viewer.styles.ts +0 -34
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, ArgsTable, Canvas } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
import { TransformWrapper } from "../../../components";
|
|
4
|
-
import { argsTypes } from "../../types/args.types.ts";
|
|
5
|
-
import { Example } from "./example";
|
|
6
|
-
|
|
7
|
-
export const Template = (args) => <Example {...args} />;
|
|
8
|
-
|
|
9
|
-
<Meta
|
|
10
|
-
title="Examples/Medical viewer"
|
|
11
|
-
component={TransformWrapper}
|
|
12
|
-
argTypes={argsTypes}
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
# Medical viewer
|
|
16
|
-
|
|
17
|
-
A **radiology workstation**-style viewer built on top of the library: zoom deep
|
|
18
|
-
into the X-ray, double-click to quick-zoom, and pan across a chest PA film.
|
|
19
|
-
|
|
20
|
-
## What this demonstrates
|
|
21
|
-
|
|
22
|
-
| Feature | Library concept |
|
|
23
|
-
|---|---|
|
|
24
|
-
| **Deep zoom** (up to 10×) | `minScale` / `maxScale` |
|
|
25
|
-
| **Double-click quick-zoom** | `doubleClick.step` |
|
|
26
|
-
| **No bounds lock** | `limitToBounds={false}` for free panning |
|
|
27
|
-
| **Overlay annotations** | Absolute-positioned content inside `TransformComponent` |
|
|
28
|
-
|
|
29
|
-
## Viewer controls
|
|
30
|
-
|
|
31
|
-
- **Window presets** — simulate DICOM windowing (brightness + contrast via CSS
|
|
32
|
-
filters): Lung, Bone, Soft tissue, Mediastinum.
|
|
33
|
-
- **Invert** — flips to negative (standard radiology toggle).
|
|
34
|
-
- **Findings** — toggleable markers on the image with severity badges (normal /
|
|
35
|
-
mild / significant). Click a marker or chip to show the detail popover.
|
|
36
|
-
- **Ruler** — pixel ruler along left and top edges.
|
|
37
|
-
|
|
38
|
-
DICOM-style metadata overlays are rendered in the four corners (patient, study,
|
|
39
|
-
series, window values). They stay pinned while the image transforms underneath.
|
|
40
|
-
|
|
41
|
-
<Canvas>
|
|
42
|
-
<Story name="Medical viewer">
|
|
43
|
-
{(args) => <Template {...args} />}
|
|
44
|
-
</Story>
|
|
45
|
-
</Canvas>
|
|
46
|
-
|
|
47
|
-
## Component API
|
|
48
|
-
|
|
49
|
-
<ArgsTable story="Medical viewer" />
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { MiniMap, TransformComponent, TransformWrapper } from "components";
|
|
4
|
-
import { Controls, normalizeArgs, viewerChrome } from "stories/utils";
|
|
5
|
-
|
|
6
|
-
const storyMiniMapPreviewStyle: React.CSSProperties = {
|
|
7
|
-
borderRadius: 4,
|
|
8
|
-
border: "2px solid rgba(147, 197, 253, 0.95)",
|
|
9
|
-
boxShadow: [
|
|
10
|
-
"0 0 0 1px rgba(255,255,255,0.22) inset",
|
|
11
|
-
"0 0 14px rgba(125,211,252,0.45)",
|
|
12
|
-
"0 0 28px rgba(56,189,248,0.22)",
|
|
13
|
-
"rgba(6,10,20,0.82) 0 0 0 10000000px",
|
|
14
|
-
].join(", "),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Content = () => (
|
|
18
|
-
<div style={{ padding: 32 }}>
|
|
19
|
-
<h2
|
|
20
|
-
style={{
|
|
21
|
-
margin: "0 0 16px",
|
|
22
|
-
fontSize: 18,
|
|
23
|
-
fontWeight: 700,
|
|
24
|
-
color: "rgba(255,255,255,0.9)",
|
|
25
|
-
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
Scrollable Document
|
|
29
|
-
</h2>
|
|
30
|
-
{[1, 2, 3].map((i) => (
|
|
31
|
-
<div
|
|
32
|
-
key={i}
|
|
33
|
-
style={{
|
|
34
|
-
marginBottom: 16,
|
|
35
|
-
padding: "16px 20px",
|
|
36
|
-
borderRadius: 10,
|
|
37
|
-
background: "rgba(255,255,255,0.03)",
|
|
38
|
-
borderLeft: `3px solid ${["#667eea", "#43e97b", "#f093fb"][i - 1]}`,
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
<span
|
|
42
|
-
style={{
|
|
43
|
-
fontSize: 12,
|
|
44
|
-
fontWeight: 700,
|
|
45
|
-
color: ["#667eea", "#43e97b", "#f093fb"][i - 1],
|
|
46
|
-
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
Section {i}
|
|
50
|
-
</span>
|
|
51
|
-
<p
|
|
52
|
-
style={{
|
|
53
|
-
margin: "8px 0 0",
|
|
54
|
-
fontSize: 13,
|
|
55
|
-
lineHeight: 1.6,
|
|
56
|
-
color: "rgba(255,255,255,0.5)",
|
|
57
|
-
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
61
|
-
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
|
62
|
-
minim veniam, quis nostrud exercitation ullamco laboris.
|
|
63
|
-
</p>
|
|
64
|
-
</div>
|
|
65
|
-
))}
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
export const Template = (args: any) => {
|
|
70
|
-
return (
|
|
71
|
-
<div style={{ fontFamily: "system-ui, -apple-system, sans-serif" }}>
|
|
72
|
-
<TransformWrapper
|
|
73
|
-
{...normalizeArgs(args)}
|
|
74
|
-
wrapperStyle={{
|
|
75
|
-
width: "500px",
|
|
76
|
-
height: "500px",
|
|
77
|
-
maxWidth: "80vw",
|
|
78
|
-
maxHeight: "75vh",
|
|
79
|
-
}}
|
|
80
|
-
contentStyle={{
|
|
81
|
-
width: "500px",
|
|
82
|
-
height: "500px",
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{(utils) => (
|
|
86
|
-
<>
|
|
87
|
-
<div
|
|
88
|
-
style={{
|
|
89
|
-
position: "absolute",
|
|
90
|
-
zIndex: 5,
|
|
91
|
-
top: 25,
|
|
92
|
-
right: 25,
|
|
93
|
-
borderRadius: 6,
|
|
94
|
-
overflow: "hidden",
|
|
95
|
-
background:
|
|
96
|
-
"linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(10, 10, 24, 0.95))",
|
|
97
|
-
backdropFilter: "blur(14px) saturate(1.4)",
|
|
98
|
-
WebkitBackdropFilter: "blur(14px) saturate(1.4)",
|
|
99
|
-
border: "1px solid rgba(255,255,255,0.12)",
|
|
100
|
-
boxShadow:
|
|
101
|
-
"0 4px 24px rgba(0,0,0,0.45), 0 0 0 0.5px rgba(255,255,255,0.06) inset",
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<MiniMap
|
|
105
|
-
width={168}
|
|
106
|
-
height={126}
|
|
107
|
-
previewStyle={storyMiniMapPreviewStyle}
|
|
108
|
-
borderColor="rgba(147, 197, 253, 0.95)"
|
|
109
|
-
>
|
|
110
|
-
<Content />
|
|
111
|
-
</MiniMap>
|
|
112
|
-
</div>
|
|
113
|
-
<Controls {...utils} />
|
|
114
|
-
<TransformComponent wrapperStyle={viewerChrome}>
|
|
115
|
-
<Content />
|
|
116
|
-
</TransformComponent>
|
|
117
|
-
</>
|
|
118
|
-
)}
|
|
119
|
-
</TransformWrapper>
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, ArgsTable, Canvas } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
import { TransformWrapper, TransformComponent, MiniMap } from "../../../components";
|
|
4
|
-
import { argsTypes } from "../../types/args.types.ts";
|
|
5
|
-
import { Template } from "./example";
|
|
6
|
-
|
|
7
|
-
<Meta
|
|
8
|
-
title="Components/Mini Map"
|
|
9
|
-
component={TransformWrapper}
|
|
10
|
-
argTypes={argsTypes}
|
|
11
|
-
/>
|
|
12
|
-
|
|
13
|
-
# Mini Map
|
|
14
|
-
|
|
15
|
-
A **miniature overview** that mirrors the main content and highlights the
|
|
16
|
-
currently visible viewport. The `MiniMap` component renders a scaled-down
|
|
17
|
-
duplicate of the content in a floating panel — useful for large canvases,
|
|
18
|
-
documents, or maps where spatial awareness matters.
|
|
19
|
-
|
|
20
|
-
<Canvas>
|
|
21
|
-
<Story name="Mini Map">{(args) => <Template {...args} />}</Story>
|
|
22
|
-
</Canvas>
|
|
23
|
-
|
|
24
|
-
## Component API
|
|
25
|
-
|
|
26
|
-
<ArgsTable story="Mini Map" />
|