@papyrus-sdk/ui-react-native 0.2.24 → 0.2.27
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 +3 -1
- package/dist/{chunk-B36LWZCX.mjs → chunk-K2ZLYLHR.mjs} +84 -1
- package/dist/chunk-K2ZLYLHR.mjs.map +1 -0
- package/dist/{chunk-B25KK4VL.mjs → chunk-KXNP73MZ.mjs} +1 -7
- package/dist/chunk-KXNP73MZ.mjs.map +1 -0
- package/dist/gesture/pinchZoom.d.mts +35 -1
- package/dist/gesture/pinchZoom.d.ts +35 -1
- package/dist/gesture/pinchZoom.js +89 -2
- package/dist/gesture/pinchZoom.js.map +1 -1
- package/dist/gesture/pinchZoom.mjs +11 -3
- package/dist/gesture/selectionInteraction.d.mts +1 -6
- package/dist/gesture/selectionInteraction.d.ts +1 -6
- package/dist/gesture/selectionInteraction.js +0 -7
- package/dist/gesture/selectionInteraction.js.map +1 -1
- package/dist/gesture/selectionInteraction.mjs +1 -3
- package/dist/index.d.mts +42 -28
- package/dist/index.d.ts +42 -28
- package/dist/index.js +4285 -2827
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4083 -2621
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/runtime/comicRuntime.test.ts +151 -0
- package/runtime/documentLoadRuntime.test.ts +172 -0
- package/runtime/epubScrollDiagnostics.test.ts +107 -0
- package/runtime/epubScrollDiagnostics.ts +127 -0
- package/runtime/index.html +1529 -956
- package/runtime/runtime.js +590 -24
- package/runtime/syncComicRuntime.mjs +22 -6
- package/dist/chunk-B25KK4VL.mjs.map +0 -1
- package/dist/chunk-B36LWZCX.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -98,7 +98,9 @@ Performance tuning props are available on `Viewer` and `RightSheet`:
|
|
|
98
98
|
|
|
99
99
|
- `virtualWindowSize` (`Viewer`): FlatList window size. Default: `8`.
|
|
100
100
|
- `maxToRenderPerBatch` (`Viewer`): max items per render batch. Default: `6`.
|
|
101
|
-
- `removeClippedSubviews` (`Viewer`): detach offscreen rows. Default: `
|
|
101
|
+
- `removeClippedSubviews` (`Viewer`): detach offscreen rows. Default: `false`
|
|
102
|
+
for Android `viewerMode="compat"` and `true` otherwise. An explicit value is
|
|
103
|
+
always respected.
|
|
102
104
|
- `thumbsInitialCount` (`RightSheet`): initial thumbnails rendered when opening pages tab. Default: `4`.
|
|
103
105
|
|
|
104
106
|
Recommended starting points:
|
|
@@ -41,6 +41,85 @@ var resolvePinchGestureZoom = (startZoom, scaleFactor, bounds = DEFAULT_PINCH_ZO
|
|
|
41
41
|
bounds.minZoom,
|
|
42
42
|
bounds.maxZoom
|
|
43
43
|
);
|
|
44
|
+
var createPinchInteraction = ({
|
|
45
|
+
committedZoom,
|
|
46
|
+
focalX,
|
|
47
|
+
focalY,
|
|
48
|
+
startScrollX,
|
|
49
|
+
startScrollY
|
|
50
|
+
}) => {
|
|
51
|
+
const safeZoom = clamp(
|
|
52
|
+
Number.isFinite(committedZoom) && committedZoom > 0 ? committedZoom : 1,
|
|
53
|
+
DEFAULT_PINCH_ZOOM_BOUNDS.minZoom,
|
|
54
|
+
DEFAULT_PINCH_ZOOM_BOUNDS.maxZoom
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
committedZoom: safeZoom,
|
|
58
|
+
previewZoom: safeZoom,
|
|
59
|
+
focalPoint: {
|
|
60
|
+
x: Number.isFinite(focalX) ? focalX : 0,
|
|
61
|
+
y: Number.isFinite(focalY) ? focalY : 0
|
|
62
|
+
},
|
|
63
|
+
startScrollX: Number.isFinite(startScrollX) ? startScrollX : 0,
|
|
64
|
+
startScrollY: Number.isFinite(startScrollY) ? startScrollY : 0,
|
|
65
|
+
commitCount: 0,
|
|
66
|
+
outcome: "active"
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
var updatePinchInteraction = (state, previewZoom, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => {
|
|
70
|
+
if (state.outcome !== "active") return state;
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
previewZoom: clamp(
|
|
74
|
+
Number.isFinite(previewZoom) && previewZoom > 0 ? previewZoom : state.committedZoom,
|
|
75
|
+
bounds.minZoom,
|
|
76
|
+
bounds.maxZoom
|
|
77
|
+
)
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
var finishPinchInteraction = (state, action) => {
|
|
81
|
+
if (state.outcome !== "active") return state;
|
|
82
|
+
if (action === "cancel") {
|
|
83
|
+
return {
|
|
84
|
+
...state,
|
|
85
|
+
previewZoom: state.committedZoom,
|
|
86
|
+
outcome: "cancel"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
...state,
|
|
91
|
+
committedZoom: state.previewZoom,
|
|
92
|
+
commitCount: state.commitCount + 1,
|
|
93
|
+
outcome: "commit"
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
var createPinchController = ({
|
|
97
|
+
onPreview,
|
|
98
|
+
onCommit,
|
|
99
|
+
onCancel,
|
|
100
|
+
...input
|
|
101
|
+
}) => {
|
|
102
|
+
let state = createPinchInteraction(input);
|
|
103
|
+
const update = (previewZoom, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => {
|
|
104
|
+
const next = updatePinchInteraction(state, previewZoom, bounds);
|
|
105
|
+
if (next === state) return;
|
|
106
|
+
state = next;
|
|
107
|
+
onPreview?.(state);
|
|
108
|
+
};
|
|
109
|
+
const finish = (action) => {
|
|
110
|
+
const next = finishPinchInteraction(state, action);
|
|
111
|
+
if (next === state) return;
|
|
112
|
+
state = next;
|
|
113
|
+
if (state.outcome === "cancel") onCancel?.(state);
|
|
114
|
+
else onCommit?.(state);
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
update,
|
|
118
|
+
end: () => finish("end"),
|
|
119
|
+
cancel: () => finish("cancel"),
|
|
120
|
+
finalize: () => finish("finalize")
|
|
121
|
+
};
|
|
122
|
+
};
|
|
44
123
|
var resolveAnchoredViewportOffset = ({
|
|
45
124
|
viewportOffset,
|
|
46
125
|
startScrollOffset,
|
|
@@ -166,6 +245,10 @@ export {
|
|
|
166
245
|
resolvePinchPreviewScale,
|
|
167
246
|
sanitizePinchPreviewScale,
|
|
168
247
|
resolvePinchGestureZoom,
|
|
248
|
+
createPinchInteraction,
|
|
249
|
+
updatePinchInteraction,
|
|
250
|
+
finishPinchInteraction,
|
|
251
|
+
createPinchController,
|
|
169
252
|
resolveAnchoredViewportOffset,
|
|
170
253
|
resolveAnchoredDocumentOffset,
|
|
171
254
|
resolveClampedScrollOffset,
|
|
@@ -175,4 +258,4 @@ export {
|
|
|
175
258
|
resolveCenteredContentInset,
|
|
176
259
|
shouldSuppressPressAfterPinch
|
|
177
260
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
261
|
+
//# sourceMappingURL=chunk-K2ZLYLHR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gesture/pinchZoom.ts"],"sourcesContent":["export type PinchTouchPoint = {\n pageX: number;\n pageY: number;\n};\n\nexport type PinchSession = {\n initialDistance: number;\n initialZoom: number;\n};\n\nexport type PinchZoomBounds = {\n minZoom: number;\n maxZoom: number;\n};\n\nexport type PinchInteractionState = {\n committedZoom: number;\n previewZoom: number;\n focalPoint: { x: number; y: number };\n startScrollX: number;\n startScrollY: number;\n commitCount: number;\n outcome: \"active\" | \"commit\" | \"cancel\";\n};\n\nexport type PinchInteractionInput = {\n committedZoom: number;\n focalX: number;\n focalY: number;\n startScrollX: number;\n startScrollY: number;\n};\n\nexport type PinchControllerInput = PinchInteractionInput & {\n onPreview?: (state: PinchInteractionState) => void;\n onCommit?: (state: PinchInteractionState) => void;\n onCancel?: (state: PinchInteractionState) => void;\n};\n\nexport type PinchController = {\n update: (previewZoom: number, bounds?: PinchZoomBounds) => void;\n end: () => void;\n cancel: () => void;\n finalize: () => void;\n};\n\nexport type AnchoredViewportOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startItemOffset: number;\n startItemLength: number;\n endItemOffset: number;\n endItemLength: number;\n viewportLength: number;\n endContentLength: number;\n};\n\nexport type AnchoredDocumentOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startContentLength: number;\n endContentLength: number;\n viewportLength: number;\n};\n\nexport type DocumentSurfaceWidthInput = {\n viewportWidth: number;\n contentWidth: number;\n horizontalPadding: number;\n};\n\nexport type GlobalHorizontalOffsetInput = {\n offsetX: number;\n surfaceWidth: number;\n viewportWidth: number;\n};\n\nexport type AnchoredHorizontalSurfaceOffsetInput = {\n focalViewportX: number;\n startSurfaceScrollX: number;\n startSurfaceWidth: number;\n endSurfaceWidth: number;\n viewportWidth: number;\n};\n\nexport type CenteredContentInsetInput = {\n viewportLength: number;\n contentLength: number;\n};\n\nexport const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds = {\n minZoom: 0.5,\n maxZoom: 4,\n};\nexport const PINCH_PRESS_SUPPRESSION_MS = 120;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nexport const getTouchDistance = (touches: PinchTouchPoint[]): number => {\n if (touches.length < 2) return 0;\n const [first, second] = touches;\n return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);\n};\n\nexport const isPinchTouchList = (touches: PinchTouchPoint[]): boolean =>\n touches.length === 2 && getTouchDistance(touches) > 0;\n\nexport const createPinchSession = (\n touches: PinchTouchPoint[],\n zoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchSession => ({\n initialDistance: Math.max(1, getTouchDistance(touches)),\n initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom),\n});\n\nexport const resolvePinchZoomChange = (\n session: PinchSession,\n touches: PinchTouchPoint[],\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number => {\n const distance = getTouchDistance(touches);\n if (distance <= 0) {\n return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);\n }\n\n return clamp(\n session.initialZoom * (distance / session.initialDistance),\n bounds.minZoom,\n bounds.maxZoom\n );\n};\n\nexport const resolvePinchPreviewScale = (\n startZoom: number,\n previewZoom: number\n): number => {\n const safeStartZoom = Math.max(0.0001, Math.abs(startZoom));\n return previewZoom / safeStartZoom;\n};\n\nexport const sanitizePinchPreviewScale = (value: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n return 1;\n }\n return value;\n};\n\nexport const resolvePinchGestureZoom = (\n startZoom: number,\n scaleFactor: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number =>\n clamp(\n (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) *\n (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),\n bounds.minZoom,\n bounds.maxZoom\n );\n\nexport const createPinchInteraction = ({\n committedZoom,\n focalX,\n focalY,\n startScrollX,\n startScrollY,\n}: PinchInteractionInput): PinchInteractionState => {\n const safeZoom = clamp(\n Number.isFinite(committedZoom) && committedZoom > 0 ? committedZoom : 1,\n DEFAULT_PINCH_ZOOM_BOUNDS.minZoom,\n DEFAULT_PINCH_ZOOM_BOUNDS.maxZoom\n );\n\n return {\n committedZoom: safeZoom,\n previewZoom: safeZoom,\n focalPoint: {\n x: Number.isFinite(focalX) ? focalX : 0,\n y: Number.isFinite(focalY) ? focalY : 0,\n },\n startScrollX: Number.isFinite(startScrollX) ? startScrollX : 0,\n startScrollY: Number.isFinite(startScrollY) ? startScrollY : 0,\n commitCount: 0,\n outcome: \"active\",\n };\n};\n\nexport const updatePinchInteraction = (\n state: PinchInteractionState,\n previewZoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchInteractionState => {\n if (state.outcome !== \"active\") return state;\n return {\n ...state,\n previewZoom: clamp(\n Number.isFinite(previewZoom) && previewZoom > 0\n ? previewZoom\n : state.committedZoom,\n bounds.minZoom,\n bounds.maxZoom\n ),\n };\n};\n\nexport const finishPinchInteraction = (\n state: PinchInteractionState,\n action: \"end\" | \"finalize\" | \"cancel\"\n): PinchInteractionState => {\n if (state.outcome !== \"active\") return state;\n if (action === \"cancel\") {\n return {\n ...state,\n previewZoom: state.committedZoom,\n outcome: \"cancel\",\n };\n }\n\n return {\n ...state,\n committedZoom: state.previewZoom,\n commitCount: state.commitCount + 1,\n outcome: \"commit\",\n };\n};\n\nexport const createPinchController = ({\n onPreview,\n onCommit,\n onCancel,\n ...input\n}: PinchControllerInput): PinchController => {\n let state = createPinchInteraction(input);\n\n const update = (\n previewZoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n ) => {\n const next = updatePinchInteraction(state, previewZoom, bounds);\n if (next === state) return;\n state = next;\n onPreview?.(state);\n };\n\n const finish = (action: \"end\" | \"finalize\" | \"cancel\") => {\n const next = finishPinchInteraction(state, action);\n if (next === state) return;\n state = next;\n if (state.outcome === \"cancel\") onCancel?.(state);\n else onCommit?.(state);\n };\n\n return {\n update,\n end: () => finish(\"end\"),\n cancel: () => finish(\"cancel\"),\n finalize: () => finish(\"finalize\"),\n };\n};\n\nexport const resolveAnchoredViewportOffset = ({\n viewportOffset,\n startScrollOffset,\n startItemOffset,\n startItemLength,\n endItemOffset,\n endItemLength,\n viewportLength,\n endContentLength,\n}: AnchoredViewportOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartItemOffset = Number.isFinite(startItemOffset)\n ? startItemOffset\n : 0;\n const safeStartItemLength =\n Number.isFinite(startItemLength) && startItemLength > 0\n ? startItemLength\n : 1;\n const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;\n const safeEndItemLength =\n Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : safeEndItemOffset + safeEndItemLength;\n\n const contentPoint =\n safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;\n const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);\n const anchoredContentPoint =\n safeEndItemOffset + normalizedPoint * safeEndItemLength;\n return clamp(\n anchoredContentPoint - safeViewportOffset,\n 0,\n Math.max(0, safeEndContentLength - safeViewportLength)\n );\n};\n\nexport const resolveAnchoredDocumentOffset = ({\n viewportOffset,\n startScrollOffset,\n startContentLength,\n endContentLength,\n viewportLength,\n}: AnchoredDocumentOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartContentLength =\n Number.isFinite(startContentLength) && startContentLength > 0\n ? startContentLength\n : 1;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n\n const anchoredRatio = clamp(\n (safeStartScrollOffset + safeViewportOffset) / safeStartContentLength,\n 0,\n 1\n );\n\n return resolveClampedScrollOffset(\n anchoredRatio * safeEndContentLength - safeViewportOffset,\n safeEndContentLength,\n safeViewportLength\n );\n};\n\nexport const resolveClampedScrollOffset = (\n offset: number,\n contentLength: number,\n viewportLength: number\n): number => {\n const safeOffset = Number.isFinite(offset) ? offset : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n return clamp(\n safeOffset,\n 0,\n Math.max(0, safeContentLength - safeViewportLength)\n );\n};\n\nexport const resolveDocumentSurfaceWidth = ({\n viewportWidth,\n contentWidth,\n horizontalPadding,\n}: DocumentSurfaceWidthInput): number => {\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n const safeContentWidth =\n Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;\n const safeHorizontalPadding =\n Number.isFinite(horizontalPadding) && horizontalPadding > 0\n ? horizontalPadding\n : 0;\n\n return Math.max(\n safeViewportWidth,\n safeContentWidth + safeHorizontalPadding * 2\n );\n};\n\nexport const resolveGlobalHorizontalOffset = ({\n offsetX,\n surfaceWidth,\n viewportWidth,\n}: GlobalHorizontalOffsetInput): number =>\n resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);\n\nexport const resolveAnchoredHorizontalSurfaceOffset = ({\n focalViewportX,\n startSurfaceScrollX,\n startSurfaceWidth,\n endSurfaceWidth,\n viewportWidth,\n}: AnchoredHorizontalSurfaceOffsetInput): number => {\n const safeFocalViewportX = Number.isFinite(focalViewportX)\n ? focalViewportX\n : 0;\n const safeStartSurfaceScrollX = Number.isFinite(startSurfaceScrollX)\n ? startSurfaceScrollX\n : 0;\n const safeStartSurfaceWidth =\n Number.isFinite(startSurfaceWidth) && startSurfaceWidth > 0\n ? startSurfaceWidth\n : 1;\n const safeEndSurfaceWidth =\n Number.isFinite(endSurfaceWidth) && endSurfaceWidth > 0\n ? endSurfaceWidth\n : 0;\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n\n const anchoredRatio = clamp(\n (safeStartSurfaceScrollX + safeFocalViewportX) / safeStartSurfaceWidth,\n 0,\n 1\n );\n\n return resolveGlobalHorizontalOffset({\n offsetX: anchoredRatio * safeEndSurfaceWidth - safeFocalViewportX,\n surfaceWidth: safeEndSurfaceWidth,\n viewportWidth: safeViewportWidth,\n });\n};\n\nexport const resolveCenteredContentInset = ({\n viewportLength,\n contentLength,\n}: CenteredContentInsetInput): number => {\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n return Math.max(0, (safeViewportLength - safeContentLength) / 2);\n};\n\nexport const shouldSuppressPressAfterPinch = (\n lastPinchEndedAt: number | null | undefined,\n now = Date.now(),\n windowMs = PINCH_PRESS_SUPPRESSION_MS\n): boolean => {\n if (typeof lastPinchEndedAt !== \"number\") return false;\n const elapsedMs = now - lastPinchEndedAt;\n return elapsedMs >= 0 && elapsedMs < windowMs;\n};\n"],"mappings":";AA0FO,IAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AACX;AACO,IAAM,6BAA6B;AAE1C,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,mBAAmB,CAAC,YAAuC;AACtE,MAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,MAAM,IAAI;AACxB,SAAO,KAAK,MAAM,OAAO,QAAQ,MAAM,OAAO,OAAO,QAAQ,MAAM,KAAK;AAC1E;AAEO,IAAM,mBAAmB,CAAC,YAC/B,QAAQ,WAAW,KAAK,iBAAiB,OAAO,IAAI;AAE/C,IAAM,qBAAqB,CAChC,SACA,MACA,SAA0B,+BACR;AAAA,EAClB,iBAAiB,KAAK,IAAI,GAAG,iBAAiB,OAAO,CAAC;AAAA,EACtD,aAAa,MAAM,MAAM,OAAO,SAAS,OAAO,OAAO;AACzD;AAEO,IAAM,yBAAyB,CACpC,SACA,SACA,SAA0B,8BACf;AACX,QAAM,WAAW,iBAAiB,OAAO;AACzC,MAAI,YAAY,GAAG;AACjB,WAAO,MAAM,QAAQ,aAAa,OAAO,SAAS,OAAO,OAAO;AAAA,EAClE;AAEA,SAAO;AAAA,IACL,QAAQ,eAAe,WAAW,QAAQ;AAAA,IAC1C,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;AAEO,IAAM,2BAA2B,CACtC,WACA,gBACW;AACX,QAAM,gBAAgB,KAAK,IAAI,M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S,cAAc,KAAK,iBAAiB,IAAI,iBAAiB;AAC3E,QAAM,oBACJ,OAAO,SAAS,aAAa,KAAK,gBAAgB,IAAI,gBAAgB;AACxE,SAAO,KAAK,IAAI,IAAI,qBAAqB,qBAAqB,CAAC;AACjE;AAEO,IAAM,gCAAgC,CAC3C,kBACA,MAAM,KAAK,IAAI,GACf,WAAW,+BACC;AACZ,MAAI,OAAO,qBAAqB,SAAU,QAAO;AACjD,QAAM,YAAY,MAAM;AACxB,SAAO,aAAa,KAAK,YAAY;AACvC;","names":[]}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
// gesture/selectionInteraction.ts
|
|
2
|
-
var shouldAcceptSelectionRect = ({
|
|
3
|
-
width,
|
|
4
|
-
height,
|
|
5
|
-
minimumSize = 6
|
|
6
|
-
}) => width >= minimumSize || height >= minimumSize;
|
|
7
2
|
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
8
3
|
var DRAG_SELECTION_TOOLS = /* @__PURE__ */ new Set([
|
|
9
4
|
"highlight",
|
|
@@ -59,11 +54,10 @@ var getSelectionEdgeAutoscroll = ({
|
|
|
59
54
|
});
|
|
60
55
|
|
|
61
56
|
export {
|
|
62
|
-
shouldAcceptSelectionRect,
|
|
63
57
|
shouldEnableViewerScroll,
|
|
64
58
|
shouldEnableSelectionDrag,
|
|
65
59
|
isToolDockToolSelected,
|
|
66
60
|
getToolDockDismissState,
|
|
67
61
|
getSelectionEdgeAutoscroll
|
|
68
62
|
};
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-KXNP73MZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gesture/selectionInteraction.ts"],"sourcesContent":["export type ViewerScrollState = {\n selectionDragActive: boolean;\n gestureScrollLockActive?: boolean;\n};\n\nexport type SelectionGestureTool =\n | \"select\"\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n\nexport type SelectionInteractionMode = \"pan\" | \"select\";\n\nexport type SelectionGestureActivationInput = {\n activeTool: SelectionGestureTool;\n interactionMode: SelectionInteractionMode;\n};\n\nexport type ToolDockSelectionState = SelectionGestureActivationInput & {\n toolId: SelectionGestureTool;\n};\n\nexport type ToolDockDismissState = SelectionGestureActivationInput & {\n toolDockOpen: boolean;\n};\n\nexport type SelectionEdgeAutoscrollInput = {\n x: number;\n y: number;\n width: number;\n height: number;\n threshold: number;\n maxStep: number;\n};\n\nexport type SelectionEdgeAutoscroll = {\n dx: number;\n dy: number;\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nconst DRAG_SELECTION_TOOLS = new Set<SelectionGestureTool>([\n \"highlight\",\n \"underline\",\n \"squiggly\",\n \"strikeout\",\n]);\n\nconst resolveAxisAutoscroll = (\n coordinate: number,\n size: number,\n threshold: number,\n maxStep: number\n) => {\n if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;\n\n const startDistance = clamp(coordinate, 0, size);\n if (startDistance < threshold) {\n const intensity = 1 - startDistance / threshold;\n return -Math.round(maxStep * intensity);\n }\n\n const endDistance = clamp(size - coordinate, 0, size);\n if (endDistance < threshold) {\n const intensity = 1 - endDistance / threshold;\n return Math.round(maxStep * intensity);\n }\n\n return 0;\n};\n\nexport const shouldEnableViewerScroll = ({\n selectionDragActive,\n gestureScrollLockActive = false,\n}: ViewerScrollState) => !selectionDragActive && !gestureScrollLockActive;\n\nexport const shouldEnableSelectionDrag = ({\n activeTool,\n interactionMode,\n}: SelectionGestureActivationInput) =>\n DRAG_SELECTION_TOOLS.has(activeTool) ||\n (activeTool === \"select\" && interactionMode === \"select\");\n\nexport const isToolDockToolSelected = ({\n activeTool,\n interactionMode,\n toolId,\n}: ToolDockSelectionState) =>\n toolId === \"select\"\n ? activeTool === \"select\" && interactionMode === \"select\"\n : activeTool === toolId;\n\nexport const getToolDockDismissState = ({\n activeTool: _activeTool,\n interactionMode: _interactionMode,\n}: SelectionGestureActivationInput): ToolDockDismissState => ({\n toolDockOpen: false,\n activeTool: \"select\",\n interactionMode: \"pan\",\n});\n\nexport const getSelectionEdgeAutoscroll = ({\n x,\n y,\n width,\n height,\n threshold,\n maxStep,\n}: SelectionEdgeAutoscrollInput): SelectionEdgeAutoscroll => ({\n dx: resolveAxisAutoscroll(x, width, threshold, maxStep),\n dy: resolveAxisAutoscroll(y, height, threshold, maxStep),\n});\n"],"mappings":";AA4CA,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAEpC,IAAM,uBAAuB,oBAAI,IAA0B;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAwB,CAC5B,YACA,MACA,WACA,YACG;AACH,MAAI,QAAQ,KAAK,aAAa,KAAK,WAAW,EAAG,QAAO;AAExD,QAAM,gBAAgB,MAAM,YAAY,GAAG,IAAI;AAC/C,MAAI,gBAAgB,WAAW;AAC7B,UAAM,YAAY,IAAI,gBAAgB;AACtC,WAAO,CAAC,KAAK,MAAM,UAAU,SAAS;AAAA,EACxC;AAEA,QAAM,cAAc,MAAM,OAAO,YAAY,GAAG,IAAI;AACpD,MAAI,cAAc,WAAW;AAC3B,UAAM,YAAY,IAAI,cAAc;AACpC,WAAO,KAAK,MAAM,UAAU,SAAS;AAAA,EACvC;AAEA,SAAO;AACT;AAEO,IAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA,0BAA0B;AAC5B,MAAyB,CAAC,uBAAuB,CAAC;AAE3C,IAAM,4BAA4B,CAAC;AAAA,EACxC;AAAA,EACA;AACF,MACE,qBAAqB,IAAI,UAAU,KAClC,eAAe,YAAY,oBAAoB;AAE3C,IAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,MACE,WAAW,WACP,eAAe,YAAY,oBAAoB,WAC/C,eAAe;AAEd,IAAM,0BAA0B,CAAC;AAAA,EACtC,YAAY;AAAA,EACZ,iBAAiB;AACnB,OAA8D;AAAA,EAC5D,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,iBAAiB;AACnB;AAEO,IAAM,6BAA6B,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,OAA8D;AAAA,EAC5D,IAAI,sBAAsB,GAAG,OAAO,WAAW,OAAO;AAAA,EACtD,IAAI,sBAAsB,GAAG,QAAQ,WAAW,OAAO;AACzD;","names":[]}
|
|
@@ -10,6 +10,36 @@ type PinchZoomBounds = {
|
|
|
10
10
|
minZoom: number;
|
|
11
11
|
maxZoom: number;
|
|
12
12
|
};
|
|
13
|
+
type PinchInteractionState = {
|
|
14
|
+
committedZoom: number;
|
|
15
|
+
previewZoom: number;
|
|
16
|
+
focalPoint: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
startScrollX: number;
|
|
21
|
+
startScrollY: number;
|
|
22
|
+
commitCount: number;
|
|
23
|
+
outcome: "active" | "commit" | "cancel";
|
|
24
|
+
};
|
|
25
|
+
type PinchInteractionInput = {
|
|
26
|
+
committedZoom: number;
|
|
27
|
+
focalX: number;
|
|
28
|
+
focalY: number;
|
|
29
|
+
startScrollX: number;
|
|
30
|
+
startScrollY: number;
|
|
31
|
+
};
|
|
32
|
+
type PinchControllerInput = PinchInteractionInput & {
|
|
33
|
+
onPreview?: (state: PinchInteractionState) => void;
|
|
34
|
+
onCommit?: (state: PinchInteractionState) => void;
|
|
35
|
+
onCancel?: (state: PinchInteractionState) => void;
|
|
36
|
+
};
|
|
37
|
+
type PinchController = {
|
|
38
|
+
update: (previewZoom: number, bounds?: PinchZoomBounds) => void;
|
|
39
|
+
end: () => void;
|
|
40
|
+
cancel: () => void;
|
|
41
|
+
finalize: () => void;
|
|
42
|
+
};
|
|
13
43
|
type AnchoredViewportOffsetInput = {
|
|
14
44
|
viewportOffset: number;
|
|
15
45
|
startScrollOffset: number;
|
|
@@ -57,6 +87,10 @@ declare const resolvePinchZoomChange: (session: PinchSession, touches: PinchTouc
|
|
|
57
87
|
declare const resolvePinchPreviewScale: (startZoom: number, previewZoom: number) => number;
|
|
58
88
|
declare const sanitizePinchPreviewScale: (value: number) => number;
|
|
59
89
|
declare const resolvePinchGestureZoom: (startZoom: number, scaleFactor: number, bounds?: PinchZoomBounds) => number;
|
|
90
|
+
declare const createPinchInteraction: ({ committedZoom, focalX, focalY, startScrollX, startScrollY, }: PinchInteractionInput) => PinchInteractionState;
|
|
91
|
+
declare const updatePinchInteraction: (state: PinchInteractionState, previewZoom: number, bounds?: PinchZoomBounds) => PinchInteractionState;
|
|
92
|
+
declare const finishPinchInteraction: (state: PinchInteractionState, action: "end" | "finalize" | "cancel") => PinchInteractionState;
|
|
93
|
+
declare const createPinchController: ({ onPreview, onCommit, onCancel, ...input }: PinchControllerInput) => PinchController;
|
|
60
94
|
declare const resolveAnchoredViewportOffset: ({ viewportOffset, startScrollOffset, startItemOffset, startItemLength, endItemOffset, endItemLength, viewportLength, endContentLength, }: AnchoredViewportOffsetInput) => number;
|
|
61
95
|
declare const resolveAnchoredDocumentOffset: ({ viewportOffset, startScrollOffset, startContentLength, endContentLength, viewportLength, }: AnchoredDocumentOffsetInput) => number;
|
|
62
96
|
declare const resolveClampedScrollOffset: (offset: number, contentLength: number, viewportLength: number) => number;
|
|
@@ -66,4 +100,4 @@ declare const resolveAnchoredHorizontalSurfaceOffset: ({ focalViewportX, startSu
|
|
|
66
100
|
declare const resolveCenteredContentInset: ({ viewportLength, contentLength, }: CenteredContentInsetInput) => number;
|
|
67
101
|
declare const shouldSuppressPressAfterPinch: (lastPinchEndedAt: number | null | undefined, now?: number, windowMs?: number) => boolean;
|
|
68
102
|
|
|
69
|
-
export { type AnchoredDocumentOffsetInput, type AnchoredHorizontalSurfaceOffsetInput, type AnchoredViewportOffsetInput, type CenteredContentInsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, type DocumentSurfaceWidthInput, type GlobalHorizontalOffsetInput, PINCH_PRESS_SUPPRESSION_MS, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchSession, getTouchDistance, isPinchTouchList, resolveAnchoredDocumentOffset, resolveAnchoredHorizontalSurfaceOffset, resolveAnchoredViewportOffset, resolveCenteredContentInset, resolveClampedScrollOffset, resolveDocumentSurfaceWidth, resolveGlobalHorizontalOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch };
|
|
103
|
+
export { type AnchoredDocumentOffsetInput, type AnchoredHorizontalSurfaceOffsetInput, type AnchoredViewportOffsetInput, type CenteredContentInsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, type DocumentSurfaceWidthInput, type GlobalHorizontalOffsetInput, PINCH_PRESS_SUPPRESSION_MS, type PinchController, type PinchControllerInput, type PinchInteractionInput, type PinchInteractionState, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchController, createPinchInteraction, createPinchSession, finishPinchInteraction, getTouchDistance, isPinchTouchList, resolveAnchoredDocumentOffset, resolveAnchoredHorizontalSurfaceOffset, resolveAnchoredViewportOffset, resolveCenteredContentInset, resolveClampedScrollOffset, resolveDocumentSurfaceWidth, resolveGlobalHorizontalOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch, updatePinchInteraction };
|
|
@@ -10,6 +10,36 @@ type PinchZoomBounds = {
|
|
|
10
10
|
minZoom: number;
|
|
11
11
|
maxZoom: number;
|
|
12
12
|
};
|
|
13
|
+
type PinchInteractionState = {
|
|
14
|
+
committedZoom: number;
|
|
15
|
+
previewZoom: number;
|
|
16
|
+
focalPoint: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
startScrollX: number;
|
|
21
|
+
startScrollY: number;
|
|
22
|
+
commitCount: number;
|
|
23
|
+
outcome: "active" | "commit" | "cancel";
|
|
24
|
+
};
|
|
25
|
+
type PinchInteractionInput = {
|
|
26
|
+
committedZoom: number;
|
|
27
|
+
focalX: number;
|
|
28
|
+
focalY: number;
|
|
29
|
+
startScrollX: number;
|
|
30
|
+
startScrollY: number;
|
|
31
|
+
};
|
|
32
|
+
type PinchControllerInput = PinchInteractionInput & {
|
|
33
|
+
onPreview?: (state: PinchInteractionState) => void;
|
|
34
|
+
onCommit?: (state: PinchInteractionState) => void;
|
|
35
|
+
onCancel?: (state: PinchInteractionState) => void;
|
|
36
|
+
};
|
|
37
|
+
type PinchController = {
|
|
38
|
+
update: (previewZoom: number, bounds?: PinchZoomBounds) => void;
|
|
39
|
+
end: () => void;
|
|
40
|
+
cancel: () => void;
|
|
41
|
+
finalize: () => void;
|
|
42
|
+
};
|
|
13
43
|
type AnchoredViewportOffsetInput = {
|
|
14
44
|
viewportOffset: number;
|
|
15
45
|
startScrollOffset: number;
|
|
@@ -57,6 +87,10 @@ declare const resolvePinchZoomChange: (session: PinchSession, touches: PinchTouc
|
|
|
57
87
|
declare const resolvePinchPreviewScale: (startZoom: number, previewZoom: number) => number;
|
|
58
88
|
declare const sanitizePinchPreviewScale: (value: number) => number;
|
|
59
89
|
declare const resolvePinchGestureZoom: (startZoom: number, scaleFactor: number, bounds?: PinchZoomBounds) => number;
|
|
90
|
+
declare const createPinchInteraction: ({ committedZoom, focalX, focalY, startScrollX, startScrollY, }: PinchInteractionInput) => PinchInteractionState;
|
|
91
|
+
declare const updatePinchInteraction: (state: PinchInteractionState, previewZoom: number, bounds?: PinchZoomBounds) => PinchInteractionState;
|
|
92
|
+
declare const finishPinchInteraction: (state: PinchInteractionState, action: "end" | "finalize" | "cancel") => PinchInteractionState;
|
|
93
|
+
declare const createPinchController: ({ onPreview, onCommit, onCancel, ...input }: PinchControllerInput) => PinchController;
|
|
60
94
|
declare const resolveAnchoredViewportOffset: ({ viewportOffset, startScrollOffset, startItemOffset, startItemLength, endItemOffset, endItemLength, viewportLength, endContentLength, }: AnchoredViewportOffsetInput) => number;
|
|
61
95
|
declare const resolveAnchoredDocumentOffset: ({ viewportOffset, startScrollOffset, startContentLength, endContentLength, viewportLength, }: AnchoredDocumentOffsetInput) => number;
|
|
62
96
|
declare const resolveClampedScrollOffset: (offset: number, contentLength: number, viewportLength: number) => number;
|
|
@@ -66,4 +100,4 @@ declare const resolveAnchoredHorizontalSurfaceOffset: ({ focalViewportX, startSu
|
|
|
66
100
|
declare const resolveCenteredContentInset: ({ viewportLength, contentLength, }: CenteredContentInsetInput) => number;
|
|
67
101
|
declare const shouldSuppressPressAfterPinch: (lastPinchEndedAt: number | null | undefined, now?: number, windowMs?: number) => boolean;
|
|
68
102
|
|
|
69
|
-
export { type AnchoredDocumentOffsetInput, type AnchoredHorizontalSurfaceOffsetInput, type AnchoredViewportOffsetInput, type CenteredContentInsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, type DocumentSurfaceWidthInput, type GlobalHorizontalOffsetInput, PINCH_PRESS_SUPPRESSION_MS, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchSession, getTouchDistance, isPinchTouchList, resolveAnchoredDocumentOffset, resolveAnchoredHorizontalSurfaceOffset, resolveAnchoredViewportOffset, resolveCenteredContentInset, resolveClampedScrollOffset, resolveDocumentSurfaceWidth, resolveGlobalHorizontalOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch };
|
|
103
|
+
export { type AnchoredDocumentOffsetInput, type AnchoredHorizontalSurfaceOffsetInput, type AnchoredViewportOffsetInput, type CenteredContentInsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, type DocumentSurfaceWidthInput, type GlobalHorizontalOffsetInput, PINCH_PRESS_SUPPRESSION_MS, type PinchController, type PinchControllerInput, type PinchInteractionInput, type PinchInteractionState, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchController, createPinchInteraction, createPinchSession, finishPinchInteraction, getTouchDistance, isPinchTouchList, resolveAnchoredDocumentOffset, resolveAnchoredHorizontalSurfaceOffset, resolveAnchoredViewportOffset, resolveCenteredContentInset, resolveClampedScrollOffset, resolveDocumentSurfaceWidth, resolveGlobalHorizontalOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch, updatePinchInteraction };
|
|
@@ -21,7 +21,10 @@ var pinchZoom_exports = {};
|
|
|
21
21
|
__export(pinchZoom_exports, {
|
|
22
22
|
DEFAULT_PINCH_ZOOM_BOUNDS: () => DEFAULT_PINCH_ZOOM_BOUNDS,
|
|
23
23
|
PINCH_PRESS_SUPPRESSION_MS: () => PINCH_PRESS_SUPPRESSION_MS,
|
|
24
|
+
createPinchController: () => createPinchController,
|
|
25
|
+
createPinchInteraction: () => createPinchInteraction,
|
|
24
26
|
createPinchSession: () => createPinchSession,
|
|
27
|
+
finishPinchInteraction: () => finishPinchInteraction,
|
|
25
28
|
getTouchDistance: () => getTouchDistance,
|
|
26
29
|
isPinchTouchList: () => isPinchTouchList,
|
|
27
30
|
resolveAnchoredDocumentOffset: () => resolveAnchoredDocumentOffset,
|
|
@@ -35,7 +38,8 @@ __export(pinchZoom_exports, {
|
|
|
35
38
|
resolvePinchPreviewScale: () => resolvePinchPreviewScale,
|
|
36
39
|
resolvePinchZoomChange: () => resolvePinchZoomChange,
|
|
37
40
|
sanitizePinchPreviewScale: () => sanitizePinchPreviewScale,
|
|
38
|
-
shouldSuppressPressAfterPinch: () => shouldSuppressPressAfterPinch
|
|
41
|
+
shouldSuppressPressAfterPinch: () => shouldSuppressPressAfterPinch,
|
|
42
|
+
updatePinchInteraction: () => updatePinchInteraction
|
|
39
43
|
});
|
|
40
44
|
module.exports = __toCommonJS(pinchZoom_exports);
|
|
41
45
|
var DEFAULT_PINCH_ZOOM_BOUNDS = {
|
|
@@ -80,6 +84,85 @@ var resolvePinchGestureZoom = (startZoom, scaleFactor, bounds = DEFAULT_PINCH_ZO
|
|
|
80
84
|
bounds.minZoom,
|
|
81
85
|
bounds.maxZoom
|
|
82
86
|
);
|
|
87
|
+
var createPinchInteraction = ({
|
|
88
|
+
committedZoom,
|
|
89
|
+
focalX,
|
|
90
|
+
focalY,
|
|
91
|
+
startScrollX,
|
|
92
|
+
startScrollY
|
|
93
|
+
}) => {
|
|
94
|
+
const safeZoom = clamp(
|
|
95
|
+
Number.isFinite(committedZoom) && committedZoom > 0 ? committedZoom : 1,
|
|
96
|
+
DEFAULT_PINCH_ZOOM_BOUNDS.minZoom,
|
|
97
|
+
DEFAULT_PINCH_ZOOM_BOUNDS.maxZoom
|
|
98
|
+
);
|
|
99
|
+
return {
|
|
100
|
+
committedZoom: safeZoom,
|
|
101
|
+
previewZoom: safeZoom,
|
|
102
|
+
focalPoint: {
|
|
103
|
+
x: Number.isFinite(focalX) ? focalX : 0,
|
|
104
|
+
y: Number.isFinite(focalY) ? focalY : 0
|
|
105
|
+
},
|
|
106
|
+
startScrollX: Number.isFinite(startScrollX) ? startScrollX : 0,
|
|
107
|
+
startScrollY: Number.isFinite(startScrollY) ? startScrollY : 0,
|
|
108
|
+
commitCount: 0,
|
|
109
|
+
outcome: "active"
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
var updatePinchInteraction = (state, previewZoom, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => {
|
|
113
|
+
if (state.outcome !== "active") return state;
|
|
114
|
+
return {
|
|
115
|
+
...state,
|
|
116
|
+
previewZoom: clamp(
|
|
117
|
+
Number.isFinite(previewZoom) && previewZoom > 0 ? previewZoom : state.committedZoom,
|
|
118
|
+
bounds.minZoom,
|
|
119
|
+
bounds.maxZoom
|
|
120
|
+
)
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
var finishPinchInteraction = (state, action) => {
|
|
124
|
+
if (state.outcome !== "active") return state;
|
|
125
|
+
if (action === "cancel") {
|
|
126
|
+
return {
|
|
127
|
+
...state,
|
|
128
|
+
previewZoom: state.committedZoom,
|
|
129
|
+
outcome: "cancel"
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
...state,
|
|
134
|
+
committedZoom: state.previewZoom,
|
|
135
|
+
commitCount: state.commitCount + 1,
|
|
136
|
+
outcome: "commit"
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
var createPinchController = ({
|
|
140
|
+
onPreview,
|
|
141
|
+
onCommit,
|
|
142
|
+
onCancel,
|
|
143
|
+
...input
|
|
144
|
+
}) => {
|
|
145
|
+
let state = createPinchInteraction(input);
|
|
146
|
+
const update = (previewZoom, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => {
|
|
147
|
+
const next = updatePinchInteraction(state, previewZoom, bounds);
|
|
148
|
+
if (next === state) return;
|
|
149
|
+
state = next;
|
|
150
|
+
onPreview?.(state);
|
|
151
|
+
};
|
|
152
|
+
const finish = (action) => {
|
|
153
|
+
const next = finishPinchInteraction(state, action);
|
|
154
|
+
if (next === state) return;
|
|
155
|
+
state = next;
|
|
156
|
+
if (state.outcome === "cancel") onCancel?.(state);
|
|
157
|
+
else onCommit?.(state);
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
update,
|
|
161
|
+
end: () => finish("end"),
|
|
162
|
+
cancel: () => finish("cancel"),
|
|
163
|
+
finalize: () => finish("finalize")
|
|
164
|
+
};
|
|
165
|
+
};
|
|
83
166
|
var resolveAnchoredViewportOffset = ({
|
|
84
167
|
viewportOffset,
|
|
85
168
|
startScrollOffset,
|
|
@@ -198,7 +281,10 @@ var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowM
|
|
|
198
281
|
0 && (module.exports = {
|
|
199
282
|
DEFAULT_PINCH_ZOOM_BOUNDS,
|
|
200
283
|
PINCH_PRESS_SUPPRESSION_MS,
|
|
284
|
+
createPinchController,
|
|
285
|
+
createPinchInteraction,
|
|
201
286
|
createPinchSession,
|
|
287
|
+
finishPinchInteraction,
|
|
202
288
|
getTouchDistance,
|
|
203
289
|
isPinchTouchList,
|
|
204
290
|
resolveAnchoredDocumentOffset,
|
|
@@ -212,6 +298,7 @@ var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowM
|
|
|
212
298
|
resolvePinchPreviewScale,
|
|
213
299
|
resolvePinchZoomChange,
|
|
214
300
|
sanitizePinchPreviewScale,
|
|
215
|
-
shouldSuppressPressAfterPinch
|
|
301
|
+
shouldSuppressPressAfterPinch,
|
|
302
|
+
updatePinchInteraction
|
|
216
303
|
});
|
|
217
304
|
//# sourceMappingURL=pinchZoom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../gesture/pinchZoom.ts"],"sourcesContent":["export type PinchTouchPoint = {\n pageX: number;\n pageY: number;\n};\n\nexport type PinchSession = {\n initialDistance: number;\n initialZoom: number;\n};\n\nexport type PinchZoomBounds = {\n minZoom: number;\n maxZoom: number;\n};\n\nexport type AnchoredViewportOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startItemOffset: number;\n startItemLength: number;\n endItemOffset: number;\n endItemLength: number;\n viewportLength: number;\n endContentLength: number;\n};\n\nexport type AnchoredDocumentOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startContentLength: number;\n endContentLength: number;\n viewportLength: number;\n};\n\nexport type DocumentSurfaceWidthInput = {\n viewportWidth: number;\n contentWidth: number;\n horizontalPadding: number;\n};\n\nexport type GlobalHorizontalOffsetInput = {\n offsetX: number;\n surfaceWidth: number;\n viewportWidth: number;\n};\n\nexport type AnchoredHorizontalSurfaceOffsetInput = {\n focalViewportX: number;\n startSurfaceScrollX: number;\n startSurfaceWidth: number;\n endSurfaceWidth: number;\n viewportWidth: number;\n};\n\nexport type CenteredContentInsetInput = {\n viewportLength: number;\n contentLength: number;\n};\n\nexport const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds = {\n minZoom: 0.5,\n maxZoom: 4,\n};\nexport const PINCH_PRESS_SUPPRESSION_MS = 120;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nexport const getTouchDistance = (touches: PinchTouchPoint[]): number => {\n if (touches.length < 2) return 0;\n const [first, second] = touches;\n return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);\n};\n\nexport const isPinchTouchList = (touches: PinchTouchPoint[]): boolean =>\n touches.length === 2 && getTouchDistance(touches) > 0;\n\nexport const createPinchSession = (\n touches: PinchTouchPoint[],\n zoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchSession => ({\n initialDistance: Math.max(1, getTouchDistance(touches)),\n initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom),\n});\n\nexport const resolvePinchZoomChange = (\n session: PinchSession,\n touches: PinchTouchPoint[],\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number => {\n const distance = getTouchDistance(touches);\n if (distance <= 0) {\n return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);\n }\n\n return clamp(\n session.initialZoom * (distance / session.initialDistance),\n bounds.minZoom,\n bounds.maxZoom\n );\n};\n\nexport const resolvePinchPreviewScale = (\n startZoom: number,\n previewZoom: number\n): number => {\n const safeStartZoom = Math.max(0.0001, Math.abs(startZoom));\n return previewZoom / safeStartZoom;\n};\n\nexport const sanitizePinchPreviewScale = (value: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n return 1;\n }\n return value;\n};\n\nexport const resolvePinchGestureZoom = (\n startZoom: number,\n scaleFactor: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number =>\n clamp(\n (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) *\n (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),\n bounds.minZoom,\n bounds.maxZoom\n );\n\nexport const resolveAnchoredViewportOffset = ({\n viewportOffset,\n startScrollOffset,\n startItemOffset,\n startItemLength,\n endItemOffset,\n endItemLength,\n viewportLength,\n endContentLength,\n}: AnchoredViewportOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartItemOffset = Number.isFinite(startItemOffset)\n ? startItemOffset\n : 0;\n const safeStartItemLength =\n Number.isFinite(startItemLength) && startItemLength > 0\n ? startItemLength\n : 1;\n const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;\n const safeEndItemLength =\n Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : safeEndItemOffset + safeEndItemLength;\n\n const contentPoint =\n safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;\n const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);\n const anchoredContentPoint =\n safeEndItemOffset + normalizedPoint * safeEndItemLength;\n return clamp(\n anchoredContentPoint - safeViewportOffset,\n 0,\n Math.max(0, safeEndContentLength - safeViewportLength)\n );\n};\n\nexport const resolveAnchoredDocumentOffset = ({\n viewportOffset,\n startScrollOffset,\n startContentLength,\n endContentLength,\n viewportLength,\n}: AnchoredDocumentOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartContentLength =\n Number.isFinite(startContentLength) && startContentLength > 0\n ? startContentLength\n : 1;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n\n const anchoredRatio = clamp(\n (safeStartScrollOffset + safeViewportOffset) / safeStartContentLength,\n 0,\n 1\n );\n\n return resolveClampedScrollOffset(\n anchoredRatio * safeEndContentLength - safeViewportOffset,\n safeEndContentLength,\n safeViewportLength\n );\n};\n\nexport const resolveClampedScrollOffset = (\n offset: number,\n contentLength: number,\n viewportLength: number\n): number => {\n const safeOffset = Number.isFinite(offset) ? offset : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n return clamp(\n safeOffset,\n 0,\n Math.max(0, safeContentLength - safeViewportLength)\n );\n};\n\nexport const resolveDocumentSurfaceWidth = ({\n viewportWidth,\n contentWidth,\n horizontalPadding,\n}: DocumentSurfaceWidthInput): number => {\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n const safeContentWidth =\n Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;\n const safeHorizontalPadding =\n Number.isFinite(horizontalPadding) && horizontalPadding > 0\n ? horizontalPadding\n : 0;\n\n return Math.max(\n safeViewportWidth,\n safeContentWidth + safeHorizontalPadding * 2\n );\n};\n\nexport const resolveGlobalHorizontalOffset = ({\n offsetX,\n surfaceWidth,\n viewportWidth,\n}: GlobalHorizontalOffsetInput): number =>\n resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);\n\nexport const resolveAnchoredHorizontalSurfaceOffset = ({\n focalViewportX,\n startSurfaceScrollX,\n startSurfaceWidth,\n endSurfaceWidth,\n viewportWidth,\n}: AnchoredHorizontalSurfaceOffsetInput): number => {\n const safeFocalViewportX = Number.isFinite(focalViewportX)\n ? focalViewportX\n : 0;\n const safeStartSurfaceScrollX = Number.isFinite(startSurfaceScrollX)\n ? startSurfaceScrollX\n : 0;\n const safeStartSurfaceWidth =\n Number.isFinite(startSurfaceWidth) && startSurfaceWidth > 0\n ? startSurfaceWidth\n : 1;\n const safeEndSurfaceWidth =\n Number.isFinite(endSurfaceWidth) && endSurfaceWidth > 0\n ? endSurfaceWidth\n : 0;\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n\n const anchoredRatio = clamp(\n (safeStartSurfaceScrollX + safeFocalViewportX) / safeStartSurfaceWidth,\n 0,\n 1\n );\n\n return resolveGlobalHorizontalOffset({\n offsetX: anchoredRatio * safeEndSurfaceWidth - safeFocalViewportX,\n surfaceWidth: safeEndSurfaceWidth,\n viewportWidth: safeViewportWidth,\n });\n};\n\nexport const resolveCenteredContentInset = ({\n viewportLength,\n contentLength,\n}: CenteredContentInsetInput): number => {\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n return Math.max(0, (safeViewportLength - safeContentLength) / 2);\n};\n\nexport const shouldSuppressPressAfterPinch = (\n lastPinchEndedAt: number | null | undefined,\n now = Date.now(),\n windowMs = PINCH_PRESS_SUPPRESSION_MS\n): boolean => {\n if (typeof lastPinchEndedAt !== \"number\") return false;\n const elapsedMs = now - lastPinchEndedAt;\n return elapsedMs >= 0 && elapsedMs < windowMs;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DO,IAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AACX;AACO,IAAM,6BAA6B;AAE1C,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,mBAAmB,CAAC,YAAuC;AACtE,MAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,MAAM,IAAI;AACxB,SAAO,KAAK,MAAM,OAAO,QAAQ,MAAM,OAAO,OAAO,QAAQ,MAAM,KA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AAAA,EACjB,CAAC;AACH;AAEO,IAAM,8BAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AACF,MAAyC;AACvC,QAAM,qBACJ,OAAO,SAAS,cAAc,KAAK,iBAAiB,IAAI,iBAAiB;AAC3E,QAAM,oBACJ,OAAO,SAAS,aAAa,KAAK,gBAAgB,IAAI,gBAAgB;AACxE,SAAO,KAAK,IAAI,IAAI,qBAAqB,qBAAqB,CAAC;AACjE;AAEO,IAAM,gCAAgC,CAC3C,kBACA,MAAM,KAAK,IAAI,GACf,WAAW,+BACC;AACZ,MAAI,OAAO,qBAAqB,SAAU,QAAO;AACjD,QAAM,YAAY,MAAM;AACxB,SAAO,aAAa,KAAK,YAAY;AACvC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../gesture/pinchZoom.ts"],"sourcesContent":["export type PinchTouchPoint = {\n pageX: number;\n pageY: number;\n};\n\nexport type PinchSession = {\n initialDistance: number;\n initialZoom: number;\n};\n\nexport type PinchZoomBounds = {\n minZoom: number;\n maxZoom: number;\n};\n\nexport type PinchInteractionState = {\n committedZoom: number;\n previewZoom: number;\n focalPoint: { x: number; y: number };\n startScrollX: number;\n startScrollY: number;\n commitCount: number;\n outcome: \"active\" | \"commit\" | \"cancel\";\n};\n\nexport type PinchInteractionInput = {\n committedZoom: number;\n focalX: number;\n focalY: number;\n startScrollX: number;\n startScrollY: number;\n};\n\nexport type PinchControllerInput = PinchInteractionInput & {\n onPreview?: (state: PinchInteractionState) => void;\n onCommit?: (state: PinchInteractionState) => void;\n onCancel?: (state: PinchInteractionState) => void;\n};\n\nexport type PinchController = {\n update: (previewZoom: number, bounds?: PinchZoomBounds) => void;\n end: () => void;\n cancel: () => void;\n finalize: () => void;\n};\n\nexport type AnchoredViewportOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startItemOffset: number;\n startItemLength: number;\n endItemOffset: number;\n endItemLength: number;\n viewportLength: number;\n endContentLength: number;\n};\n\nexport type AnchoredDocumentOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startContentLength: number;\n endContentLength: number;\n viewportLength: number;\n};\n\nexport type DocumentSurfaceWidthInput = {\n viewportWidth: number;\n contentWidth: number;\n horizontalPadding: number;\n};\n\nexport type GlobalHorizontalOffsetInput = {\n offsetX: number;\n surfaceWidth: number;\n viewportWidth: number;\n};\n\nexport type AnchoredHorizontalSurfaceOffsetInput = {\n focalViewportX: number;\n startSurfaceScrollX: number;\n startSurfaceWidth: number;\n endSurfaceWidth: number;\n viewportWidth: number;\n};\n\nexport type CenteredContentInsetInput = {\n viewportLength: number;\n contentLength: number;\n};\n\nexport const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds = {\n minZoom: 0.5,\n maxZoom: 4,\n};\nexport const PINCH_PRESS_SUPPRESSION_MS = 120;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nexport const getTouchDistance = (touches: PinchTouchPoint[]): number => {\n if (touches.length < 2) return 0;\n const [first, second] = touches;\n return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);\n};\n\nexport const isPinchTouchList = (touches: PinchTouchPoint[]): boolean =>\n touches.length === 2 && getTouchDistance(touches) > 0;\n\nexport const createPinchSession = (\n touches: PinchTouchPoint[],\n zoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchSession => ({\n initialDistance: Math.max(1, getTouchDistance(touches)),\n initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom),\n});\n\nexport const resolvePinchZoomChange = (\n session: PinchSession,\n touches: PinchTouchPoint[],\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number => {\n const distance = getTouchDistance(touches);\n if (distance <= 0) {\n return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);\n }\n\n return clamp(\n session.initialZoom * (distance / session.initialDistance),\n bounds.minZoom,\n bounds.maxZoom\n );\n};\n\nexport const resolvePinchPreviewScale = (\n startZoom: number,\n previewZoom: number\n): number => {\n const safeStartZoom = Math.max(0.0001, Math.abs(startZoom));\n return previewZoom / safeStartZoom;\n};\n\nexport const sanitizePinchPreviewScale = (value: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n return 1;\n }\n return value;\n};\n\nexport const resolvePinchGestureZoom = (\n startZoom: number,\n scaleFactor: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number =>\n clamp(\n (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) *\n (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),\n bounds.minZoom,\n bounds.maxZoom\n );\n\nexport const createPinchInteraction = ({\n committedZoom,\n focalX,\n focalY,\n startScrollX,\n startScrollY,\n}: PinchInteractionInput): PinchInteractionState => {\n const safeZoom = clamp(\n Number.isFinite(committedZoom) && committedZoom > 0 ? committedZoom : 1,\n DEFAULT_PINCH_ZOOM_BOUNDS.minZoom,\n DEFAULT_PINCH_ZOOM_BOUNDS.maxZoom\n );\n\n return {\n committedZoom: safeZoom,\n previewZoom: safeZoom,\n focalPoint: {\n x: Number.isFinite(focalX) ? focalX : 0,\n y: Number.isFinite(focalY) ? focalY : 0,\n },\n startScrollX: Number.isFinite(startScrollX) ? startScrollX : 0,\n startScrollY: Number.isFinite(startScrollY) ? startScrollY : 0,\n commitCount: 0,\n outcome: \"active\",\n };\n};\n\nexport const updatePinchInteraction = (\n state: PinchInteractionState,\n previewZoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchInteractionState => {\n if (state.outcome !== \"active\") return state;\n return {\n ...state,\n previewZoom: clamp(\n Number.isFinite(previewZoom) && previewZoom > 0\n ? previewZoom\n : state.committedZoom,\n bounds.minZoom,\n bounds.maxZoom\n ),\n };\n};\n\nexport const finishPinchInteraction = (\n state: PinchInteractionState,\n action: \"end\" | \"finalize\" | \"cancel\"\n): PinchInteractionState => {\n if (state.outcome !== \"active\") return state;\n if (action === \"cancel\") {\n return {\n ...state,\n previewZoom: state.committedZoom,\n outcome: \"cancel\",\n };\n }\n\n return {\n ...state,\n committedZoom: state.previewZoom,\n commitCount: state.commitCount + 1,\n outcome: \"commit\",\n };\n};\n\nexport const createPinchController = ({\n onPreview,\n onCommit,\n onCancel,\n ...input\n}: PinchControllerInput): PinchController => {\n let state = createPinchInteraction(input);\n\n const update = (\n previewZoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n ) => {\n const next = updatePinchInteraction(state, previewZoom, bounds);\n if (next === state) return;\n state = next;\n onPreview?.(state);\n };\n\n const finish = (action: \"end\" | \"finalize\" | \"cancel\") => {\n const next = finishPinchInteraction(state, action);\n if (next === state) return;\n state = next;\n if (state.outcome === \"cancel\") onCancel?.(state);\n else onCommit?.(state);\n };\n\n return {\n update,\n end: () => finish(\"end\"),\n cancel: () => finish(\"cancel\"),\n finalize: () => finish(\"finalize\"),\n };\n};\n\nexport const resolveAnchoredViewportOffset = ({\n viewportOffset,\n startScrollOffset,\n startItemOffset,\n startItemLength,\n endItemOffset,\n endItemLength,\n viewportLength,\n endContentLength,\n}: AnchoredViewportOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartItemOffset = Number.isFinite(startItemOffset)\n ? startItemOffset\n : 0;\n const safeStartItemLength =\n Number.isFinite(startItemLength) && startItemLength > 0\n ? startItemLength\n : 1;\n const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;\n const safeEndItemLength =\n Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : safeEndItemOffset + safeEndItemLength;\n\n const contentPoint =\n safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;\n const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);\n const anchoredContentPoint =\n safeEndItemOffset + normalizedPoint * safeEndItemLength;\n return clamp(\n anchoredContentPoint - safeViewportOffset,\n 0,\n Math.max(0, safeEndContentLength - safeViewportLength)\n );\n};\n\nexport const resolveAnchoredDocumentOffset = ({\n viewportOffset,\n startScrollOffset,\n startContentLength,\n endContentLength,\n viewportLength,\n}: AnchoredDocumentOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartContentLength =\n Number.isFinite(startContentLength) && startContentLength > 0\n ? startContentLength\n : 1;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n\n const anchoredRatio = clamp(\n (safeStartScrollOffset + safeViewportOffset) / safeStartContentLength,\n 0,\n 1\n );\n\n return resolveClampedScrollOffset(\n anchoredRatio * safeEndContentLength - safeViewportOffset,\n safeEndContentLength,\n safeViewportLength\n );\n};\n\nexport const resolveClampedScrollOffset = (\n offset: number,\n contentLength: number,\n viewportLength: number\n): number => {\n const safeOffset = Number.isFinite(offset) ? offset : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n return clamp(\n safeOffset,\n 0,\n Math.max(0, safeContentLength - safeViewportLength)\n );\n};\n\nexport const resolveDocumentSurfaceWidth = ({\n viewportWidth,\n contentWidth,\n horizontalPadding,\n}: DocumentSurfaceWidthInput): number => {\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n const safeContentWidth =\n Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;\n const safeHorizontalPadding =\n Number.isFinite(horizontalPadding) && horizontalPadding > 0\n ? horizontalPadding\n : 0;\n\n return Math.max(\n safeViewportWidth,\n safeContentWidth + safeHorizontalPadding * 2\n );\n};\n\nexport const resolveGlobalHorizontalOffset = ({\n offsetX,\n surfaceWidth,\n viewportWidth,\n}: GlobalHorizontalOffsetInput): number =>\n resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);\n\nexport const resolveAnchoredHorizontalSurfaceOffset = ({\n focalViewportX,\n startSurfaceScrollX,\n startSurfaceWidth,\n endSurfaceWidth,\n viewportWidth,\n}: AnchoredHorizontalSurfaceOffsetInput): number => {\n const safeFocalViewportX = Number.isFinite(focalViewportX)\n ? focalViewportX\n : 0;\n const safeStartSurfaceScrollX = Number.isFinite(startSurfaceScrollX)\n ? startSurfaceScrollX\n : 0;\n const safeStartSurfaceWidth =\n Number.isFinite(startSurfaceWidth) && startSurfaceWidth > 0\n ? startSurfaceWidth\n : 1;\n const safeEndSurfaceWidth =\n Number.isFinite(endSurfaceWidth) && endSurfaceWidth > 0\n ? endSurfaceWidth\n : 0;\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n\n const anchoredRatio = clamp(\n (safeStartSurfaceScrollX + safeFocalViewportX) / safeStartSurfaceWidth,\n 0,\n 1\n );\n\n return resolveGlobalHorizontalOffset({\n offsetX: anchoredRatio * safeEndSurfaceWidth - safeFocalViewportX,\n surfaceWidth: safeEndSurfaceWidth,\n viewportWidth: safeViewportWidth,\n });\n};\n\nexport const resolveCenteredContentInset = ({\n viewportLength,\n contentLength,\n}: CenteredContentInsetInput): number => {\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n return Math.max(0, (safeViewportLength - safeContentLength) / 2);\n};\n\nexport const shouldSuppressPressAfterPinch = (\n lastPinchEndedAt: number | null | undefined,\n now = Date.now(),\n windowMs = PINCH_PRESS_SUPPRESSION_MS\n): boolean => {\n if (typeof lastPinchEndedAt !== \"number\") return false;\n const elapsedMs = now - lastPinchEndedAt;\n return elapsedMs >= 0 && elapsedMs < windowMs;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0FO,IAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AACX;AACO,IAAM,6BAA6B;AAE1C,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,mBAAmB,CAAC,YAAuC;AACtE,MAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,MAAM,IAAI;AACxB,SAAO,KAAK,MAAM,OAAO,QAAQ,MAAM,OAAO,OAAO,QAAQ,MAAM,KAAK;AAC1E;AAEO,IAAM,mBAAmB,CAAC,YAC/B,QAAQ,WAAW,KAAK,iBAAiB,OAAO,IAAI;AAE/C,IAAM,qBAAqB,CAChC,SACA,MACA,SAA0B,+BACR;AAAA,EAClB,iBAAiB,KAAK,IAAI,GAAG,iBAAiB,OAAO,CAAC;AAAA,EACtD,aAAa,MAAM,MAAM,OAAO,SAAS,OAAO,OAAO;AACzD;AAEO,IAAM,yBAAyB,CACpC,SACA,SACA,SAA0B,8BACf;AACX,QAAM,WAAW,iBAAiB,OAAO;AACzC,MAAI,YAAY,GAAG;AACjB,WAAO,MAAM,QAAQ,aAAa,OAAO,SAAS,OAAO,OAAO;AAAA,EAClE;AAEA,SAAO;AAAA,IACL,QAAQ,eAAe,WAAW,QAAQ;AAAA,IAC1C,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;AAEO,IAAM,2BAA2B,CACtC,WACA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ACF,MAAyC;AACvC,QAAM,qBACJ,OAAO,SAAS,cAAc,KAAK,iBAAiB,IAAI,iBAAiB;AAC3E,QAAM,oBACJ,OAAO,SAAS,aAAa,KAAK,gBAAgB,IAAI,gBAAgB;AACxE,SAAO,KAAK,IAAI,IAAI,qBAAqB,qBAAqB,CAAC;AACjE;AAEO,IAAM,gCAAgC,CAC3C,kBACA,MAAM,KAAK,IAAI,GACf,WAAW,+BACC;AACZ,MAAI,OAAO,qBAAqB,SAAU,QAAO;AACjD,QAAM,YAAY,MAAM;AACxB,SAAO,aAAa,KAAK,YAAY;AACvC;","names":[]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_PINCH_ZOOM_BOUNDS,
|
|
3
3
|
PINCH_PRESS_SUPPRESSION_MS,
|
|
4
|
+
createPinchController,
|
|
5
|
+
createPinchInteraction,
|
|
4
6
|
createPinchSession,
|
|
7
|
+
finishPinchInteraction,
|
|
5
8
|
getTouchDistance,
|
|
6
9
|
isPinchTouchList,
|
|
7
10
|
resolveAnchoredDocumentOffset,
|
|
@@ -15,13 +18,17 @@ import {
|
|
|
15
18
|
resolvePinchPreviewScale,
|
|
16
19
|
resolvePinchZoomChange,
|
|
17
20
|
sanitizePinchPreviewScale,
|
|
18
|
-
shouldSuppressPressAfterPinch
|
|
19
|
-
|
|
21
|
+
shouldSuppressPressAfterPinch,
|
|
22
|
+
updatePinchInteraction
|
|
23
|
+
} from "../chunk-K2ZLYLHR.mjs";
|
|
20
24
|
import "../chunk-ZD7AOCMD.mjs";
|
|
21
25
|
export {
|
|
22
26
|
DEFAULT_PINCH_ZOOM_BOUNDS,
|
|
23
27
|
PINCH_PRESS_SUPPRESSION_MS,
|
|
28
|
+
createPinchController,
|
|
29
|
+
createPinchInteraction,
|
|
24
30
|
createPinchSession,
|
|
31
|
+
finishPinchInteraction,
|
|
25
32
|
getTouchDistance,
|
|
26
33
|
isPinchTouchList,
|
|
27
34
|
resolveAnchoredDocumentOffset,
|
|
@@ -35,6 +42,7 @@ export {
|
|
|
35
42
|
resolvePinchPreviewScale,
|
|
36
43
|
resolvePinchZoomChange,
|
|
37
44
|
sanitizePinchPreviewScale,
|
|
38
|
-
shouldSuppressPressAfterPinch
|
|
45
|
+
shouldSuppressPressAfterPinch,
|
|
46
|
+
updatePinchInteraction
|
|
39
47
|
};
|
|
40
48
|
//# sourceMappingURL=pinchZoom.mjs.map
|
|
@@ -26,15 +26,10 @@ type SelectionEdgeAutoscroll = {
|
|
|
26
26
|
dx: number;
|
|
27
27
|
dy: number;
|
|
28
28
|
};
|
|
29
|
-
declare const shouldAcceptSelectionRect: ({ width, height, minimumSize, }: {
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
minimumSize?: number;
|
|
33
|
-
}) => boolean;
|
|
34
29
|
declare const shouldEnableViewerScroll: ({ selectionDragActive, gestureScrollLockActive, }: ViewerScrollState) => boolean;
|
|
35
30
|
declare const shouldEnableSelectionDrag: ({ activeTool, interactionMode, }: SelectionGestureActivationInput) => boolean;
|
|
36
31
|
declare const isToolDockToolSelected: ({ activeTool, interactionMode, toolId, }: ToolDockSelectionState) => boolean;
|
|
37
32
|
declare const getToolDockDismissState: ({ activeTool: _activeTool, interactionMode: _interactionMode, }: SelectionGestureActivationInput) => ToolDockDismissState;
|
|
38
33
|
declare const getSelectionEdgeAutoscroll: ({ x, y, width, height, threshold, maxStep, }: SelectionEdgeAutoscrollInput) => SelectionEdgeAutoscroll;
|
|
39
34
|
|
|
40
|
-
export { type SelectionEdgeAutoscroll, type SelectionEdgeAutoscrollInput, type SelectionGestureActivationInput, type SelectionGestureTool, type SelectionInteractionMode, type ToolDockDismissState, type ToolDockSelectionState, type ViewerScrollState, getSelectionEdgeAutoscroll, getToolDockDismissState, isToolDockToolSelected,
|
|
35
|
+
export { type SelectionEdgeAutoscroll, type SelectionEdgeAutoscrollInput, type SelectionGestureActivationInput, type SelectionGestureTool, type SelectionInteractionMode, type ToolDockDismissState, type ToolDockSelectionState, type ViewerScrollState, getSelectionEdgeAutoscroll, getToolDockDismissState, isToolDockToolSelected, shouldEnableSelectionDrag, shouldEnableViewerScroll };
|
|
@@ -26,15 +26,10 @@ type SelectionEdgeAutoscroll = {
|
|
|
26
26
|
dx: number;
|
|
27
27
|
dy: number;
|
|
28
28
|
};
|
|
29
|
-
declare const shouldAcceptSelectionRect: ({ width, height, minimumSize, }: {
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
minimumSize?: number;
|
|
33
|
-
}) => boolean;
|
|
34
29
|
declare const shouldEnableViewerScroll: ({ selectionDragActive, gestureScrollLockActive, }: ViewerScrollState) => boolean;
|
|
35
30
|
declare const shouldEnableSelectionDrag: ({ activeTool, interactionMode, }: SelectionGestureActivationInput) => boolean;
|
|
36
31
|
declare const isToolDockToolSelected: ({ activeTool, interactionMode, toolId, }: ToolDockSelectionState) => boolean;
|
|
37
32
|
declare const getToolDockDismissState: ({ activeTool: _activeTool, interactionMode: _interactionMode, }: SelectionGestureActivationInput) => ToolDockDismissState;
|
|
38
33
|
declare const getSelectionEdgeAutoscroll: ({ x, y, width, height, threshold, maxStep, }: SelectionEdgeAutoscrollInput) => SelectionEdgeAutoscroll;
|
|
39
34
|
|
|
40
|
-
export { type SelectionEdgeAutoscroll, type SelectionEdgeAutoscrollInput, type SelectionGestureActivationInput, type SelectionGestureTool, type SelectionInteractionMode, type ToolDockDismissState, type ToolDockSelectionState, type ViewerScrollState, getSelectionEdgeAutoscroll, getToolDockDismissState, isToolDockToolSelected,
|
|
35
|
+
export { type SelectionEdgeAutoscroll, type SelectionEdgeAutoscrollInput, type SelectionGestureActivationInput, type SelectionGestureTool, type SelectionInteractionMode, type ToolDockDismissState, type ToolDockSelectionState, type ViewerScrollState, getSelectionEdgeAutoscroll, getToolDockDismissState, isToolDockToolSelected, shouldEnableSelectionDrag, shouldEnableViewerScroll };
|
|
@@ -22,16 +22,10 @@ __export(selectionInteraction_exports, {
|
|
|
22
22
|
getSelectionEdgeAutoscroll: () => getSelectionEdgeAutoscroll,
|
|
23
23
|
getToolDockDismissState: () => getToolDockDismissState,
|
|
24
24
|
isToolDockToolSelected: () => isToolDockToolSelected,
|
|
25
|
-
shouldAcceptSelectionRect: () => shouldAcceptSelectionRect,
|
|
26
25
|
shouldEnableSelectionDrag: () => shouldEnableSelectionDrag,
|
|
27
26
|
shouldEnableViewerScroll: () => shouldEnableViewerScroll
|
|
28
27
|
});
|
|
29
28
|
module.exports = __toCommonJS(selectionInteraction_exports);
|
|
30
|
-
var shouldAcceptSelectionRect = ({
|
|
31
|
-
width,
|
|
32
|
-
height,
|
|
33
|
-
minimumSize = 6
|
|
34
|
-
}) => width >= minimumSize || height >= minimumSize;
|
|
35
29
|
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
36
30
|
var DRAG_SELECTION_TOOLS = /* @__PURE__ */ new Set([
|
|
37
31
|
"highlight",
|
|
@@ -90,7 +84,6 @@ var getSelectionEdgeAutoscroll = ({
|
|
|
90
84
|
getSelectionEdgeAutoscroll,
|
|
91
85
|
getToolDockDismissState,
|
|
92
86
|
isToolDockToolSelected,
|
|
93
|
-
shouldAcceptSelectionRect,
|
|
94
87
|
shouldEnableSelectionDrag,
|
|
95
88
|
shouldEnableViewerScroll
|
|
96
89
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../gesture/selectionInteraction.ts"],"sourcesContent":["export type ViewerScrollState = {\n selectionDragActive: boolean;\n gestureScrollLockActive?: boolean;\n};\n\nexport type SelectionGestureTool =\n | \"select\"\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n\nexport type SelectionInteractionMode = \"pan\" | \"select\";\n\nexport type SelectionGestureActivationInput = {\n activeTool: SelectionGestureTool;\n interactionMode: SelectionInteractionMode;\n};\n\nexport type ToolDockSelectionState = SelectionGestureActivationInput & {\n toolId: SelectionGestureTool;\n};\n\nexport type ToolDockDismissState = SelectionGestureActivationInput & {\n toolDockOpen: boolean;\n};\n\nexport type SelectionEdgeAutoscrollInput = {\n x: number;\n y: number;\n width: number;\n height: number;\n threshold: number;\n maxStep: number;\n};\n\nexport type SelectionEdgeAutoscroll = {\n dx: number;\n dy: number;\n};\n\
|
|
1
|
+
{"version":3,"sources":["../../gesture/selectionInteraction.ts"],"sourcesContent":["export type ViewerScrollState = {\n selectionDragActive: boolean;\n gestureScrollLockActive?: boolean;\n};\n\nexport type SelectionGestureTool =\n | \"select\"\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n\nexport type SelectionInteractionMode = \"pan\" | \"select\";\n\nexport type SelectionGestureActivationInput = {\n activeTool: SelectionGestureTool;\n interactionMode: SelectionInteractionMode;\n};\n\nexport type ToolDockSelectionState = SelectionGestureActivationInput & {\n toolId: SelectionGestureTool;\n};\n\nexport type ToolDockDismissState = SelectionGestureActivationInput & {\n toolDockOpen: boolean;\n};\n\nexport type SelectionEdgeAutoscrollInput = {\n x: number;\n y: number;\n width: number;\n height: number;\n threshold: number;\n maxStep: number;\n};\n\nexport type SelectionEdgeAutoscroll = {\n dx: number;\n dy: number;\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nconst DRAG_SELECTION_TOOLS = new Set<SelectionGestureTool>([\n \"highlight\",\n \"underline\",\n \"squiggly\",\n \"strikeout\",\n]);\n\nconst resolveAxisAutoscroll = (\n coordinate: number,\n size: number,\n threshold: number,\n maxStep: number\n) => {\n if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;\n\n const startDistance = clamp(coordinate, 0, size);\n if (startDistance < threshold) {\n const intensity = 1 - startDistance / threshold;\n return -Math.round(maxStep * intensity);\n }\n\n const endDistance = clamp(size - coordinate, 0, size);\n if (endDistance < threshold) {\n const intensity = 1 - endDistance / threshold;\n return Math.round(maxStep * intensity);\n }\n\n return 0;\n};\n\nexport const shouldEnableViewerScroll = ({\n selectionDragActive,\n gestureScrollLockActive = false,\n}: ViewerScrollState) => !selectionDragActive && !gestureScrollLockActive;\n\nexport const shouldEnableSelectionDrag = ({\n activeTool,\n interactionMode,\n}: SelectionGestureActivationInput) =>\n DRAG_SELECTION_TOOLS.has(activeTool) ||\n (activeTool === \"select\" && interactionMode === \"select\");\n\nexport const isToolDockToolSelected = ({\n activeTool,\n interactionMode,\n toolId,\n}: ToolDockSelectionState) =>\n toolId === \"select\"\n ? activeTool === \"select\" && interactionMode === \"select\"\n : activeTool === toolId;\n\nexport const getToolDockDismissState = ({\n activeTool: _activeTool,\n interactionMode: _interactionMode,\n}: SelectionGestureActivationInput): ToolDockDismissState => ({\n toolDockOpen: false,\n activeTool: \"select\",\n interactionMode: \"pan\",\n});\n\nexport const getSelectionEdgeAutoscroll = ({\n x,\n y,\n width,\n height,\n threshold,\n maxStep,\n}: SelectionEdgeAutoscrollInput): SelectionEdgeAutoscroll => ({\n dx: resolveAxisAutoscroll(x, width, threshold, maxStep),\n dy: resolveAxisAutoscroll(y, height, threshold, maxStep),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CA,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAEpC,IAAM,uBAAuB,oBAAI,IAA0B;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAwB,CAC5B,YACA,MACA,WACA,YACG;AACH,MAAI,QAAQ,KAAK,aAAa,KAAK,WAAW,EAAG,QAAO;AAExD,QAAM,gBAAgB,MAAM,YAAY,GAAG,IAAI;AAC/C,MAAI,gBAAgB,WAAW;AAC7B,UAAM,YAAY,IAAI,gBAAgB;AACtC,WAAO,CAAC,KAAK,MAAM,UAAU,SAAS;AAAA,EACxC;AAEA,QAA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