@ue-too/board 0.9.5 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -2
- package/boardify/index.d.ts +280 -9
- package/camera/base.d.ts +364 -68
- package/camera/camera-edge-auto-input.d.ts +105 -0
- package/camera/camera-mux/animation-and-lock/animation-and-lock.d.ts +316 -14
- package/camera/camera-mux/animation-and-lock/index.d.ts +27 -0
- package/camera/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +143 -60
- package/camera/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +143 -55
- package/camera/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +205 -58
- package/camera/camera-mux/index.d.ts +26 -0
- package/camera/camera-mux/interface.d.ts +161 -5
- package/camera/camera-mux/relay.d.ts +79 -16
- package/camera/camera-rig/camera-rig.d.ts +536 -94
- package/camera/camera-rig/index.d.ts +26 -1
- package/camera/camera-rig/pan-handler.d.ts +508 -48
- package/camera/camera-rig/rotation-handler.d.ts +353 -31
- package/camera/camera-rig/zoom-handler.d.ts +369 -32
- package/camera/default-camera.d.ts +173 -26
- package/camera/index.d.ts +20 -0
- package/camera/interface.d.ts +202 -2
- package/camera/update-publisher.d.ts +128 -38
- package/camera/utils/coordinate-conversion.d.ts +323 -26
- package/camera/utils/index.d.ts +22 -0
- package/camera/utils/matrix.d.ts +217 -14
- package/camera/utils/position.d.ts +249 -11
- package/camera/utils/rotation.d.ts +139 -9
- package/camera/utils/zoom.d.ts +72 -4
- package/index.d.ts +37 -0
- package/index.js +2 -4796
- package/index.js.map +39 -38
- package/input-interpretation/index.d.ts +29 -0
- package/input-interpretation/input-orchestrator.d.ts +197 -0
- package/input-interpretation/input-state-machine/index.d.ts +18 -0
- package/input-interpretation/input-state-machine/kmt-input-context.d.ts +191 -38
- package/input-interpretation/input-state-machine/kmt-input-state-machine.d.ts +201 -85
- package/input-interpretation/input-state-machine/touch-input-context.d.ts +76 -10
- package/input-interpretation/input-state-machine/touch-input-state-machine.d.ts +138 -17
- package/input-interpretation/raw-input-parser/index.d.ts +19 -0
- package/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.d.ts +107 -21
- package/input-interpretation/raw-input-parser/vanilla-touch-event-parser.d.ts +71 -8
- package/input-interpretation/raw-input-publisher/index.d.ts +18 -0
- package/input-interpretation/raw-input-publisher/raw-input-publisher.d.ts +133 -37
- package/package.json +3 -3
- package/utils/canvas-position-dimension.d.ts +282 -1
- package/utils/coordinate-conversions/canvas-viewport.d.ts +79 -0
- package/utils/coordinate-conversions/viewport-world.d.ts +101 -0
- package/utils/coordinate-conversions/window-canvas.d.ts +90 -0
- package/utils/coorindate-conversion.d.ts +91 -0
- package/utils/drawing.d.ts +151 -3
- package/utils/index.d.ts +21 -0
- package/utils/observable.d.ts +179 -0
- package/utils/ruler.d.ts +36 -0
- package/utils/zoomlevel-adjustment.d.ts +144 -8
- package/camera/camera-rig/update-batcher/index.d.ts +0 -3
- package/camera/camera-rig/update-batcher/position-update-batcher.d.ts +0 -58
- package/camera/camera-rig/update-batcher/rotation-update-batcher.d.ts +0 -54
- package/camera/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +0 -60
|
@@ -1,77 +1,414 @@
|
|
|
1
1
|
import { BoardCamera } from "../interface";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Combined configuration for zoom handler behavior, merging restriction and clamping settings.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
5
|
+
* @remarks
|
|
6
|
+
* This type combines {@link ZoomHandlerClampConfig} and {@link ZoomHandlerRestrictConfig}
|
|
7
|
+
* to provide complete control over camera zoom behavior.
|
|
8
|
+
*
|
|
9
|
+
* Zoom handlers use this configuration to:
|
|
10
|
+
* - Completely disable zoom operations (restriction)
|
|
11
|
+
* - Clamp zoom level to stay within defined limits (min/max bounds)
|
|
12
|
+
*
|
|
13
|
+
* @category Camera Rig
|
|
14
|
+
* @see {@link ZoomHandlerClampConfig} for boundary clamping options
|
|
15
|
+
* @see {@link ZoomHandlerRestrictConfig} for zoom disabling options
|
|
6
16
|
*/
|
|
7
17
|
export type ZoomHandlerConfig = ZoomHandlerClampConfig & ZoomHandlerRestrictConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for zoom level boundary clamping.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Controls whether zoom operations should be constrained to camera's zoom boundaries.
|
|
23
|
+
*
|
|
24
|
+
* When `clampZoom` is true, zoom handlers enforce {@link BoardCamera.zoomBoundaries}
|
|
25
|
+
* limits (min/max zoom levels). When false, zoom can exceed configured boundaries.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const config: ZoomHandlerClampConfig = {
|
|
30
|
+
* clampZoom: true // Enforce zoom boundaries
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* camera.zoomBoundaries = { min: 0.5, max: 4.0 };
|
|
34
|
+
* // Zoom will be clamped to [0.5, 4.0] range
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @category Camera Rig
|
|
38
|
+
*/
|
|
8
39
|
export type ZoomHandlerClampConfig = {
|
|
9
40
|
/**
|
|
10
|
-
*
|
|
41
|
+
* Whether to enforce zoom level boundaries.
|
|
11
42
|
*/
|
|
12
43
|
clampZoom: boolean;
|
|
13
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Configuration for completely disabling zoom operations.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Provides a global "zoom lock" to prevent any zoom changes.
|
|
50
|
+
*
|
|
51
|
+
* When `restrictZoom` is true:
|
|
52
|
+
* - Zoom-to operations return current zoom level (no change)
|
|
53
|
+
* - Zoom-by operations return zero delta (no change)
|
|
54
|
+
*
|
|
55
|
+
* This is useful for:
|
|
56
|
+
* - Locking zoom during specific application states
|
|
57
|
+
* - Fixed-zoom viewing modes
|
|
58
|
+
* - Preventing user zoom in certain contexts
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const config: ZoomHandlerRestrictConfig = {
|
|
63
|
+
* restrictZoom: true // Disable all zoom operations
|
|
64
|
+
* };
|
|
65
|
+
*
|
|
66
|
+
* // Any zoom attempt will be ignored
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @category Camera Rig
|
|
70
|
+
*/
|
|
14
71
|
export type ZoomHandlerRestrictConfig = {
|
|
15
72
|
/**
|
|
16
|
-
*
|
|
73
|
+
* Whether to completely prevent zoom operations.
|
|
17
74
|
*/
|
|
18
75
|
restrictZoom: boolean;
|
|
19
76
|
};
|
|
20
77
|
/**
|
|
21
|
-
*
|
|
78
|
+
* Handler function type for absolute "zoom to" camera operations.
|
|
79
|
+
*
|
|
80
|
+
* @param destination - Target zoom level
|
|
81
|
+
* @param camera - Current camera instance
|
|
82
|
+
* @param config - Zoom behavior configuration
|
|
83
|
+
* @returns Transformed zoom level (after applying restrictions and clamping)
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* Zoom-to handlers process absolute zoom level requests. They form a pipeline
|
|
87
|
+
* that can apply restrictions, clamping, and other transformations.
|
|
88
|
+
*
|
|
89
|
+
* Handler pipeline pattern:
|
|
90
|
+
* - Each handler receives the target zoom, camera state, and config
|
|
91
|
+
* - Returns a potentially modified zoom level
|
|
92
|
+
* - Handlers can be chained using {@link createHandlerChain}
|
|
22
93
|
*
|
|
23
|
-
*
|
|
94
|
+
* Common transformations:
|
|
95
|
+
* - Boundary clamping (enforce min/max zoom limits)
|
|
96
|
+
* - Zoom locking (prevent any zoom changes)
|
|
97
|
+
* - Custom zoom constraints or snapping
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const myZoomToHandler: ZoomToHandlerFunction = (target, camera, config) => {
|
|
102
|
+
* // Custom logic: snap to integer zoom levels
|
|
103
|
+
* return Math.round(target);
|
|
104
|
+
* };
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @category Camera Rig
|
|
108
|
+
* @see {@link createHandlerChain} for composing handler pipelines
|
|
109
|
+
* @see {@link createDefaultZoomToOnlyHandler} for the default implementation
|
|
24
110
|
*/
|
|
25
111
|
export type ZoomToHandlerFunction = (destination: number, camera: BoardCamera, config: ZoomHandlerConfig) => number;
|
|
26
112
|
/**
|
|
27
|
-
*
|
|
113
|
+
* Handler function type for relative "zoom by" camera operations.
|
|
114
|
+
*
|
|
115
|
+
* @param delta - Zoom level change (added to current zoom)
|
|
116
|
+
* @param camera - Current camera instance
|
|
117
|
+
* @param config - Zoom behavior configuration
|
|
118
|
+
* @returns Transformed zoom delta (after applying restrictions and clamping)
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* Zoom-by handlers process relative zoom change requests. They form a pipeline
|
|
122
|
+
* that can apply restrictions, clamping, and other transformations to the delta.
|
|
123
|
+
*
|
|
124
|
+
* Handler pipeline pattern:
|
|
125
|
+
* - Each handler receives the zoom delta, camera state, and config
|
|
126
|
+
* - Returns a potentially modified delta
|
|
127
|
+
* - Handlers can be chained using {@link createHandlerChain}
|
|
28
128
|
*
|
|
29
|
-
*
|
|
129
|
+
* Common transformations:
|
|
130
|
+
* - Boundary clamping (prevent exceeding min/max zoom)
|
|
131
|
+
* - Zoom locking (return zero delta)
|
|
132
|
+
* - Delta dampening or acceleration
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const myZoomByHandler: ZoomByHandlerFunction = (delta, camera, config) => {
|
|
137
|
+
* // Custom logic: dampen large zoom changes
|
|
138
|
+
* if (Math.abs(delta) > 1.0) {
|
|
139
|
+
* return delta * 0.5; // 50% dampening
|
|
140
|
+
* }
|
|
141
|
+
* return delta;
|
|
142
|
+
* };
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @category Camera Rig
|
|
146
|
+
* @see {@link createHandlerChain} for composing handler pipelines
|
|
147
|
+
* @see {@link createDefaultZoomByOnlyHandler} for the default implementation
|
|
30
148
|
*/
|
|
31
149
|
export type ZoomByHandlerFunction = (delta: number, camera: BoardCamera, config: ZoomHandlerConfig) => number;
|
|
32
150
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
151
|
+
* Handler pipeline step that clamps "zoom to" targets to camera zoom boundaries.
|
|
152
|
+
*
|
|
153
|
+
* @param destination - Target zoom level
|
|
154
|
+
* @param camera - Current camera instance (provides zoomBoundaries)
|
|
155
|
+
* @param config - Clamping configuration
|
|
156
|
+
* @returns Clamped zoom level
|
|
157
|
+
*
|
|
158
|
+
* @remarks
|
|
159
|
+
* This handler enforces zoom level limits on absolute zoom requests.
|
|
160
|
+
*
|
|
161
|
+
* Behavior:
|
|
162
|
+
* - If `clampZoom` is false: Returns destination unchanged
|
|
163
|
+
* - If `clampZoom` is true: Clamps destination to {@link BoardCamera.zoomBoundaries} (min/max)
|
|
35
164
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
165
|
+
* The clamping is performed by {@link clampZoomLevel}, which handles:
|
|
166
|
+
* - Missing boundaries (undefined min/max)
|
|
167
|
+
* - One-sided constraints (only min or only max)
|
|
168
|
+
* - Full range constraints
|
|
169
|
+
*
|
|
170
|
+
* Can be used standalone, but typically composed into a handler pipeline via
|
|
171
|
+
* {@link createDefaultZoomToOnlyHandler} or {@link createHandlerChain}.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* camera.zoomBoundaries = { min: 0.5, max: 3.0 };
|
|
176
|
+
*
|
|
177
|
+
* const config: ZoomHandlerClampConfig = {
|
|
178
|
+
* clampZoom: true
|
|
179
|
+
* };
|
|
180
|
+
*
|
|
181
|
+
* const target = 5.0; // Exceeds max
|
|
182
|
+
* const clamped = clampZoomToHandler(target, camera, config);
|
|
183
|
+
* // clamped = 3.0 (clamped to max boundary)
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @category Camera Rig
|
|
187
|
+
* @see {@link clampZoomLevel} for clamping implementation
|
|
188
|
+
* @see {@link createDefaultZoomToOnlyHandler} for default pipeline usage
|
|
38
189
|
*/
|
|
39
190
|
export declare function clampZoomToHandler(destination: number, camera: BoardCamera, config: ZoomHandlerClampConfig): number;
|
|
40
191
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
192
|
+
* Handler pipeline step that clamps "zoom by" deltas to prevent boundary violations.
|
|
193
|
+
*
|
|
194
|
+
* @param delta - Zoom level change
|
|
195
|
+
* @param camera - Current camera instance (provides current zoom and boundaries)
|
|
196
|
+
* @param config - Clamping configuration
|
|
197
|
+
* @returns Adjusted delta that respects zoom boundaries
|
|
198
|
+
*
|
|
199
|
+
* @remarks
|
|
200
|
+
* This handler ensures that applying the delta won't exceed zoom boundaries.
|
|
201
|
+
*
|
|
202
|
+
* Algorithm:
|
|
203
|
+
* 1. Calculate potential new zoom level (current + delta)
|
|
204
|
+
* 2. Clamp that level to boundaries
|
|
205
|
+
* 3. Return the difference (clamped - current) as the new delta
|
|
206
|
+
*
|
|
207
|
+
* Behavior:
|
|
208
|
+
* - If `clampZoom` is false: Returns delta unchanged
|
|
209
|
+
* - If `clampZoom` is true: Adjusts delta to stay within boundaries
|
|
43
210
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
211
|
+
* The resulting delta may be zero if already at a boundary and trying to zoom further.
|
|
212
|
+
*
|
|
213
|
+
* Can be used standalone, but typically composed into a handler pipeline via
|
|
214
|
+
* {@link createDefaultZoomByOnlyHandler} or {@link createHandlerChain}.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* camera.zoomLevel = 2.8;
|
|
219
|
+
* camera.zoomBoundaries = { max: 3.0 };
|
|
220
|
+
*
|
|
221
|
+
* const config: ZoomHandlerClampConfig = {
|
|
222
|
+
* clampZoom: true
|
|
223
|
+
* };
|
|
224
|
+
*
|
|
225
|
+
* const delta = 0.5; // Would exceed max
|
|
226
|
+
* const clamped = clampZoomByHandler(delta, camera, config);
|
|
227
|
+
* // clamped = 0.2 (only zoom to boundary, not beyond)
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @category Camera Rig
|
|
231
|
+
* @see {@link clampZoomLevel} for clamping implementation
|
|
232
|
+
* @see {@link createDefaultZoomByOnlyHandler} for default pipeline usage
|
|
46
233
|
*/
|
|
47
234
|
export declare function clampZoomByHandler(delta: number, camera: BoardCamera, config: ZoomHandlerClampConfig): number;
|
|
48
235
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
236
|
+
* Handler pipeline step that prevents "zoom to" operations when zoom is locked.
|
|
237
|
+
*
|
|
238
|
+
* @param destination - Target zoom level
|
|
239
|
+
* @param camera - Current camera instance
|
|
240
|
+
* @param config - Restriction configuration
|
|
241
|
+
* @returns Current zoom level (if locked) or destination (if unlocked)
|
|
242
|
+
*
|
|
243
|
+
* @remarks
|
|
244
|
+
* This handler implements a global zoom lock for absolute zoom operations.
|
|
245
|
+
*
|
|
246
|
+
* Behavior:
|
|
247
|
+
* - If `restrictZoom` is true: Returns current zoom level (prevents any change)
|
|
248
|
+
* - If `restrictZoom` is false: Returns destination unchanged
|
|
249
|
+
*
|
|
250
|
+
* Use this for:
|
|
251
|
+
* - Disabling zoom during specific application states
|
|
252
|
+
* - Fixed-zoom viewing modes
|
|
253
|
+
* - Read-only camera modes
|
|
254
|
+
*
|
|
255
|
+
* Can be used standalone, but typically composed into a handler pipeline via
|
|
256
|
+
* {@link createDefaultZoomToOnlyHandler} or {@link createHandlerChain}.
|
|
51
257
|
*
|
|
52
|
-
* @
|
|
53
|
-
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* camera.zoomLevel = 2.0;
|
|
261
|
+
*
|
|
262
|
+
* const config: ZoomHandlerRestrictConfig = {
|
|
263
|
+
* restrictZoom: true // Lock zoom
|
|
264
|
+
* };
|
|
265
|
+
*
|
|
266
|
+
* const target = 3.0;
|
|
267
|
+
* const result = restrictZoomToHandler(target, camera, config);
|
|
268
|
+
* // result = 2.0 (zoom locked, returns current level)
|
|
269
|
+
* ```
|
|
270
|
+
*
|
|
271
|
+
* @category Camera Rig
|
|
272
|
+
* @see {@link createDefaultZoomToOnlyHandler} for default pipeline usage
|
|
54
273
|
*/
|
|
55
274
|
export declare function restrictZoomToHandler(destination: number, camera: BoardCamera, config: ZoomHandlerRestrictConfig): number;
|
|
56
275
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
276
|
+
* Handler pipeline step that prevents "zoom by" operations when zoom is locked.
|
|
277
|
+
*
|
|
278
|
+
* @param delta - Zoom level change
|
|
279
|
+
* @param camera - Current camera instance
|
|
280
|
+
* @param config - Restriction configuration
|
|
281
|
+
* @returns Zero (if locked) or delta (if unlocked)
|
|
282
|
+
*
|
|
283
|
+
* @remarks
|
|
284
|
+
* This handler implements a global zoom lock for relative zoom operations.
|
|
285
|
+
*
|
|
286
|
+
* Behavior:
|
|
287
|
+
* - If `restrictZoom` is true: Returns 0 (prevents any change)
|
|
288
|
+
* - If `restrictZoom` is false: Returns delta unchanged
|
|
289
|
+
*
|
|
290
|
+
* Use this for:
|
|
291
|
+
* - Disabling zoom during specific application states
|
|
292
|
+
* - Fixed-zoom viewing modes
|
|
293
|
+
* - Read-only camera modes
|
|
294
|
+
*
|
|
295
|
+
* Can be used standalone, but typically composed into a handler pipeline via
|
|
296
|
+
* {@link createDefaultZoomByOnlyHandler} or {@link createHandlerChain}.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```typescript
|
|
300
|
+
* const config: ZoomHandlerRestrictConfig = {
|
|
301
|
+
* restrictZoom: true // Lock zoom
|
|
302
|
+
* };
|
|
59
303
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
304
|
+
* const delta = 0.5;
|
|
305
|
+
* const result = restrictZoomByHandler(delta, camera, config);
|
|
306
|
+
* // result = 0 (zoom locked, no change allowed)
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* @category Camera Rig
|
|
310
|
+
* @see {@link createDefaultZoomByOnlyHandler} for default pipeline usage
|
|
62
311
|
*/
|
|
63
312
|
export declare function restrictZoomByHandler(delta: number, camera: BoardCamera, config: ZoomHandlerRestrictConfig): number;
|
|
64
313
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* @
|
|
68
|
-
*
|
|
314
|
+
* Creates a default "zoom to" handler pipeline for absolute zoom operations.
|
|
315
|
+
*
|
|
316
|
+
* @returns Zoom-to handler function with clamping and restriction
|
|
317
|
+
*
|
|
318
|
+
* @remarks
|
|
319
|
+
* The default handler pipeline applies transformations in this order:
|
|
320
|
+
* 1. **Clamping** ({@link clampZoomToHandler}): Clamps zoom to configured boundaries
|
|
321
|
+
* 2. **Restriction** ({@link restrictZoomToHandler}): Prevents zoom if locked
|
|
322
|
+
*
|
|
323
|
+
* This ensures that:
|
|
324
|
+
* - Zoom level stays within configured min/max boundaries
|
|
325
|
+
* - Zoom can be completely disabled via `restrictZoom` flag
|
|
326
|
+
*
|
|
327
|
+
* The pipeline is specifically for zoom operations without pan compensation.
|
|
328
|
+
* For zoom-at-point operations, use {@link DefaultCameraRig.zoomToAt} which combines
|
|
329
|
+
* zoom and pan handlers.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```typescript
|
|
333
|
+
* const zoomTo = createDefaultZoomToOnlyHandler();
|
|
334
|
+
*
|
|
335
|
+
* camera.zoomBoundaries = { min: 0.5, max: 4.0 };
|
|
336
|
+
*
|
|
337
|
+
* // Use in camera rig
|
|
338
|
+
* const target = 5.0; // Exceeds max
|
|
339
|
+
* const constrained = zoomTo(target, camera, {
|
|
340
|
+
* clampZoom: true,
|
|
341
|
+
* restrictZoom: false
|
|
342
|
+
* });
|
|
343
|
+
* // constrained = 4.0 (clamped to max boundary)
|
|
344
|
+
* camera.setZoomLevel(constrained);
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* // Create custom pipeline
|
|
350
|
+
* const customZoomTo = createHandlerChain<number, [BoardCamera, ZoomHandlerConfig]>(
|
|
351
|
+
* clampZoomToHandler, // From default
|
|
352
|
+
* myCustomZoomHandler, // Your custom logic
|
|
353
|
+
* restrictZoomToHandler // From default
|
|
354
|
+
* );
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* @category Camera Rig
|
|
358
|
+
* @see {@link createHandlerChain} for creating custom handler pipelines
|
|
359
|
+
* @see {@link clampZoomToHandler} for the clamping step
|
|
360
|
+
* @see {@link restrictZoomToHandler} for the restriction step
|
|
69
361
|
*/
|
|
70
362
|
export declare function createDefaultZoomToOnlyHandler(): ZoomToHandlerFunction;
|
|
71
363
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* @
|
|
75
|
-
*
|
|
364
|
+
* Creates a default "zoom by" handler pipeline for relative zoom operations.
|
|
365
|
+
*
|
|
366
|
+
* @returns Zoom-by handler function with clamping and restriction
|
|
367
|
+
*
|
|
368
|
+
* @remarks
|
|
369
|
+
* The default handler pipeline applies transformations in this order:
|
|
370
|
+
* 1. **Clamping** ({@link clampZoomByHandler}): Adjusts delta to respect boundaries
|
|
371
|
+
* 2. **Restriction** ({@link restrictZoomByHandler}): Returns zero delta if locked
|
|
372
|
+
*
|
|
373
|
+
* This ensures that:
|
|
374
|
+
* - Resulting zoom level stays within configured min/max boundaries
|
|
375
|
+
* - Zoom can be completely disabled via `restrictZoom` flag
|
|
376
|
+
* - Delta is adjusted to prevent boundary violations
|
|
377
|
+
*
|
|
378
|
+
* The pipeline is specifically for zoom operations without pan compensation.
|
|
379
|
+
* For zoom-at-point operations, use {@link DefaultCameraRig.zoomByAt} which combines
|
|
380
|
+
* zoom and pan handlers.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* const zoomBy = createDefaultZoomByOnlyHandler();
|
|
385
|
+
*
|
|
386
|
+
* camera.zoomLevel = 3.5;
|
|
387
|
+
* camera.zoomBoundaries = { max: 4.0 };
|
|
388
|
+
*
|
|
389
|
+
* // Use in camera rig
|
|
390
|
+
* const delta = 1.0; // Would exceed max
|
|
391
|
+
* const constrained = zoomBy(delta, camera, {
|
|
392
|
+
* clampZoom: true,
|
|
393
|
+
* restrictZoom: false
|
|
394
|
+
* });
|
|
395
|
+
* // constrained = 0.5 (adjusted to reach boundary exactly)
|
|
396
|
+
* camera.setZoomLevel(camera.zoomLevel + constrained);
|
|
397
|
+
* ```
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* // Create custom pipeline with dampening
|
|
402
|
+
* const dampenedZoomBy = createHandlerChain<number, [BoardCamera, ZoomHandlerConfig]>(
|
|
403
|
+
* (delta) => delta * 0.7, // 30% dampening
|
|
404
|
+
* clampZoomByHandler, // From default
|
|
405
|
+
* restrictZoomByHandler // From default
|
|
406
|
+
* );
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* @category Camera Rig
|
|
410
|
+
* @see {@link createHandlerChain} for creating custom handler pipelines
|
|
411
|
+
* @see {@link clampZoomByHandler} for the clamping step
|
|
412
|
+
* @see {@link restrictZoomByHandler} for the restriction step
|
|
76
413
|
*/
|
|
77
414
|
export declare function createDefaultZoomByOnlyHandler(): ZoomByHandlerFunction;
|