@oh-just-another/state 0.57.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/actions/actionClipboard.d.ts +6 -0
- package/dist/actions/actionClipboard.d.ts.map +1 -0
- package/dist/actions/actionClipboard.js +26 -0
- package/dist/actions/actionClipboard.js.map +1 -0
- package/dist/actions/actionGrouping.d.ts +5 -0
- package/dist/actions/actionGrouping.d.ts.map +1 -0
- package/dist/actions/actionGrouping.js +26 -0
- package/dist/actions/actionGrouping.js.map +1 -0
- package/dist/actions/actionHistory.d.ts +5 -0
- package/dist/actions/actionHistory.d.ts.map +1 -0
- package/dist/actions/actionHistory.js +25 -0
- package/dist/actions/actionHistory.js.map +1 -0
- package/dist/actions/actionKeyboard.d.ts +3 -0
- package/dist/actions/actionKeyboard.d.ts.map +1 -0
- package/dist/actions/actionKeyboard.js +130 -0
- package/dist/actions/actionKeyboard.js.map +1 -0
- package/dist/actions/actionLayout.d.ts +3 -0
- package/dist/actions/actionLayout.d.ts.map +1 -0
- package/dist/actions/actionLayout.js +65 -0
- package/dist/actions/actionLayout.js.map +1 -0
- package/dist/actions/actionMode.d.ts +13 -0
- package/dist/actions/actionMode.d.ts.map +1 -0
- package/dist/actions/actionMode.js +116 -0
- package/dist/actions/actionMode.js.map +1 -0
- package/dist/actions/actionSelection.d.ts +9 -0
- package/dist/actions/actionSelection.d.ts.map +1 -0
- package/dist/actions/actionSelection.js +57 -0
- package/dist/actions/actionSelection.js.map +1 -0
- package/dist/actions/actionView.d.ts +7 -0
- package/dist/actions/actionView.d.ts.map +1 -0
- package/dist/actions/actionView.js +14 -0
- package/dist/actions/actionView.js.map +1 -0
- package/dist/actions/actionZOrder.d.ts +7 -0
- package/dist/actions/actionZOrder.d.ts.map +1 -0
- package/dist/actions/actionZOrder.js +42 -0
- package/dist/actions/actionZOrder.js.map +1 -0
- package/dist/actions/actionZoom.d.ts +8 -0
- package/dist/actions/actionZoom.d.ts.map +1 -0
- package/dist/actions/actionZoom.js +61 -0
- package/dist/actions/actionZoom.js.map +1 -0
- package/dist/actions/index.d.ts +12 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/registry.d.ts +68 -0
- package/dist/actions/registry.d.ts.map +1 -0
- package/dist/actions/registry.js +300 -0
- package/dist/actions/registry.js.map +1 -0
- package/dist/actions/types.d.ts +103 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/types.js +10 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/animation-tick.d.ts +28 -0
- package/dist/animation-tick.d.ts.map +1 -0
- package/dist/animation-tick.js +50 -0
- package/dist/animation-tick.js.map +1 -0
- package/dist/auto-compact.d.ts +27 -0
- package/dist/auto-compact.d.ts.map +1 -0
- package/dist/auto-compact.js +46 -0
- package/dist/auto-compact.js.map +1 -0
- package/dist/auto-layout-scheduler.d.ts +50 -0
- package/dist/auto-layout-scheduler.d.ts.map +1 -0
- package/dist/auto-layout-scheduler.js +94 -0
- package/dist/auto-layout-scheduler.js.map +1 -0
- package/dist/built-in-handlers.d.ts +24 -0
- package/dist/built-in-handlers.d.ts.map +1 -0
- package/dist/built-in-handlers.js +210 -0
- package/dist/built-in-handlers.js.map +1 -0
- package/dist/clipboard.d.ts +51 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +105 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/constants.d.ts +544 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +537 -0
- package/dist/constants.js.map +1 -0
- package/dist/dom-events.d.ts +13 -0
- package/dist/dom-events.d.ts.map +1 -0
- package/dist/dom-events.js +70 -0
- package/dist/dom-events.js.map +1 -0
- package/dist/editor/anchor-points.d.ts +22 -0
- package/dist/editor/anchor-points.d.ts.map +1 -0
- package/dist/editor/anchor-points.js +28 -0
- package/dist/editor/anchor-points.js.map +1 -0
- package/dist/editor/applies/create.d.ts +60 -0
- package/dist/editor/applies/create.d.ts.map +1 -0
- package/dist/editor/applies/create.js +107 -0
- package/dist/editor/applies/create.js.map +1 -0
- package/dist/editor/applies/edge.d.ts +32 -0
- package/dist/editor/applies/edge.d.ts.map +1 -0
- package/dist/editor/applies/edge.js +44 -0
- package/dist/editor/applies/edge.js.map +1 -0
- package/dist/editor/applies/link-move.d.ts +53 -0
- package/dist/editor/applies/link-move.d.ts.map +1 -0
- package/dist/editor/applies/link-move.js +160 -0
- package/dist/editor/applies/link-move.js.map +1 -0
- package/dist/editor/applies/move.d.ts +38 -0
- package/dist/editor/applies/move.d.ts.map +1 -0
- package/dist/editor/applies/move.js +83 -0
- package/dist/editor/applies/move.js.map +1 -0
- package/dist/editor/applies/resize.d.ts +68 -0
- package/dist/editor/applies/resize.d.ts.map +1 -0
- package/dist/editor/applies/resize.js +199 -0
- package/dist/editor/applies/resize.js.map +1 -0
- package/dist/editor/applies/selection.d.ts +34 -0
- package/dist/editor/applies/selection.d.ts.map +1 -0
- package/dist/editor/applies/selection.js +65 -0
- package/dist/editor/applies/selection.js.map +1 -0
- package/dist/editor/applies/snap-grid.d.ts +45 -0
- package/dist/editor/applies/snap-grid.d.ts.map +1 -0
- package/dist/editor/applies/snap-grid.js +90 -0
- package/dist/editor/applies/snap-grid.js.map +1 -0
- package/dist/editor/container-ops.d.ts +74 -0
- package/dist/editor/container-ops.d.ts.map +1 -0
- package/dist/editor/container-ops.js +262 -0
- package/dist/editor/container-ops.js.map +1 -0
- package/dist/editor/event-fanout.d.ts +48 -0
- package/dist/editor/event-fanout.d.ts.map +1 -0
- package/dist/editor/event-fanout.js +53 -0
- package/dist/editor/event-fanout.js.map +1 -0
- package/dist/editor/gesture-tx.d.ts +77 -0
- package/dist/editor/gesture-tx.d.ts.map +1 -0
- package/dist/editor/gesture-tx.js +93 -0
- package/dist/editor/gesture-tx.js.map +1 -0
- package/dist/editor/hit-test.d.ts +178 -0
- package/dist/editor/hit-test.d.ts.map +1 -0
- package/dist/editor/hit-test.js +460 -0
- package/dist/editor/hit-test.js.map +1 -0
- package/dist/editor/long-press.d.ts +34 -0
- package/dist/editor/long-press.d.ts.map +1 -0
- package/dist/editor/long-press.js +58 -0
- package/dist/editor/long-press.js.map +1 -0
- package/dist/editor/pinch.d.ts +37 -0
- package/dist/editor/pinch.d.ts.map +1 -0
- package/dist/editor/pinch.js +90 -0
- package/dist/editor/pinch.js.map +1 -0
- package/dist/editor/pointer-binding.d.ts +18 -0
- package/dist/editor/pointer-binding.d.ts.map +1 -0
- package/dist/editor/pointer-binding.js +1087 -0
- package/dist/editor/pointer-binding.js.map +1 -0
- package/dist/editor/public/annotations.d.ts +54 -0
- package/dist/editor/public/annotations.d.ts.map +1 -0
- package/dist/editor/public/annotations.js +106 -0
- package/dist/editor/public/annotations.js.map +1 -0
- package/dist/editor/public/arrange-group.d.ts +81 -0
- package/dist/editor/public/arrange-group.d.ts.map +1 -0
- package/dist/editor/public/arrange-group.js +193 -0
- package/dist/editor/public/arrange-group.js.map +1 -0
- package/dist/editor/public/brush.d.ts +33 -0
- package/dist/editor/public/brush.d.ts.map +1 -0
- package/dist/editor/public/brush.js +54 -0
- package/dist/editor/public/brush.js.map +1 -0
- package/dist/editor/public/clipboard.d.ts +31 -0
- package/dist/editor/public/clipboard.d.ts.map +1 -0
- package/dist/editor/public/clipboard.js +35 -0
- package/dist/editor/public/clipboard.js.map +1 -0
- package/dist/editor/public/image-insert.d.ts +30 -0
- package/dist/editor/public/image-insert.d.ts.map +1 -0
- package/dist/editor/public/image-insert.js +57 -0
- package/dist/editor/public/image-insert.js.map +1 -0
- package/dist/editor/public/layers.d.ts +56 -0
- package/dist/editor/public/layers.d.ts.map +1 -0
- package/dist/editor/public/layers.js +104 -0
- package/dist/editor/public/layers.js.map +1 -0
- package/dist/editor/public/link.d.ts +25 -0
- package/dist/editor/public/link.d.ts.map +1 -0
- package/dist/editor/public/link.js +74 -0
- package/dist/editor/public/link.js.map +1 -0
- package/dist/editor/public/placement.d.ts +60 -0
- package/dist/editor/public/placement.d.ts.map +1 -0
- package/dist/editor/public/placement.js +111 -0
- package/dist/editor/public/placement.js.map +1 -0
- package/dist/editor/public/selection-ops.d.ts +78 -0
- package/dist/editor/public/selection-ops.d.ts.map +1 -0
- package/dist/editor/public/selection-ops.js +226 -0
- package/dist/editor/public/selection-ops.js.map +1 -0
- package/dist/editor/public/text-edit.d.ts +17 -0
- package/dist/editor/public/text-edit.d.ts.map +1 -0
- package/dist/editor/public/text-edit.js +28 -0
- package/dist/editor/public/text-edit.js.map +1 -0
- package/dist/editor/public/z-order.d.ts +47 -0
- package/dist/editor/public/z-order.d.ts.map +1 -0
- package/dist/editor/public/z-order.js +151 -0
- package/dist/editor/public/z-order.js.map +1 -0
- package/dist/editor/public/zoom-pan.d.ts +44 -0
- package/dist/editor/public/zoom-pan.d.ts.map +1 -0
- package/dist/editor/public/zoom-pan.js +116 -0
- package/dist/editor/public/zoom-pan.js.map +1 -0
- package/dist/editor/render-orchestrator.d.ts +11 -0
- package/dist/editor/render-orchestrator.d.ts.map +1 -0
- package/dist/editor/render-orchestrator.js +473 -0
- package/dist/editor/render-orchestrator.js.map +1 -0
- package/dist/editor/resize-helpers.d.ts +30 -0
- package/dist/editor/resize-helpers.d.ts.map +1 -0
- package/dist/editor/resize-helpers.js +121 -0
- package/dist/editor/resize-helpers.js.map +1 -0
- package/dist/editor/shape-filters.d.ts +11 -0
- package/dist/editor/shape-filters.d.ts.map +1 -0
- package/dist/editor/shape-filters.js +19 -0
- package/dist/editor/shape-filters.js.map +1 -0
- package/dist/editor/shape-traits.d.ts +16 -0
- package/dist/editor/shape-traits.d.ts.map +1 -0
- package/dist/editor/shape-traits.js +29 -0
- package/dist/editor/shape-traits.js.map +1 -0
- package/dist/editor/viewport-helpers.d.ts +24 -0
- package/dist/editor/viewport-helpers.d.ts.map +1 -0
- package/dist/editor/viewport-helpers.js +63 -0
- package/dist/editor/viewport-helpers.js.map +1 -0
- package/dist/editor-events.d.ts +33 -0
- package/dist/editor-events.d.ts.map +1 -0
- package/dist/editor-events.js +2 -0
- package/dist/editor-events.js.map +1 -0
- package/dist/editor.d.ts +1841 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +4803 -0
- package/dist/editor.js.map +1 -0
- package/dist/file-drop.d.ts +99 -0
- package/dist/file-drop.d.ts.map +1 -0
- package/dist/file-drop.js +198 -0
- package/dist/file-drop.js.map +1 -0
- package/dist/frame-helpers.d.ts +30 -0
- package/dist/frame-helpers.d.ts.map +1 -0
- package/dist/frame-helpers.js +105 -0
- package/dist/frame-helpers.js.map +1 -0
- package/dist/group-helpers.d.ts +39 -0
- package/dist/group-helpers.d.ts.map +1 -0
- package/dist/group-helpers.js +116 -0
- package/dist/group-helpers.js.map +1 -0
- package/dist/handle.d.ts +73 -0
- package/dist/handle.d.ts.map +1 -0
- package/dist/handle.js +184 -0
- package/dist/handle.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive.d.ts +21 -0
- package/dist/interactive.d.ts.map +1 -0
- package/dist/interactive.js +11 -0
- package/dist/interactive.js.map +1 -0
- package/dist/link-selection.d.ts +21 -0
- package/dist/link-selection.d.ts.map +1 -0
- package/dist/link-selection.js +37 -0
- package/dist/link-selection.js.map +1 -0
- package/dist/machine.d.ts +322 -0
- package/dist/machine.d.ts.map +1 -0
- package/dist/machine.js +568 -0
- package/dist/machine.js.map +1 -0
- package/dist/modes.d.ts +24 -0
- package/dist/modes.d.ts.map +1 -0
- package/dist/modes.js +2 -0
- package/dist/modes.js.map +1 -0
- package/dist/overlay.d.ts +262 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +673 -0
- package/dist/overlay.js.map +1 -0
- package/dist/platform.d.ts +70 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +115 -0
- package/dist/platform.js.map +1 -0
- package/dist/selection.d.ts +18 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/selection.js +31 -0
- package/dist/selection.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tunable constants for the interaction layer (`Editor`, interaction
|
|
3
|
+
* machine, snap engine, viewport math). Put any threshold / default /
|
|
4
|
+
* timing the host might want to tweak here — keep magic numbers out
|
|
5
|
+
* of the hot path code.
|
|
6
|
+
*/
|
|
7
|
+
import type { ArrowheadStyle, LinkRouting } from "@oh-just-another/scene";
|
|
8
|
+
/**
|
|
9
|
+
* World-unit distance below which a snap candidate is preferred over
|
|
10
|
+
* the raw cursor position. Smaller → snap feels less "grabby", larger
|
|
11
|
+
* → easier to land on a target but more disruptive drag micro-jumps.
|
|
12
|
+
* 12 px is the default for a 1:1 zoom; the engine internally scales
|
|
13
|
+
* by zoom so the effective screen distance stays roughly constant.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_SNAP_THRESHOLD = 12;
|
|
16
|
+
/**
|
|
17
|
+
* Routing of a newly created link. `"orthogonal"` (elbow) is the default —
|
|
18
|
+
* matches the flowchart-style connectors users expect. Set to `"straight"` or
|
|
19
|
+
* `"bezier"` to change the default for new links; the per-link toolbar can
|
|
20
|
+
* still switch any individual link afterwards.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_LINK_ROUTING: LinkRouting;
|
|
23
|
+
/** Arrowhead on the `to` end of a newly created link. */
|
|
24
|
+
export declare const DEFAULT_LINK_ARROWHEAD: ArrowheadStyle;
|
|
25
|
+
/**
|
|
26
|
+
* Padding ratio added to the world-space viewport rect before passing
|
|
27
|
+
* it to `renderScene` for culling. 0.05 = 5% padding on each side —
|
|
28
|
+
* masks a one-frame pan so shapes near the edge do not flicker.
|
|
29
|
+
* Increase if hosts observe pop-in on fast pans; decrease to keep
|
|
30
|
+
* fewer off-screen shapes alive in the renderer pipeline.
|
|
31
|
+
*/
|
|
32
|
+
export declare const VIEWPORT_CULL_PADDING_RATIO = 0.05;
|
|
33
|
+
/**
|
|
34
|
+
* Screen-pixel half-size of the visible resize-handle square. Handles
|
|
35
|
+
* are drawn `HANDLE_SIZE * 2` wide (5 → 10×10 px). Purely visual — the
|
|
36
|
+
* grab area is `HANDLE_HIT_SLOP`, decoupled from this. Reasonable
|
|
37
|
+
* range: 4–6 (smaller looks lighter; larger reads heavy).
|
|
38
|
+
*/
|
|
39
|
+
export declare const HANDLE_SIZE = 5;
|
|
40
|
+
/**
|
|
41
|
+
* Screen-pixel offset between the handle's centre and the shape's bbox
|
|
42
|
+
* edge — pushes the handle just outside the body so its hit area never
|
|
43
|
+
* overlaps the shape interior, making corners grabbable without
|
|
44
|
+
* precision-pointing. Range: 2–4.
|
|
45
|
+
*/
|
|
46
|
+
export declare const HANDLE_OUTSET = 3;
|
|
47
|
+
/**
|
|
48
|
+
* Screen-pixel hit-test half-size (mouse) for a resize handle —
|
|
49
|
+
* decoupled from the visual `HANDLE_SIZE`/`HANDLE_OUTSET` so the
|
|
50
|
+
* grab target can grow without enlarging the drawn square. 11 → a
|
|
51
|
+
* ~22 px clickable target around each handle centre. Touch hosts use
|
|
52
|
+
* the larger `TOUCH_HANDLE_HIT_SLOP`. Range: 8–14 (too large starts
|
|
53
|
+
* eating the body-move target on small shapes).
|
|
54
|
+
*/
|
|
55
|
+
export declare const HANDLE_HIT_SLOP = 11;
|
|
56
|
+
/**
|
|
57
|
+
* Screen-pixel hit-test slop for grabbing an edge endpoint handle.
|
|
58
|
+
* Larger than `LINK_ENDPOINT_HANDLE_DRAW_RADIUS` so the handle is
|
|
59
|
+
* easier to grab on touch without enlarging the visual. Mouse default
|
|
60
|
+
* (touch uses `TOUCH_LINK_HANDLE_HIT_SLOP`). Range: 9–13.
|
|
61
|
+
*/
|
|
62
|
+
export declare const LINK_ENDPOINT_HANDLE_RADIUS = 11;
|
|
63
|
+
/**
|
|
64
|
+
* Screen-pixel visual radius of the edge endpoint handle. Kept
|
|
65
|
+
* smaller than the hit radius so the dot does not obscure the path
|
|
66
|
+
* tangent it sits on.
|
|
67
|
+
*/
|
|
68
|
+
export declare const LINK_ENDPOINT_HANDLE_DRAW_RADIUS = 6;
|
|
69
|
+
/**
|
|
70
|
+
* Screen-pixel visual radius of a segment-midpoint "add waypoint" handle
|
|
71
|
+
* on the selected link. Smaller than an endpoint/waypoint handle so the
|
|
72
|
+
* insert affordance reads as secondary. Range: 3–5.
|
|
73
|
+
*/
|
|
74
|
+
export declare const LINK_MIDPOINT_HANDLE_DRAW_RADIUS = 4;
|
|
75
|
+
/**
|
|
76
|
+
* Screen-pixel radius within which releasing a dragged waypoint next to an
|
|
77
|
+
* adjacent path point collapses (removes) it — "drag onto the line to
|
|
78
|
+
* delete". Kept near the handle hit radius. Range: 8–16.
|
|
79
|
+
*/
|
|
80
|
+
export declare const WAYPOINT_COLLAPSE_RADIUS = 12;
|
|
81
|
+
/**
|
|
82
|
+
* Upper bound on how many candidate obstacles the A*-based "route around
|
|
83
|
+
* shapes" command will consider. Above this the command bails (returns the
|
|
84
|
+
* link unchanged) rather than spending the A* cost. Range: 100–1000.
|
|
85
|
+
*/
|
|
86
|
+
export declare const AUTO_ROUTE_MAX_OBSTACLES = 400;
|
|
87
|
+
/**
|
|
88
|
+
* Screen-pixel tolerance for edge hit-testing. Cursors within this
|
|
89
|
+
* distance of an edge polyline segment register a hit. Should stay
|
|
90
|
+
* larger than the typical stroke width but small enough that two
|
|
91
|
+
* close edges don't both register the same click. Mouse default
|
|
92
|
+
* (touch uses `TOUCH_LINK_HIT_THRESHOLD`). Range: 7–11.
|
|
93
|
+
*/
|
|
94
|
+
export declare const LINK_HIT_THRESHOLD = 9;
|
|
95
|
+
/**
|
|
96
|
+
* How far (screen px) the selection halo peeks out beyond an object's
|
|
97
|
+
* VISIBLE outer edge — shared by elements and links. The halo is sized so
|
|
98
|
+
* it always shows exactly this much past the shape's contour + its border
|
|
99
|
+
* extent (which depends on stroke width and inside/center/outside
|
|
100
|
+
* alignment), at every zoom. Constant on screen regardless of border
|
|
101
|
+
* thickness. Range: 3–8.
|
|
102
|
+
*/
|
|
103
|
+
export declare const SELECTION_HALO_PEEK_PX = 4;
|
|
104
|
+
/**
|
|
105
|
+
* Screen-pixel radius of the inactive port dot rendered on a hovered
|
|
106
|
+
* shape in draw-edge mode. `PORT_DOT_ACTIVE_RADIUS` is used for the
|
|
107
|
+
* snap target so the user sees which one will catch.
|
|
108
|
+
*/
|
|
109
|
+
export declare const PORT_DOT_RADIUS = 3.5;
|
|
110
|
+
export declare const PORT_DOT_ACTIVE_RADIUS = 5;
|
|
111
|
+
/**
|
|
112
|
+
* Connection anchors.
|
|
113
|
+
*
|
|
114
|
+
* Two visual roles, shown at different times:
|
|
115
|
+
*
|
|
116
|
+
* - **link-start** anchors — shown when an element is SELECTED. The user
|
|
117
|
+
* drags from one to begin a link. Filled brand centre + neutral ring.
|
|
118
|
+
* - **link-attach** anchors — shown when the cursor HOVERS / nears an
|
|
119
|
+
* element (including while dragging a link). Where a link can land.
|
|
120
|
+
* The inverse fill/ring of link-start, so the two roles read
|
|
121
|
+
* differently at a glance.
|
|
122
|
+
*
|
|
123
|
+
* Radii are screen px (zoom-independent). Colours reuse the selection
|
|
124
|
+
* brand blue / handle white so anchors share the resize-handle visual
|
|
125
|
+
* language (they equal `DEFAULT_OVERLAY_STYLE.selectionStroke` / `.handleFill`).
|
|
126
|
+
*/
|
|
127
|
+
export declare const ANCHOR_BRAND_COLOR = "#1a73e8";
|
|
128
|
+
export declare const ANCHOR_NEUTRAL_COLOR = "#fff";
|
|
129
|
+
/** Resting anchor-dot radius (screen px). */
|
|
130
|
+
export declare const ANCHOR_DOT_RADIUS = 3.5;
|
|
131
|
+
/** Highlighted radius for the hovered / snap-target anchor (screen px). */
|
|
132
|
+
export declare const ANCHOR_DOT_ACTIVE_RADIUS = 5;
|
|
133
|
+
/**
|
|
134
|
+
* Max radius (screen px) of the nearest link-start dot at closest cursor
|
|
135
|
+
* approach. The dot scales smoothly from {@link ANCHOR_DOT_RADIUS} up to this
|
|
136
|
+
* as the cursor enters {@link ANCHOR_DOT_HOVER_GROW_RADIUS} ("grows as you
|
|
137
|
+
* approach"), instead of a binary jump to the active radius.
|
|
138
|
+
*/
|
|
139
|
+
export declare const ANCHOR_DOT_HOVER_MAX_RADIUS = 8;
|
|
140
|
+
/** Ring stroke width for anchor dots (screen px). Range: 1–2.5. */
|
|
141
|
+
export declare const ANCHOR_DOT_STROKE_WIDTH = 1.5;
|
|
142
|
+
/** link-start dot: filled brand centre, neutral (white) ring. */
|
|
143
|
+
export declare const LINK_START_ANCHOR_FILL = "#1a73e8";
|
|
144
|
+
export declare const LINK_START_ANCHOR_STROKE = "#fff";
|
|
145
|
+
/** link-attach dot: neutral (white) centre, brand ring — inverse of start. */
|
|
146
|
+
export declare const LINK_ATTACH_ANCHOR_FILL = "#fff";
|
|
147
|
+
export declare const LINK_ATTACH_ANCHOR_STROKE = "#1a73e8";
|
|
148
|
+
/**
|
|
149
|
+
* Screen-px distance each anchor dot is pushed OUTWARD from the element
|
|
150
|
+
* edge along its outward normal ("floating" ports). Two independent knobs
|
|
151
|
+
* because the roles want different offsets:
|
|
152
|
+
*
|
|
153
|
+
* - **link-start** sits off the edge so it reads as a separate grab
|
|
154
|
+
* affordance ("drag from here"), clear of the element's own border and
|
|
155
|
+
* resize handles. Range: 0–28.
|
|
156
|
+
* - **link-attach** stays ON (or barely off) the edge because it marks
|
|
157
|
+
* where the link will actually land — a large offset re-introduces the
|
|
158
|
+
* dot-vs-landing-point mismatch. Default 0 (exactly on the edge); bump
|
|
159
|
+
* only if dots are hard to see. Range: 0–8.
|
|
160
|
+
*
|
|
161
|
+
* Applied only to the discrete named / edge anchor dots; the free
|
|
162
|
+
* outline-attach point is never offset (it is the real landing point).
|
|
163
|
+
*/
|
|
164
|
+
export declare const LINK_START_ANCHOR_OUTSET = 20;
|
|
165
|
+
export declare const LINK_ATTACH_ANCHOR_OUTSET = 0;
|
|
166
|
+
/**
|
|
167
|
+
* Default body fill for a freshly-created frame. Frames must have a
|
|
168
|
+
* background (no element is background-less); white reads on most canvases.
|
|
169
|
+
* Carried in `style.fill` at creation so the property panel shows it and it
|
|
170
|
+
* serialises; the renderer falls back to the same white if ever unset.
|
|
171
|
+
*/
|
|
172
|
+
export declare const FRAME_DEFAULT_FILL = "#ffffff";
|
|
173
|
+
/**
|
|
174
|
+
* Screen-px slop ADDED to `ANCHOR_DOT_ACTIVE_RADIUS` when hit-testing a
|
|
175
|
+
* press against a link-start anchor dot — the "drag a link straight from
|
|
176
|
+
* the dot" gesture (no draw-edge tool needed). Mirrors `HANDLE_HIT_SLOP`
|
|
177
|
+
* for resize handles: lets the user grab the small dot without pixel-
|
|
178
|
+
* precision pointing. Grab radius = `ANCHOR_DOT_ACTIVE_RADIUS + this`,
|
|
179
|
+
* divided by zoom. Range: 3–10 (too large starts stealing the body-drag
|
|
180
|
+
* target near the element edge).
|
|
181
|
+
*/
|
|
182
|
+
export declare const ANCHOR_START_HIT_SLOP = 6;
|
|
183
|
+
/**
|
|
184
|
+
* Narrow hit radius (screen px) for "clicked exactly ON a link-start dot"
|
|
185
|
+
* — distinct from the wider grab halo (`ANCHOR_DOT_ACTIVE_RADIUS +
|
|
186
|
+
* ANCHOR_START_HIT_SLOP`) that begins a drag/deselect. A non-dragging
|
|
187
|
+
* release within this radius of a dot means "create a new element + link";
|
|
188
|
+
* a release in the surrounding halo but outside this radius deselects. Kept
|
|
189
|
+
* ≤ the grab radius so the create zone sits inside it.
|
|
190
|
+
*/
|
|
191
|
+
export declare const ANCHOR_DOT_CLICK_RADIUS = 7;
|
|
192
|
+
/**
|
|
193
|
+
* Screen-px proximity at which the nearest link-start dot is "grown"
|
|
194
|
+
* (rendered at `ANCHOR_DOT_ACTIVE_RADIUS` instead of the resting radius)
|
|
195
|
+
* as the cursor approaches it — the dot's affordance hint. Kept ≥
|
|
196
|
+
* the grab radius so the dot visibly grows slightly before it becomes
|
|
197
|
+
* grabbable. Range: 12–28.
|
|
198
|
+
*/
|
|
199
|
+
export declare const ANCHOR_DOT_HOVER_GROW_RADIUS = 18;
|
|
200
|
+
/**
|
|
201
|
+
* World-px gap between a selected element and the new element created by
|
|
202
|
+
* clicking one of its link-start dots (click a dot → spawn a copy in that
|
|
203
|
+
* dot's direction, linked). Fixed, independent of element size.
|
|
204
|
+
*/
|
|
205
|
+
export declare const ANCHOR_CLICK_NEW_ELEMENT_GAP = 40;
|
|
206
|
+
/**
|
|
207
|
+
* Debug hit-zone overlay (debug panel → Display → "Show hit-zones" /
|
|
208
|
+
* `?hitzones=1`). Visualises the mouse hit-targets so the values tuned in
|
|
209
|
+
* this layer can be eyeballed in the browser. `_FILL_OPACITY` keeps the
|
|
210
|
+
* translucent fill from hiding the geometry underneath; `_STROKE_OPACITY`
|
|
211
|
+
* outlines each zone. Pure debug — never drawn unless the flag is on.
|
|
212
|
+
*
|
|
213
|
+
* Shared opacities; per-category colours below so different hit-target kinds
|
|
214
|
+
* are visually distinguishable (point vs edge vs body vs container vs frame).
|
|
215
|
+
* Kept generic (`DEBUG_HIT_ZONE_FILL`/`STROKE`) as the alias for the
|
|
216
|
+
* resize-handle category and any uncoloured fallback.
|
|
217
|
+
*/
|
|
218
|
+
export declare const DEBUG_HIT_ZONE_FILL = "#e8118c";
|
|
219
|
+
export declare const DEBUG_HIT_ZONE_STROKE = "#e8118c";
|
|
220
|
+
export declare const DEBUG_HIT_ZONE_FILL_OPACITY = 0.16;
|
|
221
|
+
export declare const DEBUG_HIT_ZONE_STROKE_OPACITY = 0.7;
|
|
222
|
+
/**
|
|
223
|
+
* Per-category debug hit-zone colours. One hue per hit-target kind so the
|
|
224
|
+
* overlay reads as a legend. Each colour is used for
|
|
225
|
+
* BOTH the translucent fill and the outline of its zones.
|
|
226
|
+
*
|
|
227
|
+
* - `_RESIZE` — resize-handle slop squares (magenta).
|
|
228
|
+
* - `_LINK_BODY` — link body select band (amber).
|
|
229
|
+
* - `_LINK_HANDLE` — selected link's endpoint / waypoint / segment handles (blue).
|
|
230
|
+
* - `_ANCHOR_START` — selected element's link-start dots (green).
|
|
231
|
+
* - `_ATTACH_POINT` — link-attach named/edge anchor catchments, L1/L2 (cyan).
|
|
232
|
+
* - `_ATTACH_EDGE` — link-attach outline band, L3 (purple).
|
|
233
|
+
* - `_ATTACH_BODY` — link-attach floating-on-body region, L4 (yellow).
|
|
234
|
+
* - `_FRAME` — frame membership zone, E1 (red).
|
|
235
|
+
* - `_CONTAINER` — container drop-zone, E2–E4 (teal).
|
|
236
|
+
*/
|
|
237
|
+
export declare const DEBUG_ZONE_RESIZE = "#e8118c";
|
|
238
|
+
export declare const DEBUG_ZONE_LINK_BODY = "#f59e0b";
|
|
239
|
+
export declare const DEBUG_ZONE_LINK_HANDLE = "#2563eb";
|
|
240
|
+
export declare const DEBUG_ZONE_ANCHOR_START = "#16a34a";
|
|
241
|
+
export declare const DEBUG_ZONE_ATTACH_POINT = "#06b6d4";
|
|
242
|
+
export declare const DEBUG_ZONE_ATTACH_EDGE = "#a855f7";
|
|
243
|
+
export declare const DEBUG_ZONE_ATTACH_BODY = "#eab308";
|
|
244
|
+
export declare const DEBUG_ZONE_FRAME = "#dc2626";
|
|
245
|
+
export declare const DEBUG_ZONE_CONTAINER = "#14b8a6";
|
|
246
|
+
/** Annotation-pin grab radius (rose). Group-handle slop reuses `_RESIZE`. */
|
|
247
|
+
export declare const DEBUG_ZONE_ANNOTATION = "#f43f5e";
|
|
248
|
+
/**
|
|
249
|
+
* Visual sizes for the remote-peer cursor overlay.
|
|
250
|
+
*
|
|
251
|
+
* - `CURSOR_ARROW_SIZE` — pixel side length of the arrow glyph.
|
|
252
|
+
* - `CURSOR_NAME_CHIP_OFFSET` — pixel offset of the name chip from
|
|
253
|
+
* the arrow tip, both axes.
|
|
254
|
+
* - `CURSOR_NAME_CHIP_PADDING_X / Y` — inner padding of the chip.
|
|
255
|
+
* - `CURSOR_NAME_FONT_SIZE` — chip text font size.
|
|
256
|
+
*/
|
|
257
|
+
export declare const CURSOR_ARROW_SIZE = 16;
|
|
258
|
+
export declare const CURSOR_NAME_CHIP_OFFSET = 14;
|
|
259
|
+
export declare const CURSOR_NAME_CHIP_PADDING_X = 6;
|
|
260
|
+
export declare const CURSOR_NAME_CHIP_PADDING_Y = 3;
|
|
261
|
+
export declare const CURSOR_NAME_FONT_SIZE = 11;
|
|
262
|
+
/**
|
|
263
|
+
* Peer selection halo — dashed outline drawn around each shape a peer
|
|
264
|
+
* has selected, in the peer's colour. `PEER_SELECTION_PADDING` insets
|
|
265
|
+
* the outline outward so it does not overlap own selection.
|
|
266
|
+
*/
|
|
267
|
+
export declare const PEER_SELECTION_STROKE_WIDTH = 1.5;
|
|
268
|
+
export declare const PEER_SELECTION_DASH: readonly number[];
|
|
269
|
+
export declare const PEER_SELECTION_PADDING = 3;
|
|
270
|
+
/**
|
|
271
|
+
* Throttle for broadcasting local pointer position to peers. 30 fps
|
|
272
|
+
* matches the perceptual cap for cursor motion; lower values create
|
|
273
|
+
* more network chatter without UX benefit.
|
|
274
|
+
*/
|
|
275
|
+
export declare const PEER_CURSOR_BROADCAST_INTERVAL_MS = 33;
|
|
276
|
+
/**
|
|
277
|
+
* Mouse-wheel handling.
|
|
278
|
+
*
|
|
279
|
+
* - `WHEEL_PAN_FACTOR` — how many world units (at zoom 1) to pan per
|
|
280
|
+
* wheel notch when the handler routes the wheel event to pan
|
|
281
|
+
* (trackpad two-finger swipe). 1 = native pixel; lower than 1
|
|
282
|
+
* makes the wheel feel sluggish on high-DPI mice.
|
|
283
|
+
* - `WHEEL_ZOOM_STEP` — multiplicative zoom factor used by the
|
|
284
|
+
* programmatic button-style zoom (`Editor.zoomIn` / `zoomOut`).
|
|
285
|
+
* `1.6 = +60% per call` — punchy single-step zoom.
|
|
286
|
+
* - `WHEEL_ZOOM_MAX_STEP` / `WHEEL_ZOOM_SPEED` — wheel-zoom
|
|
287
|
+
* normalisation (`packages/editor/.../normalizeWheel.ts`).
|
|
288
|
+
* Per event:
|
|
289
|
+
*
|
|
290
|
+
* delta = clamp(|deltaY|, WHEEL_ZOOM_MAX_STEP) * sign(deltaY)
|
|
291
|
+
* factor = 1 − (delta * WHEEL_ZOOM_SPEED) / 100
|
|
292
|
+
*
|
|
293
|
+
* The clamp tames mouse-wheel ratchets (Firefox / Chrome emit
|
|
294
|
+
* `|deltaY|` 53 / 100 per notch — uncapped that yields a near-10×
|
|
295
|
+
* jump). Trackpad pinches come through with small `|deltaY|`
|
|
296
|
+
* (2–5) and bypass the clamp, so they stay smooth and granular.
|
|
297
|
+
* Defaults: clamp at 10, speed 1 → ~10 % per mouse notch,
|
|
298
|
+
* ~2 % per pinch frame.
|
|
299
|
+
* - `MIN_ZOOM` / `MAX_ZOOM` — hard caps. Below MIN_ZOOM (very far
|
|
300
|
+
* out) culling/LOD save the frame; above MAX_ZOOM pixel-snapping
|
|
301
|
+
* artefacts appear.
|
|
302
|
+
*
|
|
303
|
+
* Device classification in the wheel handler is `deltaX`-based —
|
|
304
|
+
* mouse wheels never set deltaX, so any horizontal component routes
|
|
305
|
+
* to pan and pure-vertical routes to zoom. Pure-vertical trackpad
|
|
306
|
+
* swipes (rare) fall into zoom; users can pan via Space+drag or
|
|
307
|
+
* right-click drag if needed.
|
|
308
|
+
*/
|
|
309
|
+
export declare const WHEEL_PAN_FACTOR = 1;
|
|
310
|
+
export declare const WHEEL_ZOOM_STEP = 1.6;
|
|
311
|
+
export declare const WHEEL_ZOOM_MAX_STEP = 10;
|
|
312
|
+
export declare const WHEEL_ZOOM_SPEED = 1;
|
|
313
|
+
export declare const MIN_ZOOM = 0.05;
|
|
314
|
+
export declare const MAX_ZOOM = 32;
|
|
315
|
+
/**
|
|
316
|
+
* Two-finger pinch / pan gesture.
|
|
317
|
+
*
|
|
318
|
+
* - `PINCH_MIN_MOVEMENT_PX` — ignore minor jitter while two fingers
|
|
319
|
+
* stay roughly still (e.g. user resting both fingers on screen).
|
|
320
|
+
* Below this displacement the gesture frame is a no-op.
|
|
321
|
+
*/
|
|
322
|
+
export declare const PINCH_MIN_MOVEMENT_PX = 0.5;
|
|
323
|
+
/**
|
|
324
|
+
* Long-press → context menu. `LONG_PRESS_DELAY_MS` is the dwell time
|
|
325
|
+
* before a stationary press fires a `LONG_PRESS` emit; movement
|
|
326
|
+
* beyond `LONG_PRESS_MAX_MOVEMENT_PX` cancels it.
|
|
327
|
+
*/
|
|
328
|
+
export declare const LONG_PRESS_DELAY_MS = 500;
|
|
329
|
+
export declare const LONG_PRESS_MAX_MOVEMENT_PX = 8;
|
|
330
|
+
/**
|
|
331
|
+
* Double-click recognition for group drill-down. A second pointer-up
|
|
332
|
+
* within `DOUBLE_CLICK_MS` of the previous AND landing within
|
|
333
|
+
* `DOUBLE_CLICK_TOLERANCE_PX` of the first point counts as a double-
|
|
334
|
+
* click. Matches OS-level double-click windows (Windows default
|
|
335
|
+
* 500 ms is too lenient for canvas; 300 ms feels snappier).
|
|
336
|
+
*/
|
|
337
|
+
export declare const DOUBLE_CLICK_MS = 300;
|
|
338
|
+
export declare const DOUBLE_CLICK_TOLERANCE_PX = 8;
|
|
339
|
+
/**
|
|
340
|
+
* Multiplier applied to non-isolated shapes' globalAlpha when the
|
|
341
|
+
* editor is in "entered group" mode (isolation). Shapes inside the
|
|
342
|
+
* entered group stay at full alpha; everything outside fades to this
|
|
343
|
+
* value so the active group reads as the focal area without losing
|
|
344
|
+
* context. 0.6 keeps outsiders visible enough to be referenced; lower
|
|
345
|
+
* (~0.3) makes isolation visually louder but at the cost of obscuring
|
|
346
|
+
* context.
|
|
347
|
+
*/
|
|
348
|
+
export declare const ISOLATION_DIM_OPACITY = 0.6;
|
|
349
|
+
/**
|
|
350
|
+
* Opacity of the WYSIWYG shape-draw preview (the live rect / ellipse drawn
|
|
351
|
+
* through its real renderer while dragging out a new shape). Slightly below
|
|
352
|
+
* 1 so the in-progress shape reads as "not committed yet" while still
|
|
353
|
+
* showing its true fill / stroke. Range: 0.7 (clearly tentative) – 1.0
|
|
354
|
+
* (indistinguishable from a committed shape).
|
|
355
|
+
*/
|
|
356
|
+
export declare const DRAW_PREVIEW_OPACITY = 0.85;
|
|
357
|
+
/**
|
|
358
|
+
* Opacity of the click-create ghost preview (hovering a start dot): the
|
|
359
|
+
* faded would-be element + its connector, rendered through their real
|
|
360
|
+
* renderers. Lower than DRAW_PREVIEW_OPACITY because the ghost is purely
|
|
361
|
+
* speculative (a click away), not an in-progress gesture. Range: 0.3–0.5.
|
|
362
|
+
*/
|
|
363
|
+
export declare const GHOST_PREVIEW_OPACITY = 0.4;
|
|
364
|
+
/**
|
|
365
|
+
* Touch hit-test slop. WCAG and Apple HIG ask for ≥ 44 pt touch
|
|
366
|
+
* targets; with `HANDLE_SIZE = 4` (8 px visual square) the visual
|
|
367
|
+
* stays small but the *hit area* enlarges so a finger can grab it.
|
|
368
|
+
*
|
|
369
|
+
* - `TOUCH_HANDLE_HIT_SLOP` — half-size of the resize-handle hit
|
|
370
|
+
* rectangle in screen pixels (44 pt ≈ 22 px half = 44 px target).
|
|
371
|
+
* - `TOUCH_LINK_HANDLE_HIT_SLOP` — same for edge-endpoint dots.
|
|
372
|
+
* - `TOUCH_LINK_HIT_THRESHOLD` — line-tolerance for tapping on an
|
|
373
|
+
* edge body.
|
|
374
|
+
*/
|
|
375
|
+
export declare const TOUCH_HANDLE_HIT_SLOP = 22;
|
|
376
|
+
export declare const TOUCH_LINK_HANDLE_HIT_SLOP = 22;
|
|
377
|
+
export declare const TOUCH_LINK_HIT_THRESHOLD = 18;
|
|
378
|
+
/**
|
|
379
|
+
* Touch variants of the link-start anchor-dot hit zones (the dots that sit
|
|
380
|
+
* just outside a selected element's edges). Mouse uses the small
|
|
381
|
+
* {@link ANCHOR_START_HIT_SLOP} / {@link ANCHOR_DOT_CLICK_RADIUS}; on a
|
|
382
|
+
* coarse pointer these grow to a finger-friendly ~16 px so the grab (start a
|
|
383
|
+
* link drag) and click (create a linked element) zones are tappable. The
|
|
384
|
+
* drawn dot stays the same size — only the hit area enlarges.
|
|
385
|
+
*/
|
|
386
|
+
export declare const TOUCH_ANCHOR_START_HIT_SLOP = 16;
|
|
387
|
+
export declare const TOUCH_ANCHOR_DOT_CLICK_RADIUS = 16;
|
|
388
|
+
/**
|
|
389
|
+
* Annotation pin visuals on the overlay.
|
|
390
|
+
*
|
|
391
|
+
* - `ANNOTATION_PIN_RADIUS` — screen-pixel radius of the circular pin
|
|
392
|
+
* marker. Same size regardless of zoom so the marker stays grabable
|
|
393
|
+
* at any scale.
|
|
394
|
+
* - `ANNOTATION_PIN_HIT_SLOP` — half-size of the hit rect used by
|
|
395
|
+
* `hitAnnotation`. Should be ≥ touch target (44 px) when running in
|
|
396
|
+
* touch mode; defaults give a comfortable mouse grab zone.
|
|
397
|
+
* - `ANNOTATION_PIN_FILL` / `STROKE` — colours when unselected.
|
|
398
|
+
* - `ANNOTATION_PIN_RESOLVED_FILL` — muted colour for resolved threads
|
|
399
|
+
* (host can still cycle through them but they read as "settled").
|
|
400
|
+
*/
|
|
401
|
+
export declare const ANNOTATION_PIN_RADIUS = 9;
|
|
402
|
+
export declare const ANNOTATION_PIN_HIT_SLOP = 12;
|
|
403
|
+
export declare const ANNOTATION_PIN_FILL = "#f9a825";
|
|
404
|
+
export declare const ANNOTATION_PIN_STROKE = "#fff";
|
|
405
|
+
export declare const ANNOTATION_PIN_RESOLVED_FILL = "#888";
|
|
406
|
+
export declare const ANNOTATION_PIN_BADGE_FONT_SIZE = 10;
|
|
407
|
+
/**
|
|
408
|
+
* Hit-test acceleration threshold. When `scene.elements.size` reaches
|
|
409
|
+
* this value, `Editor.hitTest` switches from the linear `getElementAt`
|
|
410
|
+
* scan to a lazy SpatialGrid keyed by scene-identity. The grid pays
|
|
411
|
+
* for itself only on large scenes; below the threshold the rebuild
|
|
412
|
+
* cost outweighs the per-click savings. Tune down if hosts profile
|
|
413
|
+
* regression on medium scenes (~3k–8k shapes).
|
|
414
|
+
*/
|
|
415
|
+
export declare const LARGE_SCENE_HIT_THRESHOLD = 2000;
|
|
416
|
+
/**
|
|
417
|
+
* Minimum AABB coverage ratio required for a shape to fall into the
|
|
418
|
+
* rubber-band lasso. `0` would behave like pure intersection (any
|
|
419
|
+
* touch grabs the shape — feels too eager); `1` requires full
|
|
420
|
+
* containment (needs precise lasso). `0.5` is the default — brushing
|
|
421
|
+
* past an edge does not grab the shape, but covering most of it does.
|
|
422
|
+
* Bidirectional rule: a tiny lasso entirely inside a big shape also
|
|
423
|
+
* picks it up.
|
|
424
|
+
*/
|
|
425
|
+
export declare const LASSO_COVERAGE_THRESHOLD = 0.5;
|
|
426
|
+
/**
|
|
427
|
+
* Minimum coverage ratio for keeping a child inside its parent
|
|
428
|
+
* container after a drag. If `intersection.area / childBounds.area`
|
|
429
|
+
* stays above this threshold, the editor extends the container's
|
|
430
|
+
* drop-zone (+ outer size) instead of dropping the parent link.
|
|
431
|
+
* Below it — the user clearly dragged the child out, so `parentId`
|
|
432
|
+
* is cleared. 0.5 = "if more than half of the element is still in
|
|
433
|
+
* the lane, grow the lane to keep it".
|
|
434
|
+
*/
|
|
435
|
+
export declare const CONTAINER_KEEP_THRESHOLD = 0.5;
|
|
436
|
+
/**
|
|
437
|
+
* Max `order` string length (chars) before the editor schedules an
|
|
438
|
+
* automatic layer-wide compaction. Fractional keys lengthen the key by
|
|
439
|
+
* 1–2 chars per insert-in-the-middle; > 12 means inserts have been
|
|
440
|
+
* bursting at the same spot and it is time to rebalance back to short
|
|
441
|
+
* keys. Compaction runs transparently in a microtask after the mutating
|
|
442
|
+
* notify, so the user never sees the long-key state.
|
|
443
|
+
*/
|
|
444
|
+
export declare const AUTO_COMPACT_THRESHOLD = 12;
|
|
445
|
+
/**
|
|
446
|
+
* Maximum local-pixel half-width of a brush vertex. Hosts compute the
|
|
447
|
+
* actual width as `pressure × MAX_BRUSH_WIDTH`; `pressure` is the
|
|
448
|
+
* `PointerEvent.pressure` field, which is normalised to [0, 1] on
|
|
449
|
+
* pointer devices that report it (Apple Pencil, Wacom). Devices
|
|
450
|
+
* without pressure get `0.5` from the browser, yielding mid-range
|
|
451
|
+
* width.
|
|
452
|
+
*/
|
|
453
|
+
export declare const MAX_BRUSH_WIDTH = 6;
|
|
454
|
+
/**
|
|
455
|
+
* Half-width used when `PointerEvent.pressure` is 0 (most mice in
|
|
456
|
+
* Chromium) so a click-drag still produces a visible stroke.
|
|
457
|
+
*/
|
|
458
|
+
export declare const DEFAULT_BRUSH_WIDTH = 2;
|
|
459
|
+
/**
|
|
460
|
+
* Default upper bound on the longer edge of a freshly-inserted
|
|
461
|
+
* image (CSS pixels). Larger images get downscaled proportionally
|
|
462
|
+
* by the built-in image file-drop handler so a 4000×3000 phone
|
|
463
|
+
* snapshot doesn't blanket the viewport. Hosts that want a
|
|
464
|
+
* different cap can `unregisterFileDropHandler("image")` and
|
|
465
|
+
* register their own.
|
|
466
|
+
*/
|
|
467
|
+
export declare const DEFAULT_IMAGE_MAX_EDGE_PX = 480;
|
|
468
|
+
/**
|
|
469
|
+
* Adaptive animation-tick throttling (GIF / video playback). The tick
|
|
470
|
+
* drives a full re-render every frame while an animated shape is
|
|
471
|
+
* visible; under load it is throttled so playback doesn't starve the
|
|
472
|
+
* interaction frame budget.
|
|
473
|
+
*
|
|
474
|
+
* - `ANIMATION_MIN_INTERVAL_MS` — fastest tick (≈60fps). Healthy
|
|
475
|
+
* scenes hit this.
|
|
476
|
+
* - `ANIMATION_MAX_INTERVAL_MS` — slowest tick under heavy load
|
|
477
|
+
* (≈12fps). GIFs still read as animated; frames are dropped.
|
|
478
|
+
* - `ANIMATION_COST_FACTOR` — target interval = clamp(emaRenderCost ×
|
|
479
|
+
* factor, min, max). Factor > 1 leaves headroom for the rest of the
|
|
480
|
+
* frame (input, layout) so the render cost doesn't fill the budget.
|
|
481
|
+
*/
|
|
482
|
+
export declare const ANIMATION_MIN_INTERVAL_MS: number;
|
|
483
|
+
export declare const ANIMATION_MAX_INTERVAL_MS: number;
|
|
484
|
+
export declare const ANIMATION_COST_FACTOR = 2;
|
|
485
|
+
/**
|
|
486
|
+
* Per-shape GIF playback policy.
|
|
487
|
+
*
|
|
488
|
+
* - `HEAVY_GIF_BYTES` — animationData (raw GIF bytes) above this counts
|
|
489
|
+
* as "heavy". Light GIFs loop forever; heavy ones auto-stop to save
|
|
490
|
+
* CPU/GPU. 2 MB ≈ a large multi-frame GIF.
|
|
491
|
+
* - `GIF_AUTOSTOP_MS` — a heavy GIF freezes after this much continuous
|
|
492
|
+
* playback. A click resumes it (and restarts the timer).
|
|
493
|
+
*/
|
|
494
|
+
export declare const HEAVY_GIF_BYTES: number;
|
|
495
|
+
export declare const GIF_AUTOSTOP_MS = 30000;
|
|
496
|
+
/**
|
|
497
|
+
* Defaults for a text shape created via the `draw-text` tool (click on
|
|
498
|
+
* the canvas). Tweak to change the look of freshly-placed text before
|
|
499
|
+
* the user has touched the contextual panel.
|
|
500
|
+
*
|
|
501
|
+
* - `TEXT_DEFAULT_FONT_SIZE` — initial font size in world units.
|
|
502
|
+
* - `TEXT_DEFAULT_FONT_FAMILY` — initial font stack.
|
|
503
|
+
* - `TEXT_DEFAULT_FILL` — initial text colour (near-black).
|
|
504
|
+
* - `TEXT_FONT_SIZE_MIN` / `TEXT_FONT_SIZE_MAX` — clamp range for the
|
|
505
|
+
* font-size control in the contextual panel.
|
|
506
|
+
*/
|
|
507
|
+
export declare const TEXT_DEFAULT_FONT_SIZE = 24;
|
|
508
|
+
export declare const TEXT_DEFAULT_FONT_FAMILY = "system-ui, sans-serif";
|
|
509
|
+
export declare const TEXT_DEFAULT_FILL = "#1a1a1a";
|
|
510
|
+
export declare const TEXT_FONT_SIZE_MIN = 8;
|
|
511
|
+
export declare const TEXT_FONT_SIZE_MAX = 256;
|
|
512
|
+
/**
|
|
513
|
+
* In-canvas text editing.
|
|
514
|
+
*
|
|
515
|
+
* - `CARET_BLINK_INTERVAL_MS` — half-period of the caret blink (the
|
|
516
|
+
* caret toggles visible/hidden every interval). 530 ms matches the
|
|
517
|
+
* platform default most editors use. Typing/moving resets it to
|
|
518
|
+
* visible so the caret never blinks off mid-interaction.
|
|
519
|
+
* - `TEXT_SELECTION_FILL` / `TEXT_SELECTION_OPACITY` — selection
|
|
520
|
+
* highlight colour + alpha (~0.17 over the text).
|
|
521
|
+
* - `TEXT_CARET_WIDTH_PX` — caret bar width in screen px.
|
|
522
|
+
* - `TEXT_RESIZE_MIN_FONT_SIZE` — clamp so corner-resize can't shrink
|
|
523
|
+
* text below a usable size.
|
|
524
|
+
*/
|
|
525
|
+
/**
|
|
526
|
+
* Time window (ms) within which a multi-key action sequence (e.g. `g`
|
|
527
|
+
* then `d` to toggle the debug panel) must complete. Keys further apart
|
|
528
|
+
* than this don't chain — the buffer prunes stale presses. 1 s matches
|
|
529
|
+
* the "press g, then d" feel of vim-/Gmail-style sequence shortcuts.
|
|
530
|
+
* Range: 500–2000.
|
|
531
|
+
*/
|
|
532
|
+
export declare const SEQUENCE_HOTKEY_WINDOW_MS = 1000;
|
|
533
|
+
/**
|
|
534
|
+
* Arrow-key nudge step (world px) for the selection. Plain arrow moves by
|
|
535
|
+
* `NUDGE_STEP_PX`; holding Shift moves by `NUDGE_STEP_SHIFT_PX` (coarse).
|
|
536
|
+
*/
|
|
537
|
+
export declare const NUDGE_STEP_PX = 1;
|
|
538
|
+
export declare const NUDGE_STEP_SHIFT_PX = 10;
|
|
539
|
+
export declare const CARET_BLINK_INTERVAL_MS = 530;
|
|
540
|
+
export declare const TEXT_SELECTION_FILL = "#1a73e8";
|
|
541
|
+
export declare const TEXT_SELECTION_OPACITY = 0.25;
|
|
542
|
+
export declare const TEXT_CARET_WIDTH_PX = 1.5;
|
|
543
|
+
export declare const TEXT_RESIZE_MIN_FONT_SIZE = 4;
|
|
544
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts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