@motionscript/math 0.1.0-alpha.4 → 0.1.0-alpha.6
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 +132 -92
- package/README.md +39 -33
- package/dist/annotate/angle-mark.d.ts +52 -27
- package/dist/annotate/angle-mark.d.ts.map +1 -1
- package/dist/annotate/angle-mark.js +80 -115
- package/dist/annotate/angle-mark.js.map +1 -1
- package/dist/annotate/curly-brace.d.ts +59 -25
- package/dist/annotate/curly-brace.d.ts.map +1 -1
- package/dist/annotate/curly-brace.js +85 -100
- package/dist/annotate/curly-brace.js.map +1 -1
- package/dist/annotate/emphasis-mark.d.ts +43 -9
- package/dist/annotate/emphasis-mark.d.ts.map +1 -1
- package/dist/annotate/emphasis-mark.js +33 -34
- package/dist/annotate/emphasis-mark.js.map +1 -1
- package/dist/browser/chunks/chunk-ABYBW64J.js +2 -0
- package/dist/browser/chunks/chunk-ABYBW64J.js.map +7 -0
- package/dist/browser/chunks/chunk-K77KLQX4.js +2 -0
- package/dist/browser/chunks/chunk-K77KLQX4.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/tex.js +1 -1
- package/dist/browser/tex.js.map +2 -2
- package/dist/engine.d.ts +26 -19
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +17 -14
- package/dist/engine.js.map +1 -1
- package/dist/kit/component.d.ts +51 -0
- package/dist/kit/component.d.ts.map +1 -0
- package/dist/kit/component.js +30 -0
- package/dist/kit/component.js.map +1 -0
- package/dist/kit/curve.d.ts +22 -11
- package/dist/kit/curve.d.ts.map +1 -1
- package/dist/kit/curve.js +25 -18
- package/dist/kit/curve.js.map +1 -1
- package/dist/kit/field-mark.d.ts +58 -35
- package/dist/kit/field-mark.d.ts.map +1 -1
- package/dist/kit/field-mark.js +100 -120
- package/dist/kit/field-mark.js.map +1 -1
- package/dist/kit/follow.d.ts +67 -29
- package/dist/kit/follow.d.ts.map +1 -1
- package/dist/kit/follow.js +114 -110
- package/dist/kit/follow.js.map +1 -1
- package/dist/kit/furniture.d.ts +3 -1
- package/dist/kit/furniture.d.ts.map +1 -1
- package/dist/kit/furniture.js +5 -0
- package/dist/kit/furniture.js.map +1 -1
- package/dist/kit/graph.d.ts +46 -0
- package/dist/kit/graph.d.ts.map +1 -0
- package/dist/kit/graph.js +90 -0
- package/dist/kit/graph.js.map +1 -0
- package/dist/kit/mark.d.ts +64 -39
- package/dist/kit/mark.d.ts.map +1 -1
- package/dist/kit/mark.js +80 -96
- package/dist/kit/mark.js.map +1 -1
- package/dist/kit/place.d.ts +10 -8
- package/dist/kit/place.d.ts.map +1 -1
- package/dist/kit/place.js +28 -30
- package/dist/kit/place.js.map +1 -1
- package/dist/kit/system.d.ts +27 -29
- package/dist/kit/system.d.ts.map +1 -1
- package/dist/kit/system.js +62 -58
- package/dist/kit/system.js.map +1 -1
- package/dist/kit/withdrawn.d.ts +3 -3
- package/dist/kit/withdrawn.js +3 -3
- package/dist/kit/withdrawn.js.map +1 -1
- package/dist/marks/curve-area.d.ts +24 -18
- package/dist/marks/curve-area.d.ts.map +1 -1
- package/dist/marks/curve-area.js +50 -73
- package/dist/marks/curve-area.js.map +1 -1
- package/dist/marks/drop-lines.d.ts +28 -10
- package/dist/marks/drop-lines.d.ts.map +1 -1
- package/dist/marks/drop-lines.js +37 -52
- package/dist/marks/drop-lines.js.map +1 -1
- package/dist/marks/plot-point.d.ts +37 -20
- package/dist/marks/plot-point.d.ts.map +1 -1
- package/dist/marks/plot-point.js +65 -91
- package/dist/marks/plot-point.js.map +1 -1
- package/dist/marks/riemann-sum.d.ts +30 -26
- package/dist/marks/riemann-sum.d.ts.map +1 -1
- package/dist/marks/riemann-sum.js +57 -85
- package/dist/marks/riemann-sum.js.map +1 -1
- package/dist/marks/tangent-line.d.ts +38 -14
- package/dist/marks/tangent-line.d.ts.map +1 -1
- package/dist/marks/tangent-line.js +73 -87
- package/dist/marks/tangent-line.js.map +1 -1
- package/dist/marks/vector-arrow.d.ts +30 -20
- package/dist/marks/vector-arrow.d.ts.map +1 -1
- package/dist/marks/vector-arrow.js +58 -78
- package/dist/marks/vector-arrow.js.map +1 -1
- package/dist/nodes.d.ts +13 -5
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +0 -6
- package/dist/nodes.js.map +1 -1
- package/dist/plots/function-plot.d.ts +107 -43
- package/dist/plots/function-plot.d.ts.map +1 -1
- package/dist/plots/function-plot.js +146 -177
- package/dist/plots/function-plot.js.map +1 -1
- package/dist/plots/points-plot.d.ts +34 -19
- package/dist/plots/points-plot.d.ts.map +1 -1
- package/dist/plots/points-plot.js +31 -58
- package/dist/plots/points-plot.js.map +1 -1
- package/dist/plots/stream-lines.d.ts +38 -19
- package/dist/plots/stream-lines.d.ts.map +1 -1
- package/dist/plots/stream-lines.js +60 -79
- package/dist/plots/stream-lines.js.map +1 -1
- package/dist/plots/traced-path.d.ts +34 -15
- package/dist/plots/traced-path.d.ts.map +1 -1
- package/dist/plots/traced-path.js +33 -48
- package/dist/plots/traced-path.js.map +1 -1
- package/dist/plots/vector-field.d.ts +31 -11
- package/dist/plots/vector-field.d.ts.map +1 -1
- package/dist/plots/vector-field.js +50 -64
- package/dist/plots/vector-field.js.map +1 -1
- package/dist/structures/network-graph.d.ts +99 -49
- package/dist/structures/network-graph.d.ts.map +1 -1
- package/dist/structures/network-graph.js +168 -217
- package/dist/structures/network-graph.js.map +1 -1
- package/dist/structures/sample-space.d.ts +69 -38
- package/dist/structures/sample-space.d.ts.map +1 -1
- package/dist/structures/sample-space.js +132 -170
- package/dist/structures/sample-space.js.map +1 -1
- package/dist/systems/axes2d.d.ts +126 -37
- package/dist/systems/axes2d.d.ts.map +1 -1
- package/dist/systems/axes2d.js +147 -183
- package/dist/systems/axes2d.js.map +1 -1
- package/dist/systems/number-line.d.ts +51 -28
- package/dist/systems/number-line.d.ts.map +1 -1
- package/dist/systems/number-line.js +82 -118
- package/dist/systems/number-line.js.map +1 -1
- package/dist/systems/number-plane.d.ts +92 -31
- package/dist/systems/number-plane.d.ts.map +1 -1
- package/dist/systems/number-plane.js +142 -149
- package/dist/systems/number-plane.js.map +1 -1
- package/dist/systems/polar-plane.d.ts +47 -26
- package/dist/systems/polar-plane.d.ts.map +1 -1
- package/dist/systems/polar-plane.js +107 -133
- package/dist/systems/polar-plane.js.map +1 -1
- package/dist/tex/index.d.ts.map +1 -1
- package/dist/tex/index.js +1 -0
- package/dist/tex/index.js.map +1 -1
- package/dist/tex/matrix.d.ts +56 -18
- package/dist/tex/matrix.d.ts.map +1 -1
- package/dist/tex/matrix.js +33 -50
- package/dist/tex/matrix.js.map +1 -1
- package/dist/tex/node.d.ts +55 -201
- package/dist/tex/node.d.ts.map +1 -1
- package/dist/tex/node.js +23 -593
- package/dist/tex/node.js.map +1 -1
- package/dist/tex/typeset.d.ts +133 -0
- package/dist/tex/typeset.d.ts.map +1 -0
- package/dist/tex/typeset.js +403 -0
- package/dist/tex/typeset.js.map +1 -0
- package/dist/three/axes3d.d.ts +140 -54
- package/dist/three/axes3d.d.ts.map +1 -1
- package/dist/three/axes3d.js +159 -204
- package/dist/three/axes3d.js.map +1 -1
- package/dist/three/curve-plot3d.d.ts +70 -42
- package/dist/three/curve-plot3d.d.ts.map +1 -1
- package/dist/three/curve-plot3d.js +97 -132
- package/dist/three/curve-plot3d.js.map +1 -1
- package/dist/three/entries.d.ts +17 -0
- package/dist/three/entries.d.ts.map +1 -0
- package/dist/three/entries.js +15 -0
- package/dist/three/entries.js.map +1 -0
- package/dist/three/plot-point3d.d.ts +57 -12
- package/dist/three/plot-point3d.d.ts.map +1 -1
- package/dist/three/plot-point3d.js +27 -53
- package/dist/three/plot-point3d.js.map +1 -1
- package/dist/three/space.d.ts +17 -2
- package/dist/three/space.d.ts.map +1 -1
- package/dist/three/space.js +19 -8
- package/dist/three/space.js.map +1 -1
- package/dist/three/surface-plot3d.d.ts +131 -49
- package/dist/three/surface-plot3d.d.ts.map +1 -1
- package/dist/three/surface-plot3d.js +227 -261
- package/dist/three/surface-plot3d.js.map +1 -1
- package/dist/three/vector-arrow3d.d.ts +58 -16
- package/dist/three/vector-arrow3d.d.ts.map +1 -1
- package/dist/three/vector-arrow3d.js +48 -67
- package/dist/three/vector-arrow3d.js.map +1 -1
- package/package.json +4 -4
- package/src/annotate/angle-mark.ts +95 -105
- package/src/annotate/curly-brace.ts +107 -85
- package/src/annotate/emphasis-mark.ts +55 -26
- package/src/engine.ts +35 -21
- package/src/kit/component.ts +57 -0
- package/src/kit/curve.ts +38 -20
- package/src/kit/field-mark.ts +124 -108
- package/src/kit/follow.ts +146 -120
- package/src/kit/furniture.ts +6 -1
- package/src/kit/graph.ts +116 -0
- package/src/kit/mark.ts +135 -114
- package/src/kit/place.ts +32 -56
- package/src/kit/system.ts +77 -71
- package/src/kit/withdrawn.ts +3 -3
- package/src/marks/curve-area.ts +65 -65
- package/src/marks/drop-lines.ts +50 -42
- package/src/marks/plot-point.ts +77 -82
- package/src/marks/riemann-sum.ts +73 -72
- package/src/marks/tangent-line.ts +87 -71
- package/src/marks/vector-arrow.ts +73 -73
- package/src/nodes.ts +41 -5
- package/src/plots/function-plot.ts +155 -171
- package/src/plots/points-plot.ts +46 -50
- package/src/plots/stream-lines.ts +75 -66
- package/src/plots/traced-path.ts +51 -33
- package/src/plots/vector-field.ts +68 -49
- package/src/structures/network-graph.ts +168 -185
- package/src/structures/sample-space.ts +149 -148
- package/src/systems/axes2d.ts +165 -156
- package/src/systems/number-line.ts +91 -92
- package/src/systems/number-plane.ts +149 -120
- package/src/systems/polar-plane.ts +117 -116
- package/src/tex/index.ts +2 -1
- package/src/tex/matrix.ts +62 -40
- package/src/tex/node.ts +54 -621
- package/src/tex/typeset.ts +461 -0
- package/src/three/axes3d.ts +182 -161
- package/src/three/curve-plot3d.ts +107 -110
- package/src/three/entries.ts +42 -0
- package/src/three/plot-point3d.ts +42 -45
- package/src/three/space.ts +34 -9
- package/src/three/surface-plot3d.ts +312 -323
- package/src/three/vector-arrow3d.ts +65 -54
- package/dist/browser/chunks/chunk-3GJB6AVO.js +0 -2
- package/dist/browser/chunks/chunk-3GJB6AVO.js.map +0 -7
- package/dist/browser/chunks/chunk-D5WHCVBC.js +0 -2
- package/dist/browser/chunks/chunk-D5WHCVBC.js.map +0 -7
- package/dist/browser/chunks/chunk-WL4KEX7Y.js +0 -2
- package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +0 -7
- package/src/kit/placement.ts +0 -8
package/dist/kit/mark.d.ts
CHANGED
|
@@ -1,47 +1,72 @@
|
|
|
1
|
-
import { Graphics2D,
|
|
1
|
+
import { Graphics2D, type ChildView, type Extents, type Fill, type RenderContext, type Shadow, type Size2D, type Stroke, type Vector2 } from "@motionscript/sdk";
|
|
2
2
|
import { type CoordinateMap } from "./coords.js";
|
|
3
|
+
import type { GraphPlane } from "./graph.js";
|
|
3
4
|
/**
|
|
4
|
-
* A node drawn in graph coordinates: a plot, an area, an arrow
|
|
5
|
-
* graph points. It answers with runs of pixel points and is
|
|
6
|
-
*
|
|
7
|
-
* is the tight box of its ink.
|
|
5
|
+
* A mark is a node drawn in graph coordinates: a plot, an area, an arrow
|
|
6
|
+
* between two graph points. It answers with runs of pixel points and is
|
|
7
|
+
* otherwise a shape, so its box is the tight box of its ink.
|
|
8
8
|
*
|
|
9
|
-
* Inside a coordinate system the
|
|
10
|
-
*
|
|
11
|
-
* Outside one a graph unit is a pixel and `x`/`y` are the usual
|
|
12
|
-
*
|
|
13
|
-
* A mark that takes children holds them on the same map it is drawn through: a
|
|
14
|
-
* plot holding the area under it and the point that rides it.
|
|
9
|
+
* Inside a coordinate system (or a plot) the holder lays it out on that ink,
|
|
10
|
+
* calling the mark's own trace with its map, and the mark's `x`/`y` are a shift
|
|
11
|
+
* in graph units. Outside one a graph unit is a pixel and `x`/`y` are the usual
|
|
12
|
+
* offset.
|
|
15
13
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
/** What a mark is traced through: the map, its own `x`/`y` as a shift, and the plane it reads curves from. */
|
|
15
|
+
export interface MarkReading {
|
|
16
|
+
readonly map: CoordinateMap;
|
|
17
|
+
/** Zero outside a system, where `x`/`y` are pixels. */
|
|
18
|
+
readonly shift: Vector2;
|
|
19
|
+
readonly plane: GraphPlane | null;
|
|
20
|
+
}
|
|
21
|
+
/** The runs a mark draws, in pixels, y-up from the system's centre. */
|
|
22
|
+
export type Tracer<V> = (state: V, read: MarkReading) => Vector2[][];
|
|
23
|
+
/** What every mark's state reads: its place, and the plane it is laid out on. */
|
|
24
|
+
export interface MarkState {
|
|
25
|
+
readonly x: number;
|
|
26
|
+
readonly y: number;
|
|
27
|
+
readonly graph: GraphPlane | null;
|
|
28
|
+
}
|
|
29
|
+
/** `component`, declared a mark: a holder lays it out on the ink `trace` draws. Hand back the component. */
|
|
30
|
+
export declare function traced<C extends {
|
|
31
|
+
is(child: ChildView): boolean;
|
|
32
|
+
}>(component: C, trace: Tracer<never>): C;
|
|
33
|
+
/** The runs `child` draws on `plane`, or `undefined` for a child that is no mark. */
|
|
34
|
+
export declare function markRuns(child: ChildView, map: CoordinateMap, plane: GraphPlane): Vector2[][] | undefined;
|
|
35
|
+
/** How a mark's own fields read it: through its plane's map when one lays it out, through pixels when none does. */
|
|
36
|
+
export declare function reading(state: MarkState): MarkReading;
|
|
37
|
+
/** The size of a mark's ink: its box when a node other than a system lays it out. */
|
|
38
|
+
export declare function inkSize(runs: readonly (readonly Vector2[])[]): Size2D;
|
|
39
|
+
/** The centre of `runs`' ink in the map's pixels: where a mark's children are placed from. */
|
|
40
|
+
export declare function inkCentre(runs: readonly (readonly Vector2[])[]): Vector2;
|
|
41
|
+
/** A graph point in a mark's own frame, where a handle on it sits. */
|
|
42
|
+
export declare function ownPoint(read: MarkReading, runs: readonly (readonly Vector2[])[], point: Vector2): Vector2;
|
|
43
|
+
/** The graph point at `at` in a mark's own frame: {@link ownPoint} undone. */
|
|
44
|
+
export declare function graphPoint(read: MarkReading, runs: readonly (readonly Vector2[])[], at: Vector2): Vector2;
|
|
45
|
+
/** What a mark paints with: a shape's paints, any it withdrew left out. */
|
|
46
|
+
export interface MarkPaint {
|
|
47
|
+
readonly fill?: Fill;
|
|
48
|
+
readonly stroke?: Stroke;
|
|
49
|
+
readonly shadow: Shadow;
|
|
50
|
+
readonly start?: number;
|
|
51
|
+
readonly end?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface MarkOptions {
|
|
19
54
|
/** Whether each run is closed into an outline. */
|
|
20
|
-
|
|
21
|
-
/** This mark's own `x`/`y` as a shift in graph units: zero outside a system, where they are pixels. */
|
|
22
|
-
protected shift(): Vector2;
|
|
23
|
-
/** A graph point in this mark's own frame, where a handle on it sits. */
|
|
24
|
-
protected ownPoint(point: Vector2): Vector2;
|
|
25
|
-
/** The graph point at `at` in this mark's own frame: {@link ownPoint} undone. */
|
|
26
|
-
protected graphPoint(at: Vector2): Vector2;
|
|
55
|
+
readonly closed?: boolean;
|
|
27
56
|
/** Whether the fill is painted: a mark whose ink has no inside yet (an open line) says no. */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
protected renderSelf(ctx: RenderContext2D): void;
|
|
32
|
-
/** The stroke along the ink. A mark that strokes it differently overrides this, not `renderStroke`. */
|
|
33
|
-
protected renderInk(ctx: RenderContext2D): void;
|
|
34
|
-
protected renderStroke(): void;
|
|
35
|
-
protected layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void;
|
|
36
|
-
_planeOf(child: Node2D | null): ChildPlane | null;
|
|
37
|
-
private _data;
|
|
38
|
-
private _ink;
|
|
39
|
-
private _inSystem;
|
|
40
|
-
private _map;
|
|
41
|
-
private _planes;
|
|
42
|
-
/** Its own centre in the map's pixels: where its children's boxes are placed from. */
|
|
43
|
-
private _centre;
|
|
44
|
-
/** @internal What a system lays this mark out on: its ink, drawn through `map`. */
|
|
45
|
-
_resolve(map: CoordinateMap, inSystem?: boolean): Extents | null;
|
|
57
|
+
readonly fills?: boolean;
|
|
58
|
+
/** The stroke along the ink, when it is not the plain one. */
|
|
59
|
+
readonly ink?: (ctx: RenderContext, ink: Extents) => void;
|
|
46
60
|
}
|
|
61
|
+
/** One mark's outline, the same commands for each paint. */
|
|
62
|
+
export declare function markShape(runs: readonly (readonly Vector2[])[], s: MarkPaint, closed?: boolean): (() => Graphics2D) | null;
|
|
63
|
+
/**
|
|
64
|
+
* A mark's paint: the fill under the stroke along its ink, both before its
|
|
65
|
+
* children, so a point or a tangent riding a plot sits on the curve.
|
|
66
|
+
*/
|
|
67
|
+
export declare function drawMark(ctx: RenderContext, s: MarkPaint, runs: readonly (readonly Vector2[])[], options?: MarkOptions): void;
|
|
68
|
+
/** The stroke along a shape, casting the shadow when nothing fills it. */
|
|
69
|
+
export declare function strokeShape(ctx: RenderContext, shape: () => Graphics2D, s: MarkPaint): void;
|
|
70
|
+
/** A shadow is cast by the stroke when nothing visible fills the shape. */
|
|
71
|
+
export declare function castsShadow(s: MarkPaint): boolean;
|
|
47
72
|
//# sourceMappingURL=mark.d.ts.map
|
package/dist/kit/mark.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../src/kit/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../src/kit/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,MAAM,EAEX,KAAK,OAAO,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,M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G,IAAI,CASjI;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,CAI3F;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAGjD"}
|
package/dist/kit/mark.js
CHANGED
|
@@ -1,103 +1,87 @@
|
|
|
1
|
-
import { Graphics2D,
|
|
1
|
+
import { Graphics2D, } from "@motionscript/sdk";
|
|
2
|
+
import { painted } from "./component.js";
|
|
2
3
|
import { PIXEL_MAP } from "./coords.js";
|
|
3
4
|
import { boundsOfRuns, runsToPath } from "./geometry.js";
|
|
4
|
-
|
|
5
|
+
const NO_SHIFT = { x: 0, y: 0 };
|
|
6
|
+
const tracers = [];
|
|
7
|
+
/** `component`, declared a mark: a holder lays it out on the ink `trace` draws. Hand back the component. */
|
|
8
|
+
export function traced(component, trace) {
|
|
9
|
+
tracers.push({ is: (child) => component.is(child), trace });
|
|
10
|
+
return component;
|
|
11
|
+
}
|
|
12
|
+
/** The runs `child` draws on `plane`, or `undefined` for a child that is no mark. */
|
|
13
|
+
export function markRuns(child, map, plane) {
|
|
14
|
+
const mark = tracers.find((entry) => entry.is(child));
|
|
15
|
+
if (!mark)
|
|
16
|
+
return undefined;
|
|
17
|
+
const state = child.state;
|
|
18
|
+
return mark.trace(state, { map, shift: { x: state.x, y: state.y }, plane });
|
|
19
|
+
}
|
|
20
|
+
/** How a mark's own fields read it: through its plane's map when one lays it out, through pixels when none does. */
|
|
21
|
+
export function reading(state) {
|
|
22
|
+
const plane = state.graph;
|
|
23
|
+
return plane ? { map: plane.map, shift: { x: state.x, y: state.y }, plane } : { map: PIXEL_MAP, shift: NO_SHIFT, plane: null };
|
|
24
|
+
}
|
|
25
|
+
/** The size of a mark's ink: its box when a node other than a system lays it out. */
|
|
26
|
+
export function inkSize(runs) {
|
|
27
|
+
const ink = boundsOfRuns(runs);
|
|
28
|
+
return ink ? { width: ink.maxX - ink.minX, height: ink.maxY - ink.minY } : { width: 0, height: 0 };
|
|
29
|
+
}
|
|
30
|
+
/** The centre of `runs`' ink in the map's pixels: where a mark's children are placed from. */
|
|
31
|
+
export function inkCentre(runs) {
|
|
32
|
+
const ink = boundsOfRuns(runs);
|
|
33
|
+
return ink ? { x: (ink.minX + ink.maxX) / 2, y: (ink.minY + ink.maxY) / 2 } : NO_SHIFT;
|
|
34
|
+
}
|
|
35
|
+
/** A graph point in a mark's own frame, where a handle on it sits. */
|
|
36
|
+
export function ownPoint(read, runs, point) {
|
|
37
|
+
const at = read.map.toPoint(point.x + read.shift.x, point.y + read.shift.y);
|
|
38
|
+
const centre = inkCentre(runs);
|
|
39
|
+
return { x: at.x - centre.x, y: at.y - centre.y };
|
|
40
|
+
}
|
|
41
|
+
/** The graph point at `at` in a mark's own frame: {@link ownPoint} undone. */
|
|
42
|
+
export function graphPoint(read, runs, at) {
|
|
43
|
+
const centre = inkCentre(runs);
|
|
44
|
+
const point = read.map.toCoords(at.x + centre.x, at.y + centre.y);
|
|
45
|
+
return { x: point.x - read.shift.x, y: point.y - read.shift.y };
|
|
46
|
+
}
|
|
47
|
+
const NONE = [];
|
|
48
|
+
/** One mark's outline, the same commands for each paint. */
|
|
49
|
+
export function markShape(runs, s, closed = false) {
|
|
50
|
+
const ink = boundsOfRuns(runs);
|
|
51
|
+
const data = runsToPath(runs, closed);
|
|
52
|
+
if (!ink || data.length === 0)
|
|
53
|
+
return null;
|
|
54
|
+
const centerBounds = [ink.minX, ink.minY, ink.maxX, ink.maxY];
|
|
55
|
+
return () => new Graphics2D().path({ data, centerBounds, start: s.start ?? 0, end: s.end ?? 1 });
|
|
56
|
+
}
|
|
5
57
|
/**
|
|
6
|
-
* A
|
|
7
|
-
*
|
|
8
|
-
* so fill, stroke, shadow and `progressTo` are the inherited ones and its box
|
|
9
|
-
* is the tight box of its ink.
|
|
10
|
-
*
|
|
11
|
-
* Inside a coordinate system the system lays it out and its own `x`/`y` are a
|
|
12
|
-
* shift in graph units, which {@link shift} reports and {@link trace} applies.
|
|
13
|
-
* Outside one a graph unit is a pixel and `x`/`y` are the usual offset.
|
|
14
|
-
*
|
|
15
|
-
* A mark that takes children holds them on the same map it is drawn through: a
|
|
16
|
-
* plot holding the area under it and the point that rides it.
|
|
58
|
+
* A mark's paint: the fill under the stroke along its ink, both before its
|
|
59
|
+
* children, so a point or a tangent riding a plot sits on the curve.
|
|
17
60
|
*/
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
61
|
+
export function drawMark(ctx, s, runs, options = {}) {
|
|
62
|
+
const shape = markShape(runs, s, options.closed);
|
|
63
|
+
const fill = s.fill ?? NONE;
|
|
64
|
+
painted(ctx, () => {
|
|
65
|
+
if (shape && options.fills !== false)
|
|
66
|
+
ctx.draw(shape().shadow(s.shadow).fill(fill));
|
|
67
|
+
const ink = options.ink ? boundsOfRuns(runs) : null;
|
|
68
|
+
if (ink && options.ink)
|
|
69
|
+
options.ink(ctx, ink);
|
|
70
|
+
else if (shape)
|
|
71
|
+
strokeShape(ctx, shape, s);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** The stroke along a shape, casting the shadow when nothing fills it. */
|
|
75
|
+
export function strokeShape(ctx, shape, s) {
|
|
76
|
+
const stroke = (s.stroke ?? NONE);
|
|
77
|
+
if (stroke.length === 0)
|
|
78
|
+
return;
|
|
79
|
+
ctx.draw(castsShadow(s) ? shape().shadow(s.shadow).stroke(stroke) : shape().stroke(stroke));
|
|
80
|
+
}
|
|
81
|
+
/** A shadow is cast by the stroke when nothing visible fills the shape. */
|
|
82
|
+
export function castsShadow(s) {
|
|
83
|
+
if (s.shadow.length === 0)
|
|
21
84
|
return false;
|
|
22
|
-
|
|
23
|
-
/** This mark's own `x`/`y` as a shift in graph units: zero outside a system, where they are pixels. */
|
|
24
|
-
shift() {
|
|
25
|
-
return this._inSystem ? { x: this.x, y: this.y } : NO_SHIFT;
|
|
26
|
-
}
|
|
27
|
-
/** A graph point in this mark's own frame, where a handle on it sits. */
|
|
28
|
-
ownPoint(point) {
|
|
29
|
-
const shift = this.shift();
|
|
30
|
-
const at = this._map.toPoint(point.x + shift.x, point.y + shift.y);
|
|
31
|
-
const centre = this._centre();
|
|
32
|
-
return { x: at.x - centre.x, y: at.y - centre.y };
|
|
33
|
-
}
|
|
34
|
-
/** The graph point at `at` in this mark's own frame: {@link ownPoint} undone. */
|
|
35
|
-
graphPoint(at) {
|
|
36
|
-
const shift = this.shift();
|
|
37
|
-
const centre = this._centre();
|
|
38
|
-
const point = this._map.toCoords(at.x + centre.x, at.y + centre.y);
|
|
39
|
-
return { x: point.x - shift.x, y: point.y - shift.y };
|
|
40
|
-
}
|
|
41
|
-
/** Whether the fill is painted: a mark whose ink has no inside yet (an open line) says no. */
|
|
42
|
-
paintsFill() {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
measure() {
|
|
46
|
-
const ink = this._resolve(PIXEL_MAP, false);
|
|
47
|
-
return ink ? { width: ink.maxX - ink.minX, height: ink.maxY - ink.minY } : { width: 0, height: 0 };
|
|
48
|
-
}
|
|
49
|
-
shapeGraphics() {
|
|
50
|
-
const ink = this._ink;
|
|
51
|
-
if (!ink || this._data.length === 0)
|
|
52
|
-
return null;
|
|
53
|
-
return new Graphics2D().path({
|
|
54
|
-
data: this._data,
|
|
55
|
-
centerBounds: [ink.minX, ink.minY, ink.maxX, ink.maxY],
|
|
56
|
-
start: this.start,
|
|
57
|
-
end: this.end,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
// A mark's stroke is its ink, so it is painted before its children rather
|
|
61
|
-
// than over them: a point or a tangent riding a plot sits on the curve.
|
|
62
|
-
renderSelf(ctx) {
|
|
63
|
-
if (this.paintsFill())
|
|
64
|
-
super.renderSelf(ctx);
|
|
65
|
-
this.renderInk(ctx);
|
|
66
|
-
}
|
|
67
|
-
/** The stroke along the ink. A mark that strokes it differently overrides this, not `renderStroke`. */
|
|
68
|
-
renderInk(ctx) {
|
|
69
|
-
super.renderStroke(ctx);
|
|
70
|
-
}
|
|
71
|
-
renderStroke() { }
|
|
72
|
-
layoutChildren(rect, scope) {
|
|
73
|
-
const children = this.flowChildren();
|
|
74
|
-
if (children.length === 0)
|
|
75
|
-
return;
|
|
76
|
-
const room = { x: 0, y: 0, width: rect.width, height: rect.height };
|
|
77
|
-
this._planes = placeOnMap(children, this._map, this._centre(), room, scope);
|
|
78
|
-
}
|
|
79
|
-
_planeOf(child) {
|
|
80
|
-
return child ? (this._planes.get(child) ?? null) : openPlane(this._map, this._centre());
|
|
81
|
-
}
|
|
82
|
-
_data = [];
|
|
83
|
-
_ink = null;
|
|
84
|
-
_inSystem = false;
|
|
85
|
-
_map = PIXEL_MAP;
|
|
86
|
-
_planes = new WeakMap();
|
|
87
|
-
/** Its own centre in the map's pixels: where its children's boxes are placed from. */
|
|
88
|
-
_centre() {
|
|
89
|
-
const ink = this._ink;
|
|
90
|
-
return ink ? { x: (ink.minX + ink.maxX) / 2, y: (ink.minY + ink.maxY) / 2 } : NO_SHIFT;
|
|
91
|
-
}
|
|
92
|
-
/** @internal What a system lays this mark out on: its ink, drawn through `map`. */
|
|
93
|
-
_resolve(map, inSystem = true) {
|
|
94
|
-
this._inSystem = inSystem;
|
|
95
|
-
this._map = map;
|
|
96
|
-
const runs = this.trace(map);
|
|
97
|
-
this._data = runsToPath(runs, this.isClosed());
|
|
98
|
-
this._ink = boundsOfRuns(runs);
|
|
99
|
-
return this._ink;
|
|
100
|
-
}
|
|
85
|
+
return !(s.fill ?? NONE).some((layer) => (layer.opacity ?? 1) > 0);
|
|
101
86
|
}
|
|
102
|
-
const NO_SHIFT = { x: 0, y: 0 };
|
|
103
87
|
//# sourceMappingURL=mark.js.map
|
package/dist/kit/mark.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark.js","sourceRoot":"","sources":["../../src/kit/mark.ts"],"names":[],"mapp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CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3F,CAAC;IAED,mFAAmF;IACnF,QAAQ,CAAC,GAAkB,EAAE,QAAQ,GAAG,IAAI;QACxC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AAED,MAAM,QAAQ,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC","sourcesContent":["import {\r\n Graphics2D,\r\n PaintNode,\r\n type BoxBounds,\r\n type ChildPlane,\r\n type Extents,\r\n type MeasureContext2D,\r\n type Node2D,\r\n type PaintProps,\r\n type PathCommand,\r\n type RenderContext2D,\r\n type Size2D,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { PIXEL_MAP, type CoordinateMap } from \"./coords\";\r\nimport { boundsOfRuns, runsToPath } from \"./geometry\";\r\nimport { openPlane, placeOnMap } from \"./place\";\r\n\r\n/**\r\n * A node drawn in graph coordinates: a plot, an area, an arrow between two\r\n * graph points. It answers with runs of pixel points and is otherwise a shape,\r\n * so fill, stroke, shadow and `progressTo` are the inherited ones and its box\r\n * is the tight box of its ink.\r\n *\r\n * Inside a coordinate system the system lays it out and its own `x`/`y` are a\r\n * shift in graph units, which {@link shift} reports and {@link trace} applies.\r\n * Outside one a graph unit is a pixel and `x`/`y` are the usual offset.\r\n *\r\n * A mark that takes children holds them on the same map it is drawn through: a\r\n * plot holding the area under it and the point that rides it.\r\n */\r\nexport abstract class Mark<P extends PaintProps = PaintProps> extends PaintNode<P> {\r\n /** The runs this mark draws, in pixels, y-up from the system's centre. */\r\n protected abstract trace(map: CoordinateMap): Vector2[][];\r\n\r\n /** Whether each run is closed into an outline. */\r\n protected isClosed(): boolean {\r\n return false;\r\n }\r\n\r\n /** This mark's own `x`/`y` as a shift in graph units: zero outside a system, where they are pixels. */\r\n protected shift(): Vector2 {\r\n return this._inSystem ? { x: this.x, y: this.y } : NO_SHIFT;\r\n }\r\n\r\n /** A graph point in this mark's own frame, where a handle on it sits. */\r\n protected ownPoint(point: Vector2): Vector2 {\r\n const shift = this.shift();\r\n const at = this._map.toPoint(point.x + shift.x, point.y + shift.y);\r\n const centre = this._centre();\r\n return { x: at.x - centre.x, y: at.y - centre.y };\r\n }\r\n\r\n /** The graph point at `at` in this mark's own frame: {@link ownPoint} undone. */\r\n protected graphPoint(at: Vector2): Vector2 {\r\n const shift = this.shift();\r\n const centre = this._centre();\r\n const point = this._map.toCoords(at.x + centre.x, at.y + centre.y);\r\n return { x: point.x - shift.x, y: point.y - shift.y };\r\n }\r\n\r\n /** Whether the fill is painted: a mark whose ink has no inside yet (an open line) says no. */\r\n protected paintsFill(): boolean {\r\n return true;\r\n }\r\n\r\n override measure(): Partial<Size2D> {\r\n const ink = this._resolve(PIXEL_MAP, false);\r\n return ink ? { width: ink.maxX - ink.minX, height: ink.maxY - ink.minY } : { width: 0, height: 0 };\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D | null {\r\n const ink = this._ink;\r\n if (!ink || this._data.length === 0) return null;\r\n return new Graphics2D().path({\r\n data: this._data,\r\n centerBounds: [ink.minX, ink.minY, ink.maxX, ink.maxY],\r\n start: this.start,\r\n end: this.end,\r\n });\r\n }\r\n\r\n // A mark's stroke is its ink, so it is painted before its children rather\r\n // than over them: a point or a tangent riding a plot sits on the curve.\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n if (this.paintsFill()) super.renderSelf(ctx);\r\n this.renderInk(ctx);\r\n }\r\n\r\n /** The stroke along the ink. A mark that strokes it differently overrides this, not `renderStroke`. */\r\n protected renderInk(ctx: RenderContext2D): void {\r\n super.renderStroke(ctx);\r\n }\r\n\r\n protected override renderStroke(): void {}\r\n\r\n protected override layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void {\r\n const children = this.flowChildren();\r\n if (children.length === 0) return;\r\n const room = { x: 0, y: 0, width: rect.width, height: rect.height };\r\n this._planes = placeOnMap(children, this._map, this._centre(), room, scope);\r\n }\r\n\r\n override _planeOf(child: Node2D | null): ChildPlane | null {\r\n return child ? (this._planes.get(child) ?? null) : openPlane(this._map, this._centre());\r\n }\r\n\r\n private _data: PathCommand[] = [];\r\n private _ink: Extents | null = null;\r\n private _inSystem = false;\r\n private _map: CoordinateMap = PIXEL_MAP;\r\n private _planes = new WeakMap<Node2D, ChildPlane>();\r\n\r\n /** Its own centre in the map's pixels: where its children's boxes are placed from. */\r\n private _centre(): Vector2 {\r\n const ink = this._ink;\r\n return ink ? { x: (ink.minX + ink.maxX) / 2, y: (ink.minY + ink.maxY) / 2 } : NO_SHIFT;\r\n }\r\n\r\n /** @internal What a system lays this mark out on: its ink, drawn through `map`. */\r\n _resolve(map: CoordinateMap, inSystem = true): Extents | null {\r\n this._inSystem = inSystem;\r\n this._map = map;\r\n const runs = this.trace(map);\r\n this._data = runsToPath(runs, this.isClosed());\r\n this._ink = boundsOfRuns(runs);\r\n return this._ink;\r\n }\r\n}\r\n\r\nconst NO_SHIFT: Vector2 = { x: 0, y: 0 };\r\n"]}
|
|
1
|
+
{"version":3,"file":"mark.js","sourceRoot":"","sources":["../../src/kit/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,GAUb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,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AC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,WAAW,CAAC,CAAY;IACpC,IAAK,CAAC,CAAC,MAAoB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvD,OAAO,CAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAA4B,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnG,CAAC","sourcesContent":["import {\r\n Graphics2D,\r\n type ChildView,\r\n type Extents,\r\n type Fill,\r\n type RenderContext,\r\n type Shadow,\r\n type Size2D,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { painted } from \"./component\";\r\nimport { PIXEL_MAP, type CoordinateMap } from \"./coords\";\r\nimport { boundsOfRuns, runsToPath } from \"./geometry\";\r\nimport type { GraphPlane } from \"./graph\";\r\n\r\n/**\r\n * A mark is a node drawn in graph coordinates: a plot, an area, an arrow\r\n * between two graph points. It answers with runs of pixel points and is\r\n * otherwise a shape, so its box is the tight box of its ink.\r\n *\r\n * Inside a coordinate system (or a plot) the holder lays it out on that ink,\r\n * calling the mark's own trace with its map, and the mark's `x`/`y` are a shift\r\n * in graph units. Outside one a graph unit is a pixel and `x`/`y` are the usual\r\n * offset.\r\n */\r\n\r\n/** What a mark is traced through: the map, its own `x`/`y` as a shift, and the plane it reads curves from. */\r\nexport interface MarkReading {\r\n readonly map: CoordinateMap;\r\n /** Zero outside a system, where `x`/`y` are pixels. */\r\n readonly shift: Vector2;\r\n readonly plane: GraphPlane | null;\r\n}\r\n\r\n/** The runs a mark draws, in pixels, y-up from the system's centre. */\r\nexport type Tracer<V> = (state: V, read: MarkReading) => Vector2[][];\r\n\r\n/** What every mark's state reads: its place, and the plane it is laid out on. */\r\nexport interface MarkState {\r\n readonly x: number;\r\n readonly y: number;\r\n readonly graph: GraphPlane | null;\r\n}\r\n\r\nconst NO_SHIFT: Vector2 = { x: 0, y: 0 };\r\n\r\nconst tracers: { readonly is: (child: ChildView) => boolean; readonly trace: Tracer<never> }[] = [];\r\n\r\n/** `component`, declared a mark: a holder lays it out on the ink `trace` draws. Hand back the component. */\r\nexport function traced<C extends { is(child: ChildView): boolean }>(component: C, trace: Tracer<never>): C {\r\n tracers.push({ is: (child) => component.is(child), trace });\r\n return component;\r\n}\r\n\r\n/** The runs `child` draws on `plane`, or `undefined` for a child that is no mark. */\r\nexport function markRuns(child: ChildView, map: CoordinateMap, plane: GraphPlane): Vector2[][] | undefined {\r\n const mark = tracers.find((entry) => entry.is(child));\r\n if (!mark) return undefined;\r\n const state = child.state as unknown as MarkState;\r\n return (mark.trace as Tracer<MarkState>)(state, { map, shift: { x: state.x, y: state.y }, plane });\r\n}\r\n\r\n/** How a mark's own fields read it: through its plane's map when one lays it out, through pixels when none does. */\r\nexport function reading(state: MarkState): MarkReading {\r\n const plane = state.graph;\r\n return plane ? { map: plane.map, shift: { x: state.x, y: state.y }, plane } : { map: PIXEL_MAP, shift: NO_SHIFT, plane: null };\r\n}\r\n\r\n/** The size of a mark's ink: its box when a node other than a system lays it out. */\r\nexport function inkSize(runs: readonly (readonly Vector2[])[]): Size2D {\r\n const ink = boundsOfRuns(runs);\r\n return ink ? { width: ink.maxX - ink.minX, height: ink.maxY - ink.minY } : { width: 0, height: 0 };\r\n}\r\n\r\n/** The centre of `runs`' ink in the map's pixels: where a mark's children are placed from. */\r\nexport function inkCentre(runs: readonly (readonly Vector2[])[]): Vector2 {\r\n const ink = boundsOfRuns(runs);\r\n return ink ? { x: (ink.minX + ink.maxX) / 2, y: (ink.minY + ink.maxY) / 2 } : NO_SHIFT;\r\n}\r\n\r\n/** A graph point in a mark's own frame, where a handle on it sits. */\r\nexport function ownPoint(read: MarkReading, runs: readonly (readonly Vector2[])[], point: Vector2): Vector2 {\r\n const at = read.map.toPoint(point.x + read.shift.x, point.y + read.shift.y);\r\n const centre = inkCentre(runs);\r\n return { x: at.x - centre.x, y: at.y - centre.y };\r\n}\r\n\r\n/** The graph point at `at` in a mark's own frame: {@link ownPoint} undone. */\r\nexport function graphPoint(read: MarkReading, runs: readonly (readonly Vector2[])[], at: Vector2): Vector2 {\r\n const centre = inkCentre(runs);\r\n const point = read.map.toCoords(at.x + centre.x, at.y + centre.y);\r\n return { x: point.x - read.shift.x, y: point.y - read.shift.y };\r\n}\r\n\r\n/** What a mark paints with: a shape's paints, any it withdrew left out. */\r\nexport interface MarkPaint {\r\n readonly fill?: Fill;\r\n readonly stroke?: Stroke;\r\n readonly shadow: Shadow;\r\n readonly start?: number;\r\n readonly end?: number;\r\n}\r\n\r\nexport interface MarkOptions {\r\n /** Whether each run is closed into an outline. */\r\n readonly closed?: boolean;\r\n /** Whether the fill is painted: a mark whose ink has no inside yet (an open line) says no. */\r\n readonly fills?: boolean;\r\n /** The stroke along the ink, when it is not the plain one. */\r\n readonly ink?: (ctx: RenderContext, ink: Extents) => void;\r\n}\r\n\r\nconst NONE: never[] = [];\r\n\r\n/** One mark's outline, the same commands for each paint. */\r\nexport function markShape(runs: readonly (readonly Vector2[])[], s: MarkPaint, closed = false): (() => Graphics2D) | null {\r\n const ink = boundsOfRuns(runs);\r\n const data = runsToPath(runs, closed);\r\n if (!ink || data.length === 0) return null;\r\n const centerBounds: [number, number, number, number] = [ink.minX, ink.minY, ink.maxX, ink.maxY];\r\n return () => new Graphics2D().path({ data, centerBounds, start: s.start ?? 0, end: s.end ?? 1 });\r\n}\r\n\r\n/**\r\n * A mark's paint: the fill under the stroke along its ink, both before its\r\n * children, so a point or a tangent riding a plot sits on the curve.\r\n */\r\nexport function drawMark(ctx: RenderContext, s: MarkPaint, runs: readonly (readonly Vector2[])[], options: MarkOptions = {}): void {\r\n const shape = markShape(runs, s, options.closed);\r\n const fill = s.fill ?? NONE;\r\n painted(ctx, () => {\r\n if (shape && options.fills !== false) ctx.draw(shape().shadow(s.shadow).fill(fill));\r\n const ink = options.ink ? boundsOfRuns(runs) : null;\r\n if (ink && options.ink) options.ink(ctx, ink);\r\n else if (shape) strokeShape(ctx, shape, s);\r\n });\r\n}\r\n\r\n/** The stroke along a shape, casting the shadow when nothing fills it. */\r\nexport function strokeShape(ctx: RenderContext, shape: () => Graphics2D, s: MarkPaint): void {\r\n const stroke = (s.stroke ?? NONE) as StrokeResolved[];\r\n if (stroke.length === 0) return;\r\n ctx.draw(castsShadow(s) ? shape().shadow(s.shadow).stroke(stroke) : shape().stroke(stroke));\r\n}\r\n\r\n/** A shadow is cast by the stroke when nothing visible fills the shape. */\r\nexport function castsShadow(s: MarkPaint): boolean {\r\n if ((s.shadow as unknown[]).length === 0) return false;\r\n return !((s.fill ?? NONE) as { opacity?: number }[]).some((layer) => (layer.opacity ?? 1) > 0);\r\n}\r\n"]}
|
package/dist/kit/place.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ChildPlane, ChildView, Placement2D, Size2D, Vector2 } from "@motionscript/sdk";
|
|
2
2
|
import type { CoordinateMap } from "./coords.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { GraphPlane } from "./graph.js";
|
|
4
|
+
/** Where a child that sits somewhere other than its own `x`/`y` is (a point riding a curve), given its own `x`/`y`. */
|
|
5
|
+
export type Anchor = (x: number, y: number) => Vector2;
|
|
6
|
+
/** `component`, declared to sit at `anchor` of its own `x`/`y` on a graph. Hand back the component. */
|
|
7
|
+
export declare function anchored<C extends {
|
|
8
|
+
is(child: ChildView): boolean;
|
|
9
|
+
}>(component: C, anchor: (state: never, plane: GraphPlane) => Anchor | null): C;
|
|
8
10
|
/**
|
|
9
11
|
* Lay `children` out on `map`, for whichever node holds them: a coordinate
|
|
10
12
|
* system, or a plot holding the marks that read it. A mark goes on its ink;
|
|
11
13
|
* anything else keeps its own size and has its `x`/`y` read as graph
|
|
12
14
|
* coordinates. `origin` is the holder's own centre in the map's pixels (y-up),
|
|
13
|
-
* since a child's box is placed from there.
|
|
15
|
+
* since a child's box is placed from there.
|
|
14
16
|
*/
|
|
15
|
-
export declare function placeOnMap(children: readonly
|
|
17
|
+
export declare function placeOnMap(children: readonly ChildView[], map: CoordinateMap, origin: Vector2, room: Size2D, plane: GraphPlane): Placement2D[];
|
|
16
18
|
/** The plane of a child that is not there yet, under a holder centred on `origin`: where a host would drop one. */
|
|
17
19
|
export declare function openPlane(map: CoordinateMap, origin: Vector2): ChildPlane;
|
|
18
20
|
//# sourceMappingURL=place.d.ts.map
|
package/dist/kit/place.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place.d.ts","sourceRoot":"","sources":["../../src/kit/place.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"place.d.ts","sourceRoot":"","sources":["../../src/kit/place.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,uHAAuH;AACvH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;AAIvD,uGAAuG;AACvG,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAA;CAAE,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,CAGjJ;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,EAAE,CAqB9I;AAED,mHAAmH;AACnH,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,CAQzE"}
|
package/dist/kit/place.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
import { boundsOfRuns } from "./geometry.js";
|
|
2
|
+
import { markRuns } from "./mark.js";
|
|
3
|
+
const anchors = [];
|
|
4
|
+
/** `component`, declared to sit at `anchor` of its own `x`/`y` on a graph. Hand back the component. */
|
|
5
|
+
export function anchored(component, anchor) {
|
|
6
|
+
anchors.push({ is: (child) => component.is(child), anchor });
|
|
7
|
+
return component;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Lay `children` out on `map`, for whichever node holds them: a coordinate
|
|
10
11
|
* system, or a plot holding the marks that read it. A mark goes on its ink;
|
|
11
12
|
* anything else keeps its own size and has its `x`/`y` read as graph
|
|
12
13
|
* coordinates. `origin` is the holder's own centre in the map's pixels (y-up),
|
|
13
|
-
* since a child's box is placed from there.
|
|
14
|
+
* since a child's box is placed from there.
|
|
14
15
|
*/
|
|
15
|
-
export function placeOnMap(children, map, origin, room,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export function placeOnMap(children, map, origin, room, plane) {
|
|
17
|
+
return children.map((child) => {
|
|
18
|
+
const runs = markRuns(child, map, plane);
|
|
19
|
+
if (runs) {
|
|
20
|
+
const ink = boundsOfRuns(runs);
|
|
21
|
+
const cx = ink ? (ink.minX + ink.maxX) / 2 : origin.x;
|
|
22
|
+
const cy = ink ? (ink.minY + ink.maxY) / 2 : origin.y;
|
|
23
|
+
return {
|
|
24
|
+
x: cx - origin.x,
|
|
25
|
+
y: cy - origin.y,
|
|
26
|
+
width: ink ? ink.maxX - ink.minX : 0,
|
|
27
|
+
height: ink ? ink.maxY - ink.minY : 0,
|
|
28
|
+
plane: markPlane(map, cx, cy),
|
|
29
|
+
};
|
|
22
30
|
}
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
child.layout({ x: cx - origin.x, y: origin.y - cy, width: ink ? ink.maxX - ink.minX : 0, height: ink ? ink.maxY - ink.minY : 0 }, scope);
|
|
27
|
-
planes.set(child, markPlane(map, cx, cy));
|
|
28
|
-
}
|
|
29
|
-
if (others.length === 0)
|
|
30
|
-
return planes;
|
|
31
|
-
const sizes = flowOps.measure({}, others, room, scope).sizes;
|
|
32
|
-
others.forEach((child, i) => {
|
|
31
|
+
const size = child.measure({ width: room.width, height: room.height });
|
|
32
|
+
const entry = anchors.find((a) => a.is(child));
|
|
33
|
+
const anchor = entry ? entry.anchor(child.state, plane) : null;
|
|
33
34
|
// Its box is centred on the map's own centre, so its offset from there is its point.
|
|
34
|
-
|
|
35
|
-
planes.set(child, pointPlane(map, child));
|
|
35
|
+
return { x: -origin.x, y: -origin.y, width: size.width, height: size.height, plane: pointPlane(map, anchor) };
|
|
36
36
|
});
|
|
37
|
-
return planes;
|
|
38
37
|
}
|
|
39
38
|
/** The plane of a child that is not there yet, under a holder centred on `origin`: where a host would drop one. */
|
|
40
39
|
export function openPlane(map, origin) {
|
|
@@ -46,12 +45,11 @@ export function openPlane(map, origin) {
|
|
|
46
45
|
toCoords: (x, y) => map.toCoords(x + origin.x, y + origin.y),
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
|
-
function pointPlane(map,
|
|
48
|
+
function pointPlane(map, anchor) {
|
|
50
49
|
const point = { x: 0, y: 0 };
|
|
51
|
-
const anchored = isAnchored(child) ? child : null;
|
|
52
50
|
return {
|
|
53
51
|
toOffset: (x, y) => {
|
|
54
|
-
const at =
|
|
52
|
+
const at = anchor?.(x, y);
|
|
55
53
|
return at ? map.toPoint(at.x, at.y, point) : map.toPoint(x, y, point);
|
|
56
54
|
},
|
|
57
55
|
toCoords: (x, y) => map.toCoords(x, y),
|
package/dist/kit/place.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place.js","sourceRoot":"","sources":["../../src/kit/place.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"place.js","sourceRoot":"","sources":["../../src/kit/place.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAKlC,MAAM,OAAO,GAA0H,EAAE,CAAC;AAE1I,uGAAuG;AACvG,MAAM,UAAU,QAAQ,CAA8C,SAAY,EAAE,MAA0D;IAC1I,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7D,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,QAA8B,EAAE,GAAkB,EAAE,MAAe,EAAE,IAAY,EAAE,KAAiB;IAC3H,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,IAAI,EAAE,CAAC;YACP,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YAC/B,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CA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,CAAC;AACN,CAAC;AAED,6GAA6G;AAC7G,SAAS,SAAS,CAAC,GAAkB,EAAE,EAAU,EAAE,EAAU;IACzD,MAAM,IAAI,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACrC,OAAO;QACH,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;QACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;KACnD,CAAC;AACN,CAAC","sourcesContent":["import type { ChildPlane, ChildView, Placement2D, Size2D, Vector2 } from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"./coords\";\r\nimport { boundsOfRuns } from \"./geometry\";\r\nimport type { GraphPlane } from \"./graph\";\r\nimport { markRuns } from \"./mark\";\r\n\r\n/** Where a child that sits somewhere other than its own `x`/`y` is (a point riding a curve), given its own `x`/`y`. */\r\nexport type Anchor = (x: number, y: number) => Vector2;\r\n\r\nconst anchors: { readonly is: (child: ChildView) => boolean; readonly anchor: (state: never, plane: GraphPlane) => Anchor | null }[] = [];\r\n\r\n/** `component`, declared to sit at `anchor` of its own `x`/`y` on a graph. Hand back the component. */\r\nexport function anchored<C extends { is(child: ChildView): boolean }>(component: C, anchor: (state: never, plane: GraphPlane) => Anchor | null): C {\r\n anchors.push({ is: (child) => component.is(child), anchor });\r\n return component;\r\n}\r\n\r\n/**\r\n * Lay `children` out on `map`, for whichever node holds them: a coordinate\r\n * system, or a plot holding the marks that read it. A mark goes on its ink;\r\n * anything else keeps its own size and has its `x`/`y` read as graph\r\n * coordinates. `origin` is the holder's own centre in the map's pixels (y-up),\r\n * since a child's box is placed from there.\r\n */\r\nexport function placeOnMap(children: readonly ChildView[], map: CoordinateMap, origin: Vector2, room: Size2D, plane: GraphPlane): Placement2D[] {\r\n return children.map((child) => {\r\n const runs = markRuns(child, map, plane);\r\n if (runs) {\r\n const ink = boundsOfRuns(runs);\r\n const cx = ink ? (ink.minX + ink.maxX) / 2 : origin.x;\r\n const cy = ink ? (ink.minY + ink.maxY) / 2 : origin.y;\r\n return {\r\n x: cx - origin.x,\r\n y: cy - origin.y,\r\n width: ink ? ink.maxX - ink.minX : 0,\r\n height: ink ? ink.maxY - ink.minY : 0,\r\n plane: markPlane(map, cx, cy),\r\n };\r\n }\r\n const size = child.measure({ width: room.width, height: room.height });\r\n const entry = anchors.find((a) => a.is(child));\r\n const anchor = entry ? (entry.anchor as (state: unknown, plane: GraphPlane) => Anchor | null)(child.state, plane) : null;\r\n // Its box is centred on the map's own centre, so its offset from there is its point.\r\n return { x: -origin.x, y: -origin.y, width: size.width, height: size.height, plane: pointPlane(map, anchor) };\r\n });\r\n}\r\n\r\n/** The plane of a child that is not there yet, under a holder centred on `origin`: where a host would drop one. */\r\nexport function openPlane(map: CoordinateMap, origin: Vector2): ChildPlane {\r\n return {\r\n toOffset: (x, y) => {\r\n const at = map.toPoint(x, y);\r\n return { x: at.x - origin.x, y: at.y - origin.y };\r\n },\r\n toCoords: (x, y) => map.toCoords(x + origin.x, y + origin.y),\r\n };\r\n}\r\n\r\nfunction pointPlane(map: CoordinateMap, anchor: Anchor | null): ChildPlane {\r\n const point: Vector2 = { x: 0, y: 0 };\r\n return {\r\n toOffset: (x, y) => {\r\n const at = anchor?.(x, y);\r\n return at ? map.toPoint(at.x, at.y, point) : map.toPoint(x, y, point);\r\n },\r\n toCoords: (x, y) => map.toCoords(x, y),\r\n };\r\n}\r\n\r\n// A mark reads its own `x`/`y` as it draws, so its holder adds nothing; a drag still answers in graph units.\r\nfunction markPlane(map: CoordinateMap, cx: number, cy: number): ChildPlane {\r\n const none: Vector2 = { x: 0, y: 0 };\r\n return {\r\n toOffset: () => none,\r\n toCoords: (x, y) => map.toCoords(cx + x, cy + y),\r\n };\r\n}\r\n"]}
|
package/dist/kit/system.d.ts
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Graphics2D, type ChildPlane, type ChildView, type Extents, type InsetsResolved, type Placement2D, type Provided, type RenderContext, type Shadow, type Fill, type Size2D } from "@motionscript/sdk";
|
|
2
2
|
import type { CoordinateMap } from "./coords.js";
|
|
3
|
-
|
|
3
|
+
/** What a system's helpers read of its state. */
|
|
4
|
+
export interface SystemState {
|
|
5
|
+
readonly padding: InsetsResolved;
|
|
6
|
+
readonly fill: Fill;
|
|
7
|
+
readonly shadow: Shadow;
|
|
8
|
+
readonly clip: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** How a system's graph values land on its plot area. */
|
|
11
|
+
export type MapFor<S> = (area: Extents, state: S) => CoordinateMap;
|
|
12
|
+
/** The plot area: the box less its padding, y-up from the box's centre. */
|
|
13
|
+
export declare function plotArea(size: Size2D, padding: InsetsResolved): Extents;
|
|
14
|
+
/** A system's map at a laid-out `size`. */
|
|
15
|
+
export declare function systemMap<S extends SystemState>(size: Size2D, state: S, mapFor: MapFor<S>): CoordinateMap;
|
|
16
|
+
/** A system is the size it is given: its children are placed in it, not measured into it. */
|
|
17
|
+
export declare function systemSize(state: SystemState): Size2D;
|
|
18
|
+
/** What a system hands its subtree: its plane, which its layout keeps current. */
|
|
19
|
+
export declare function systemProvides(state: object): readonly Provided[];
|
|
20
|
+
/** Lay a system's children out on its map. */
|
|
21
|
+
export declare function systemLayout<S extends SystemState>(size: Size2D, state: S, children: readonly ChildView[], mapFor: MapFor<S>): Placement2D[];
|
|
22
|
+
/** Where a child dropped on a system would sit. */
|
|
23
|
+
export declare function systemOpenPlane<S extends SystemState>(size: Size2D, state: S, mapFor: MapFor<S>): ChildPlane;
|
|
4
24
|
/**
|
|
5
|
-
* A
|
|
6
|
-
* the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* The system's `stroke` is its axis line (so `endCap` is the tip) and its `fill`
|
|
11
|
-
* the backdrop. Ticks, grid and labels are drawing ops, never child nodes: a
|
|
12
|
-
* document's children would otherwise share their indices with them.
|
|
25
|
+
* A system's paint: the backdrop, then the furniture under its children, kept
|
|
26
|
+
* in the plot area where the map spills from it, then the children, confined
|
|
27
|
+
* to the plot area when `clip` is set. The stroke is the axis line, drawn with
|
|
28
|
+
* the furniture: painted after the children it would land over them.
|
|
13
29
|
*/
|
|
14
|
-
export declare
|
|
15
|
-
/** How graph values land on a plot area of this size. */
|
|
16
|
-
protected abstract mapFor(area: Extents): CoordinateMap;
|
|
17
|
-
/** What the system draws of itself, under its children. */
|
|
18
|
-
protected abstract furniture(map: CoordinateMap): Graphics2D[];
|
|
19
|
-
/** This system's coordinates, as last laid out. */
|
|
20
|
-
get coordinates(): CoordinateMap;
|
|
21
|
-
measure(constraints: SizeConstraints): Partial<Size2D>;
|
|
22
|
-
protected layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void;
|
|
23
|
-
_planeOf(child: Node2D | null): ChildPlane | null;
|
|
24
|
-
protected shapeGraphics(): Graphics2D | null;
|
|
25
|
-
protected renderSelf(ctx: RenderContext2D): void;
|
|
26
|
-
protected renderStroke(): void;
|
|
27
|
-
protected clipSelf(): Clip | null;
|
|
28
|
-
private _map;
|
|
29
|
-
private _planes;
|
|
30
|
-
/** The plot area: the box less its padding, y-up from the box's centre. */
|
|
31
|
-
private _area;
|
|
32
|
-
}
|
|
30
|
+
export declare function drawSystem(ctx: RenderContext, state: SystemState, map: CoordinateMap, furniture: (map: CoordinateMap) => Graphics2D[]): void;
|
|
33
31
|
//# sourceMappingURL=system.d.ts.map
|
package/dist/kit/system.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/kit/system.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/kit/system.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EAIV,KAAK,UAAU,EACf,KAAK,SAAS,EACd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