@weasel-js/measure 1.19.1 → 2.0.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 +28 -4
- package/dist/MeasureReadout/MeasureReadout.d.ts +24 -0
- package/dist/MeasureReadout/MeasureReadout.d.ts.map +1 -0
- package/dist/MeasureReadout/index.d.ts +3 -0
- package/dist/MeasureReadout/index.d.ts.map +1 -0
- package/dist/actionIds.d.ts +18 -0
- package/dist/actionIds.d.ts.map +1 -0
- package/dist/actionParamSchema.d.ts +15 -0
- package/dist/actionParamSchema.d.ts.map +1 -0
- package/dist/icons.gen.d.ts +3 -0
- package/dist/icons.gen.d.ts.map +1 -0
- package/dist/index.d.ts +11 -195
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +940 -476
- package/dist/index.js.map +1 -1
- package/dist/measureActions.d.ts +35 -0
- package/dist/measureActions.d.ts.map +1 -0
- package/dist/measureCommands.d.ts +12 -0
- package/dist/measureCommands.d.ts.map +1 -0
- package/dist/measureContribution.d.ts +11 -0
- package/dist/measureContribution.d.ts.map +1 -0
- package/dist/measureEdits.d.ts +29 -0
- package/dist/measureEdits.d.ts.map +1 -0
- package/dist/measureHit.d.ts +22 -0
- package/dist/measureHit.d.ts.map +1 -0
- package/dist/measureLayer.d.ts +15 -0
- package/dist/measureLayer.d.ts.map +1 -0
- package/dist/measurePainter.d.ts +17 -0
- package/dist/measurePainter.d.ts.map +1 -0
- package/dist/measurement.d.ts +71 -0
- package/dist/measurement.d.ts.map +1 -0
- package/dist/measurements.d.ts +39 -0
- package/dist/measurements.d.ts.map +1 -0
- package/dist/style.css +47 -0
- package/dist/toolSets.d.ts +12 -0
- package/dist/toolSets.d.ts.map +1 -0
- package/dist/useMeasureTool.d.ts +26 -0
- package/dist/useMeasureTool.d.ts.map +1 -0
- package/package.json +23 -13
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm install @weasel-js/measure
|
|
|
19
19
|
```tsx
|
|
20
20
|
const [measurements] = useState(() => createMeasurements({ layer: 'notes' }));
|
|
21
21
|
const tools = useMeasureTools({ measurements });
|
|
22
|
-
const ambient = useMemo(() => [
|
|
22
|
+
const ambient = useMemo(() => [createMeasurementsContribution(scene, measurements)], [scene, measurements]);
|
|
23
23
|
|
|
24
24
|
<SceneCanvas scene={scene} tools={[tools.measure]} ambient={ambient} snap={{ sources: [measureEndSource()] }} />
|
|
25
25
|
```
|
|
@@ -27,6 +27,30 @@ const ambient = useMemo(() => [measurementsContribution(scene, measurements)], [
|
|
|
27
27
|
`notes` is a layer the scene declares with `annotation: true`. The contribution
|
|
28
28
|
registers the painter that draws measurements in the scene's own node shapes
|
|
29
29
|
(`nodeShapesOf(scene)`), the layer that shows the picked one, and the
|
|
30
|
-
commands, which `MEASURE_ACTION_IDS` names
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
commands, which `MEASURE_ACTION_IDS` names. `MEASURE_TOOLS` names the tool for
|
|
31
|
+
a palette. A render with no canvas registers `MEASURE_PAINTER` itself.
|
|
32
|
+
|
|
33
|
+
## The readout
|
|
34
|
+
|
|
35
|
+
`<MeasureReadout>` is a chip pinned to the bottom of its nearest positioned
|
|
36
|
+
ancestor. It shows the measurement a drag is drawing, else the picked one,
|
|
37
|
+
else the newest: its distance, offsets and angle, in the units of the frame
|
|
38
|
+
its ends landed in. Its Move by, Rotate by, Delete and Clear all buttons run
|
|
39
|
+
the contribution's commands from the actions registry, and one that cannot run
|
|
40
|
+
says why in its tooltip. It reads the canvas's registries, so it and the
|
|
41
|
+
canvas share one `<DepRegistryProvider>` and `<ActionsProvider>`. It draws with
|
|
42
|
+
`@weasel-js/ui`'s components, so load both stylesheets.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import '@weasel-js/ui/style.css';
|
|
46
|
+
import '@weasel-js/measure/style.css';
|
|
47
|
+
|
|
48
|
+
<DepRegistryProvider>
|
|
49
|
+
<ActionsProvider>
|
|
50
|
+
<div className="stage">
|
|
51
|
+
<SceneCanvas scene={scene} tools={[tools.measure]} ambient={ambient} />
|
|
52
|
+
<MeasureReadout scene={scene} measurements={measurements} />
|
|
53
|
+
</div>
|
|
54
|
+
</ActionsProvider>
|
|
55
|
+
</DepRegistryProvider>
|
|
56
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type Scene } from '@weasel-js/core';
|
|
3
|
+
import { type Measurements } from '../measurements.js';
|
|
4
|
+
/** Props for {@link MeasureReadout}. */
|
|
5
|
+
export interface MeasureReadoutProps {
|
|
6
|
+
/** The scene the measurements are nodes of. */
|
|
7
|
+
scene: Scene<unknown, string, unknown>;
|
|
8
|
+
/** The same object `useMeasureTool` and `createMeasurementsContribution` are given. */
|
|
9
|
+
measurements: Measurements;
|
|
10
|
+
/** Additional class for the root, to place it. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The measurement readout: a chip pinned to the bottom of the nearest
|
|
15
|
+
* positioned ancestor, showing the measurement a measure drag is drawing,
|
|
16
|
+
* else the picked one, else the newest — its distance, offset, and angle in
|
|
17
|
+
* the units of the frame its ends landed in, its world lengths divided by that
|
|
18
|
+
* frame's magnification (`measureMagnification`) — with Move by, Rotate by, Delete, and Clear all from the
|
|
19
|
+
* actions registry. A command that cannot run says why in its tooltip. The
|
|
20
|
+
* angle reads like a protractor, counterclockwise-positive: a line rising to
|
|
21
|
+
* the right at 30° reads 30°, and Rotate by turns the selection that way.
|
|
22
|
+
*/
|
|
23
|
+
export declare function MeasureReadout({ scene, measurements: ms, className }: MeasureReadoutProps): ReactElement | null;
|
|
24
|
+
//# sourceMappingURL=MeasureReadout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeasureReadout.d.ts","sourceRoot":"","sources":["../../src/MeasureReadout/MeasureReadout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAKL,KAAK,KAAK,EAEX,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAetE,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,uFAAuF;IACvF,YAAY,EAAE,YAAY,CAAC;IAC3B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,YAAY,GAAG,IAAI,CAgD/G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MeasureReadout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The ids of the measure feature's actions. */
|
|
2
|
+
export declare const MEASURE_ACTION_IDS: {
|
|
3
|
+
/** The measure tool's drag, which adds a measurement. */
|
|
4
|
+
readonly measure: "measure";
|
|
5
|
+
/** The measure tool's click, which picks the measurement under it. */
|
|
6
|
+
readonly pickAt: "measure.pickAt";
|
|
7
|
+
/** A click on a measurement under any tool, which picks it. */
|
|
8
|
+
readonly pick: "measure.pick";
|
|
9
|
+
/** A drag on a measurement under any tool: a picked end moves that end, the
|
|
10
|
+
* rest moves the whole measurement. */
|
|
11
|
+
readonly drag: "measure.drag";
|
|
12
|
+
readonly moveBy: "measure.moveBy";
|
|
13
|
+
readonly rotateBy: "measure.rotateBy";
|
|
14
|
+
readonly delete: "measure.delete";
|
|
15
|
+
readonly clear: "measure.clear";
|
|
16
|
+
readonly unpick: "measure.unpick";
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=actionIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionIds.d.ts","sourceRoot":"","sources":["../src/actionIds.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,eAAO,MAAM,kBAAkB;IAC7B,yDAAyD;;IAEzD,sEAAsE;;IAEtE,+DAA+D;;IAE/D;4CACwC;;;;;;;CAOhC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The params this package's actions read, merged into routing's
|
|
3
|
+
* `ActionParamSchema` so `<SceneCanvas tune>` types them.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImmediateParams } from '@weasel-js/routing';
|
|
6
|
+
declare module '@weasel-js/routing' {
|
|
7
|
+
interface ActionParamSchema {
|
|
8
|
+
measure: {
|
|
9
|
+
angleStep?: number;
|
|
10
|
+
};
|
|
11
|
+
'measure.pickAt': Pick<ImmediateParams, 'press'>;
|
|
12
|
+
'measure.pick': Pick<ImmediateParams, 'affordance'>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=actionParamSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionParamSchema.d.ts","sourceRoot":"","sources":["../src/actionParamSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAU,iBAAiB;QACzB,OAAO,EAAE;YAAE,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAChC,gBAAgB,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACjD,cAAc,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;KACrD;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.gen.d.ts","sourceRoot":"","sources":["../src/icons.gen.ts"],"names":[],"mappings":"AAIA,yGAAyG;AACzG,eAAO,MAAM,IAAI,4FAA+B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,195 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* in one frame, or in frames declaring equal scopes, read that frame's
|
|
13
|
-
* modeled length, and ends whose frames disagree read the innermost frame
|
|
14
|
-
* holding both, which is world when only the root does.
|
|
15
|
-
*/
|
|
16
|
-
interface MeasureFrames {
|
|
17
|
-
readonly start: NodeId | null;
|
|
18
|
-
readonly end: NodeId | null;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* The offset from `start` to `end`, in world units. `dx` and `dy` are on the
|
|
22
|
-
* world's own axes, where y grows downward; `angle` reads like a protractor
|
|
23
|
-
* instead, counterclockwise-positive on screen, so a line rising up and to
|
|
24
|
-
* the right at 30° reads +30°. The canvas's own rotations are
|
|
25
|
-
* clockwise-positive: a rotate that follows the line turns by `-angle`.
|
|
26
|
-
*/
|
|
27
|
-
interface Measurement {
|
|
28
|
-
readonly start: MeasurePoint;
|
|
29
|
-
readonly end: MeasurePoint;
|
|
30
|
-
readonly dx: number;
|
|
31
|
-
readonly dy: number;
|
|
32
|
-
readonly distance: number;
|
|
33
|
-
/** `atan2(-dy, dx)`, in `(-π, π]`. Zero for a zero-length measurement. */
|
|
34
|
-
readonly angle: number;
|
|
35
|
-
/** The frames its ends landed in. Absent, it reads in world. */
|
|
36
|
-
readonly frames?: MeasureFrames;
|
|
37
|
-
}
|
|
38
|
-
/** Measure from `start` to `end`, landed in `frames`. */
|
|
39
|
-
declare function measureBetween(start: MeasurePoint, end: MeasurePoint, frames?: MeasureFrames): Measurement;
|
|
40
|
-
/** How large the frame `frames` share is drawn in world: a measurement's
|
|
41
|
-
* world lengths divided by it are its modeled lengths. 1 without frames. */
|
|
42
|
-
declare function measureMagnification(scene: ScopedScene, frames: MeasureFrames | undefined): number;
|
|
43
|
-
/** What a measurement node keeps in `data`: its two ends, in world units, and
|
|
44
|
-
* the frames they landed in. A `label` beside it names the node in a layer
|
|
45
|
-
* list. */
|
|
46
|
-
interface MeasureData {
|
|
47
|
-
measure: {
|
|
48
|
-
start: MeasurePoint;
|
|
49
|
-
end: MeasurePoint;
|
|
50
|
-
frames?: MeasureFrames;
|
|
51
|
-
};
|
|
52
|
-
label?: string;
|
|
53
|
-
}
|
|
54
|
-
/** Where an end placed at a world point lands: what `unitFrameAt` builds. */
|
|
55
|
-
type MeasureFrameAt = (p: MeasurePoint) => NodeId | null;
|
|
56
|
-
/** Which end of a measurement. */
|
|
57
|
-
type MeasureEnd = 'start' | 'end';
|
|
58
|
-
/** The ends `node` measures between, or null when it is not a measurement. */
|
|
59
|
-
declare function measureEndsOf(node: Pick<SceneNode<unknown, string, unknown>, 'data'> | undefined): MeasureData['measure'] | null;
|
|
60
|
-
/** The measurement `node` holds, or null when it is not one. */
|
|
61
|
-
declare function measurementOf(node: Pick<SceneNode<unknown, string, unknown>, 'data'> | undefined): Measurement | null;
|
|
62
|
-
/** The box a measurement's pose holds: its two ends' bounds, which is what
|
|
63
|
-
* culling, area queries, and fitting the view read. */
|
|
64
|
-
declare function measurePose(start: MeasurePoint, end: MeasurePoint): RectPose;
|
|
65
|
-
/** A measurement node on `layer`, ready to insert, or to list in a scene's
|
|
66
|
-
* `initial` nodes: typed with that layer and a `RectPose`. */
|
|
67
|
-
declare function measureNode<TLayer extends string>(id: NodeId, layer: TLayer, start: MeasurePoint, end: MeasurePoint, frames?: MeasureFrames): MarkNode<MeasureData, TLayer, RectPose>;
|
|
68
|
-
|
|
69
|
-
/** One value, readable and watchable — what a readout re-renders from. */
|
|
70
|
-
type MeasureCell<T> = ValueStore<T>;
|
|
71
|
-
/**
|
|
72
|
-
* Where a scene's measurements go, and the state around them that is not
|
|
73
|
-
* the document's: which one is picked, and the one a measure drag is still
|
|
74
|
-
* drawing. The measurements themselves are nodes on `layer`, an annotation
|
|
75
|
-
* layer (`isAnnotationLayer`), so they save with the scene, undo with it,
|
|
76
|
-
* and stay out of export and content picking.
|
|
77
|
-
*
|
|
78
|
-
* The pick sits beside the content selection rather than in it: picking a
|
|
79
|
-
* measurement leaves the selection alone, so Move by can carry the selection
|
|
80
|
-
* by the picked measurement.
|
|
81
|
-
*/
|
|
82
|
-
interface Measurements {
|
|
83
|
-
/** The annotation layer new measurements are added to. */
|
|
84
|
-
readonly layer: string;
|
|
85
|
-
/** The picked measurement's id. */
|
|
86
|
-
readonly picked: MeasureCell<NodeId | null>;
|
|
87
|
-
/** The measurement a measure drag is drawing, before it is added. */
|
|
88
|
-
readonly draft: MeasureCell<Measurement | null>;
|
|
89
|
-
/** Whether the measure tool is active, which changes what a press on a
|
|
90
|
-
* measurement does: under it, only the picked one's ends take a drag, so a
|
|
91
|
-
* drag from anywhere else starts a new measurement. */
|
|
92
|
-
readonly measuring: MeasureCell<boolean>;
|
|
93
|
-
}
|
|
94
|
-
/** The measurements on `layer`, none picked and none in progress. */
|
|
95
|
-
declare function createMeasurements(options: {
|
|
96
|
-
layer: string;
|
|
97
|
-
}): Measurements;
|
|
98
|
-
/** The measurement nodes on `ms.layer`, oldest first. */
|
|
99
|
-
declare function measureIds(scene: Pick<Scene<unknown, string, unknown>, 'nodesOnLayer'>, ms: Pick<Measurements, 'layer'>): NodeId[];
|
|
100
|
-
/** The measurement commands act on: the picked one while it is still in the
|
|
101
|
-
* scene, else the newest. */
|
|
102
|
-
declare function currentMeasureId(scene: Pick<Scene<unknown, string, unknown>, 'nodesOnLayer' | 'get'>, ms: Pick<Measurements, 'layer' | 'picked'>): NodeId | null;
|
|
103
|
-
|
|
104
|
-
/** Which part of which measurement lies under a point. */
|
|
105
|
-
interface MeasureHit {
|
|
106
|
-
id: NodeId;
|
|
107
|
-
part: MeasureEnd | 'line';
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* The measurement under `p`, newest first: an end within `tolerance` world
|
|
111
|
-
* units of it, else a line within the same distance. A hidden or locked
|
|
112
|
-
* measurement (`nodeGates`) is passed over.
|
|
113
|
-
*/
|
|
114
|
-
declare function measureAt(scene: Pick<Scene<unknown, string, unknown>, 'nodesOnLayer' | 'get' | 'layers' | 'overrides'>, ms: Pick<Measurements, 'layer'>, p: MeasurePoint, tolerance: number): MeasureHit | null;
|
|
115
|
-
/** Options for `measureEndSource`. */
|
|
116
|
-
interface MeasureEndSourceOptions {
|
|
117
|
-
/** Overrides the canvas's reach for measurement ends, in screen px. */
|
|
118
|
-
reachPx?: number;
|
|
119
|
-
}
|
|
120
|
-
/** The ends of every shown measurement as snap targets for a pointer probe. */
|
|
121
|
-
declare function measureEndSource(opts?: MeasureEndSourceOptions): SnapSource;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* A scene's measurements on a canvas, whatever tool is active: the painter
|
|
125
|
-
* that draws them, the layer that shows the picked one and claims presses on measurements, a click on
|
|
126
|
-
* one to pick it and a drag to edit it, and the commands — Move by, Rotate
|
|
127
|
-
* by, Delete, Clear — a readout binds buttons to. Install it with
|
|
128
|
-
* `<SceneCanvas ambient={[…]}>`; `useMeasureTool` adds the measuring itself.
|
|
129
|
-
*/
|
|
130
|
-
declare function measurementsContribution(scene: Scene<unknown, string, unknown>, ms: Measurements): SurfaceContribution;
|
|
131
|
-
|
|
132
|
-
/** The ids of the measure feature's actions. */
|
|
133
|
-
declare const MEASURE_ACTION_IDS: {
|
|
134
|
-
/** The measure tool's drag, which adds a measurement. */
|
|
135
|
-
readonly measure: "measure";
|
|
136
|
-
/** The measure tool's click, which picks the measurement under it. */
|
|
137
|
-
readonly pickAt: "measure.pickAt";
|
|
138
|
-
/** A click on a measurement under any tool, which picks it. */
|
|
139
|
-
readonly pick: "measure.pick";
|
|
140
|
-
/** A drag on a measurement under any tool: a picked end moves that end, the
|
|
141
|
-
* rest moves the whole measurement. */
|
|
142
|
-
readonly drag: "measure.drag";
|
|
143
|
-
readonly moveBy: "measure.moveBy";
|
|
144
|
-
readonly rotateBy: "measure.rotateBy";
|
|
145
|
-
readonly delete: "measure.delete";
|
|
146
|
-
readonly clear: "measure.clear";
|
|
147
|
-
readonly unpick: "measure.unpick";
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
/** The registered layer's id; a press it claims routes as `layer:<id>`. */
|
|
151
|
-
declare const MEASURE_LAYER_ID = "weasel-measure";
|
|
152
|
-
/** The affordance kind a press on a measurement routes under. */
|
|
153
|
-
declare const MEASURE_AFFORDANCE_KIND = "layer:weasel-measure";
|
|
154
|
-
|
|
155
|
-
/** Paints a measurement node — `data.measure`, in world units — in the
|
|
156
|
-
* canvas's measure color. It has no silhouette: a measurement is not content
|
|
157
|
-
* to pick. `measurementsContribution` registers it for its scene; a render
|
|
158
|
-
* with no canvas registers it itself (`nodeShapesOf(scene).register`). */
|
|
159
|
-
declare const MEASURE_PAINTER: NodeShapeEntry;
|
|
160
|
-
|
|
161
|
-
/** Options for `useMeasureTool`. */
|
|
162
|
-
interface UseMeasureToolOptions {
|
|
163
|
-
/** Where the measurements go and which one is picked — the same object the
|
|
164
|
-
* canvas's `measurementsContribution` and a readout are given. */
|
|
165
|
-
measurements: Measurements;
|
|
166
|
-
/** The angle step, in radians, Shift holds a measurement to. Default 15°.
|
|
167
|
-
* Read on every pointer move, so a change mid-drag applies at once. */
|
|
168
|
-
angleStep?: number;
|
|
169
|
-
/** Override the default keybinding (`{ key: 'M' }`). Pass `null` to omit. */
|
|
170
|
-
keybinding?: ToolKeybinding | null;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Measure tool. A drag adds a measurement from press to release in world
|
|
174
|
-
* units — both ends through the `snap` dep, Shift holding the angle to
|
|
175
|
-
* `angleStep` — as one undo step, and picks it. A click picks the
|
|
176
|
-
* measurement under it, Escape drops the pick, and Delete removes the
|
|
177
|
-
* current measurement. The measurements are scene nodes on an annotation
|
|
178
|
-
* layer, so they stay when the tool changes; editing them under any tool,
|
|
179
|
-
* and the commands that transform by them, come from
|
|
180
|
-
* `measurementsContribution`, which the canvas installs beside this tool.
|
|
181
|
-
*/
|
|
182
|
-
declare function useMeasureTool(options: UseMeasureToolOptions): Tool;
|
|
183
|
-
|
|
184
|
-
/** The ids {@link useMeasureTools} keys its tools by. */
|
|
185
|
-
type MeasureToolId = 'measure';
|
|
186
|
-
/** Every tool `@weasel-js/measure` ships: the measure tool. */
|
|
187
|
-
declare const MEASURE_TOOLS: ToolSet<MeasureToolId>;
|
|
188
|
-
/**
|
|
189
|
-
* Every tool in {@link MEASURE_TOOLS}, keyed by id, for `<SceneCanvas tools>` beside the
|
|
190
|
-
* `measurementsContribution` whose actions they bind. `options` go to `useMeasureTool`.
|
|
191
|
-
*/
|
|
192
|
-
declare function useMeasureTools(options: UseMeasureToolOptions): Record<MeasureToolId, Tool>;
|
|
193
|
-
|
|
194
|
-
export { MEASURE_ACTION_IDS, MEASURE_AFFORDANCE_KIND, MEASURE_LAYER_ID, MEASURE_PAINTER, MEASURE_TOOLS, createMeasurements, currentMeasureId, measureAt, measureBetween, measureEndSource, measureEndsOf, measureIds, measureMagnification, measureNode, measurePose, measurementOf, measurementsContribution, useMeasureTool, useMeasureTools };
|
|
195
|
-
export type { MeasureCell, MeasureData, MeasureEnd, MeasureEndSourceOptions, MeasureFrameAt, MeasureFrames, MeasureHit, MeasurePoint, MeasureToolId, Measurement, Measurements, UseMeasureToolOptions };
|
|
1
|
+
export { measureBetween, measurementOf, measureEndsOf, measureMagnification, measurePose, measureNode, type Measurement, type MeasurePoint, type MeasureData, type MeasureEnd, type MeasureFrames, type MeasureFrameAt, } from './measurement.js';
|
|
2
|
+
export { createMeasurements, currentMeasureId, measureIds, type Measurements, type MeasureCell, } from './measurements.js';
|
|
3
|
+
export { measureHitAt, measureEndSource, type MeasureEndSourceOptions, type MeasureHit } from './measureHit.js';
|
|
4
|
+
export { createMeasurementsContribution } from './measureContribution.js';
|
|
5
|
+
export { MEASURE_ACTION_IDS } from './actionIds.js';
|
|
6
|
+
export { MEASURE_AFFORDANCE_KIND, MEASURE_LAYER_ID } from './measureLayer.js';
|
|
7
|
+
export { MEASURE_PAINTER } from './measurePainter.js';
|
|
8
|
+
export { useMeasureTool, type UseMeasureToolOptions } from './useMeasureTool.js';
|
|
9
|
+
export { MEASURE_TOOLS, useMeasureTools, type MeasureToolId } from './toolSets.js';
|
|
10
|
+
export { MeasureReadout, type MeasureReadoutProps } from './MeasureReadout/index.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAC5F,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,GAChH,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAChD,KAAK,YAAY,EAAE,KAAK,WAAW,GACpC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|