@glissade/scene 0.4.1 → 0.4.3
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/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +2 -2
- package/dist/layoutEngine.d.ts +35 -4
- package/dist/layoutEngine.js +78 -7
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as StrokeStyle, A as NodeProps, B as BlendMode, C as WordBox, D as EvalContext, E as BindablePropTarget, F as breakLines, G as FilterValidationError, H as DisplayListBuilder, I as estimatingMeasurer, J as PathSeg, K as FontSpec, L as quantize, M as resolveAnchor, N as TextMeasurer, O as HitArea, P as TextMetricsLite, Q as ShaderRef, R as segmentWords, S as VideoProps, T as AnchorSpec, U as DrawCommand, V as DisplayList, W as FilterSpec, X as Resource, Y as Rect$1, Z as ResourceId, _ as Rect, a as LayoutEngineMissingError, at as Mat2x3, b as TextProps, c as requireLayoutEngine, ct as invert, d as Group, et as createDisplayListBuilder, f as ImageNode, g as PathProps, h as Path, i as LayoutEngine, it as IDENTITY, j as PropInit, k as Node, l as setLayoutEngine, lt as matEquals, m as LineBox, n as LayoutChildSpec, nt as glow, ot as applyToPoint, p as ImageProps, q as Paint, r as LayoutContainerSpec, rt as validateFilters, s as getLayoutEngine, st as fromTRS, t as LayoutBox, tt as filtersToCanvasFilter, u as Circle, ut as multiply, v as ShapeProps, w as roundedRectSegs, x as Video, y as Text, z as setDefaultMeasurer } from "./layoutEngine.js";
|
|
2
2
|
import { BindableSignal, BoundTimeline, CompiledTimeline, Playhead, Timeline } from "@glissade/core";
|
|
3
3
|
|
|
4
4
|
//#region src/highlight.d.ts
|
|
@@ -218,4 +218,4 @@ declare function bindScene(scene: Scene, doc: Timeline): BindingCacheEntry;
|
|
|
218
218
|
*/
|
|
219
219
|
declare function evaluate(scene: Scene, doc: Timeline, t: number): DisplayList;
|
|
220
220
|
//#endregion
|
|
221
|
-
export { type AnchorSpec, type BindablePropTarget, type BlendMode, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, type DisplayList, type DisplayListBuilder, type DrawCommand, DuplicateNodeIdError, type EvalContext, type FilterSpec, FilterValidationError, type FontSpec, Group, Highlight, type HighlightProps, type HitArea, IDENTITY, type ImageHandle, ImageNode, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type LineBox, type Mat2x3, Node, type NodeProps, type Paint, Path, type PathLike, type PathProps, type PathSeg, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type Resource, type ResourceId, type Scene, type SceneInit, type SceneModule, type ShaderCaps, ShaderEffect, type ShaderEffectProps, type ShaderRef, type ShapeProps, type StrokeStyle, Text, type TextMeasurer, type TextMetricsLite, type TextProps, Video, type VideoFrameSource, type VideoProps, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, filtersToCanvasFilter, fontString, fromTRS, getLayoutEngine, glow, highlight, invert, matEquals, multiply, quantize, requireLayoutEngine, resolveAnchor, roundedRectSegs, setLayoutEngine, validateFilters };
|
|
221
|
+
export { type AnchorSpec, type BindablePropTarget, type BlendMode, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, type DisplayList, type DisplayListBuilder, type DrawCommand, DuplicateNodeIdError, type EvalContext, type FilterSpec, FilterValidationError, type FontSpec, Group, Highlight, type HighlightProps, type HitArea, IDENTITY, type ImageHandle, ImageNode, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type LineBox, type Mat2x3, Node, type NodeProps, type Paint, Path, type PathLike, type PathProps, type PathSeg, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type Resource, type ResourceId, type Scene, type SceneInit, type SceneModule, type ShaderCaps, ShaderEffect, type ShaderEffectProps, type ShaderRef, type ShapeProps, type StrokeStyle, Text, type TextMeasurer, type TextMetricsLite, type TextProps, Video, type VideoFrameSource, type VideoProps, type WordBox, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, filtersToCanvasFilter, fontString, fromTRS, getLayoutEngine, glow, highlight, invert, matEquals, multiply, quantize, requireLayoutEngine, resolveAnchor, roundedRectSegs, segmentWords, setDefaultMeasurer, setLayoutEngine, validateFilters };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { A as matEquals, C as filtersToCanvasFilter, D as applyToPoint, E as IDENTITY, O as fromTRS, S as createDisplayListBuilder, T as validateFilters, _ as fallbackMeasurer, a as Circle, b as setDefaultMeasurer, c as Path, d as Video, f as roundedRectSegs, g as estimatingMeasurer, h as breakLines, i as setLayoutEngine, j as multiply, k as invert, l as Rect, m as resolveAnchor, n as getLayoutEngine, o as Group, p as Node, r as requireLayoutEngine, s as ImageNode, t as LayoutEngineMissingError, u as Text, v as quantize, w as glow, x as FilterValidationError, y as segmentWords } from "./layoutEngine.js";
|
|
2
2
|
import { bindTimeline, compileTimeline, createPlayhead, emitDevWarning, evaluateAt, signal } from "@glissade/core";
|
|
3
3
|
//#region src/highlight.ts
|
|
4
4
|
/**
|
|
@@ -505,8 +505,8 @@ function createScene(init) {
|
|
|
505
505
|
});
|
|
506
506
|
const nodes = /* @__PURE__ */ new Map();
|
|
507
507
|
const playhead = createPlayhead();
|
|
508
|
-
let measurer =
|
|
509
|
-
indexNodes(root, nodes, () => measurer);
|
|
508
|
+
let measurer = null;
|
|
509
|
+
indexNodes(root, nodes, () => measurer ?? fallbackMeasurer());
|
|
510
510
|
return {
|
|
511
511
|
root,
|
|
512
512
|
nodes,
|
|
@@ -521,7 +521,7 @@ function createScene(init) {
|
|
|
521
521
|
measurer = m;
|
|
522
522
|
},
|
|
523
523
|
get textMeasurer() {
|
|
524
|
-
return measurer;
|
|
524
|
+
return measurer ?? fallbackMeasurer();
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
527
|
}
|
|
@@ -563,4 +563,4 @@ function evaluate(scene, doc, t) {
|
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
//#endregion
|
|
566
|
-
export { Circle, ColdAssetError, DuplicateNodeIdError, FilterValidationError, Group, Highlight, IDENTITY, ImageNode, LayoutEngineMissingError, Node, Path, Raster2D, Rect, ShaderEffect, Text, Video, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, filtersToCanvasFilter, fontString, fromTRS, getLayoutEngine, glow, highlight, invert, matEquals, multiply, quantize, requireLayoutEngine, resolveAnchor, roundedRectSegs, setLayoutEngine, validateFilters };
|
|
566
|
+
export { Circle, ColdAssetError, DuplicateNodeIdError, FilterValidationError, Group, Highlight, IDENTITY, ImageNode, LayoutEngineMissingError, Node, Path, Raster2D, Rect, ShaderEffect, Text, Video, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, filtersToCanvasFilter, fontString, fromTRS, getLayoutEngine, glow, highlight, invert, matEquals, multiply, quantize, requireLayoutEngine, resolveAnchor, roundedRectSegs, segmentWords, setDefaultMeasurer, setLayoutEngine, validateFilters };
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as NodeProps, D as EvalContext, H as DisplayListBuilder, N as TextMeasurer, a as LayoutEngineMissingError, d as Group, i as LayoutEngine, j as PropInit, k as Node, l as setLayoutEngine, n as LayoutChildSpec, o as LayoutResult, r as LayoutContainerSpec, s as getLayoutEngine, t as LayoutBox } from "./layoutEngine.js";
|
|
2
2
|
import { BindableSignal } from "@glissade/core";
|
|
3
3
|
|
|
4
4
|
//#region src/layout.d.ts
|
package/dist/layout.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as fallbackMeasurer, i as setLayoutEngine, n as getLayoutEngine, o as Group, r as requireLayoutEngine, t as LayoutEngineMissingError } from "./layoutEngine.js";
|
|
2
2
|
import { signal } from "@glissade/core";
|
|
3
3
|
//#region src/layout.ts
|
|
4
4
|
/**
|
|
@@ -68,7 +68,7 @@ var Layout = class extends Group {
|
|
|
68
68
|
* The measurer defaults to the scene-injected one (estimating pre-scene).
|
|
69
69
|
*/
|
|
70
70
|
computedSize(measurer) {
|
|
71
|
-
const m = measurer ?? this.measurerSource?.() ??
|
|
71
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
72
72
|
return this.#compute(m).size;
|
|
73
73
|
}
|
|
74
74
|
#compute(measurer) {
|
package/dist/layoutEngine.d.ts
CHANGED
|
@@ -189,11 +189,23 @@ interface TextMeasurer {
|
|
|
189
189
|
/** §3.6 measurement quantum. */
|
|
190
190
|
declare function quantize(v: number): number;
|
|
191
191
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
192
|
+
* Process-wide fallback measurer for FACTORY-TIME measurement — component
|
|
193
|
+
* factories run before any scene exists, so Text pulls (measuredSize,
|
|
194
|
+
* lineBoxes, wordBoxes) and createScene fall back here before the estimator.
|
|
195
|
+
* Node consumers: `setDefaultMeasurer(createMeasurer({ fonts }))` from
|
|
196
|
+
* @glissade/backend-skia gives factory code the rasterizer's real metrics.
|
|
197
|
+
* Scene-injected measurers (mount/CLI/golden harness) always win.
|
|
195
198
|
*/
|
|
199
|
+
declare function setDefaultMeasurer(m: TextMeasurer | null): void;
|
|
200
|
+
/** The default-or-estimating chain end; internal fallback for measurer pulls. */
|
|
201
|
+
|
|
196
202
|
declare const estimatingMeasurer: TextMeasurer;
|
|
203
|
+
/**
|
|
204
|
+
* The draw-path word segmentation (Intl.Segmenter boundaries, punctuation
|
|
205
|
+
* glued to its predecessor) — exported so Text.wordBoxes() boxes EXACTLY the
|
|
206
|
+
* units the breaker flows.
|
|
207
|
+
*/
|
|
208
|
+
declare function segmentWords(text: string): string[];
|
|
197
209
|
/**
|
|
198
210
|
* Greedy line breaking: explicit '\n' always breaks; otherwise word segments
|
|
199
211
|
* flow until maxWidth is exceeded (Intl.Segmenter boundaries, so CJK wraps
|
|
@@ -477,6 +489,16 @@ interface LineBox {
|
|
|
477
489
|
w: number;
|
|
478
490
|
h: number;
|
|
479
491
|
}
|
|
492
|
+
/** One word's ink box within a laid-out line, in the Text node's draw space. */
|
|
493
|
+
interface WordBox {
|
|
494
|
+
text: string;
|
|
495
|
+
/** laid-out line index (blank lines keep their slot in the numbering) */
|
|
496
|
+
line: number;
|
|
497
|
+
x: number;
|
|
498
|
+
y: number;
|
|
499
|
+
w: number;
|
|
500
|
+
h: number;
|
|
501
|
+
}
|
|
480
502
|
interface TextProps extends NodeProps {
|
|
481
503
|
text?: PropInit<string>;
|
|
482
504
|
fill?: PropInit<string>;
|
|
@@ -526,6 +548,15 @@ declare class Text extends Node {
|
|
|
526
548
|
* reveals, selections.
|
|
527
549
|
*/
|
|
528
550
|
lineBoxes(measurer?: TextMeasurer): LineBox[];
|
|
551
|
+
/**
|
|
552
|
+
* Per-word ink boxes within each laid-out line — the SAME segmentation the
|
|
553
|
+
* breaker flows (Intl.Segmenter boundaries, punctuation glued), positioned
|
|
554
|
+
* by cumulative prefix advances so cross-word kerning is exact and word
|
|
555
|
+
* widths sum to the line's width. Whitespace contributes advance but no
|
|
556
|
+
* box. Pair index-wise with a narration manifest's word timestamps for
|
|
557
|
+
* karaoke; draw your own rects for sub-line multi-color token work.
|
|
558
|
+
*/
|
|
559
|
+
wordBoxes(measurer?: TextMeasurer): WordBox[];
|
|
529
560
|
protected draw(out: DisplayListBuilder, ctx: EvalContext): void;
|
|
530
561
|
}
|
|
531
562
|
//#endregion
|
|
@@ -577,4 +608,4 @@ declare function setLayoutEngine(e: LayoutEngine): void;
|
|
|
577
608
|
declare function getLayoutEngine(): LayoutEngine | null;
|
|
578
609
|
declare function requireLayoutEngine(): LayoutEngine;
|
|
579
610
|
//#endregion
|
|
580
|
-
export {
|
|
611
|
+
export { StrokeStyle as $, NodeProps as A, BlendMode as B, WordBox as C, EvalContext as D, BindablePropTarget as E, breakLines as F, FilterValidationError as G, DisplayListBuilder as H, estimatingMeasurer as I, PathSeg as J, FontSpec as K, quantize as L, resolveAnchor as M, TextMeasurer as N, HitArea as O, TextMetricsLite as P, ShaderRef as Q, segmentWords as R, VideoProps as S, AnchorSpec as T, DrawCommand as U, DisplayList as V, FilterSpec as W, Resource as X, Rect$1 as Y, ResourceId as Z, Rect as _, LayoutEngineMissingError as a, Mat2x3 as at, TextProps as b, requireLayoutEngine as c, invert as ct, Group as d, createDisplayListBuilder as et, ImageNode as f, PathProps as g, Path as h, LayoutEngine as i, IDENTITY as it, PropInit as j, Node as k, setLayoutEngine as l, matEquals as lt, LineBox as m, LayoutChildSpec as n, glow as nt, LayoutResult as o, applyToPoint as ot, ImageProps as p, Paint as q, LayoutContainerSpec as r, validateFilters as rt, getLayoutEngine as s, fromTRS as st, LayoutBox as t, filtersToCanvasFilter as tt, Circle as u, multiply as ut, ShapeProps as v, roundedRectSegs as w, Video as x, Text as y, setDefaultMeasurer as z };
|
package/dist/layoutEngine.js
CHANGED
|
@@ -158,6 +158,22 @@ function quantize(v) {
|
|
|
158
158
|
* (e.g. evaluating for IR-level tests). Deterministic but not metrically
|
|
159
159
|
* faithful; mount(), the CLI, and exporters always inject the real one.
|
|
160
160
|
*/
|
|
161
|
+
let defaultMeasurer = null;
|
|
162
|
+
/**
|
|
163
|
+
* Process-wide fallback measurer for FACTORY-TIME measurement — component
|
|
164
|
+
* factories run before any scene exists, so Text pulls (measuredSize,
|
|
165
|
+
* lineBoxes, wordBoxes) and createScene fall back here before the estimator.
|
|
166
|
+
* Node consumers: `setDefaultMeasurer(createMeasurer({ fonts }))` from
|
|
167
|
+
* @glissade/backend-skia gives factory code the rasterizer's real metrics.
|
|
168
|
+
* Scene-injected measurers (mount/CLI/golden harness) always win.
|
|
169
|
+
*/
|
|
170
|
+
function setDefaultMeasurer(m) {
|
|
171
|
+
defaultMeasurer = m;
|
|
172
|
+
}
|
|
173
|
+
/** The default-or-estimating chain end; internal fallback for measurer pulls. */
|
|
174
|
+
function fallbackMeasurer() {
|
|
175
|
+
return defaultMeasurer ?? estimatingMeasurer;
|
|
176
|
+
}
|
|
161
177
|
const estimatingMeasurer = { measureText(text, font) {
|
|
162
178
|
return {
|
|
163
179
|
width: text.length * font.size * .52,
|
|
@@ -166,6 +182,11 @@ const estimatingMeasurer = { measureText(text, font) {
|
|
|
166
182
|
};
|
|
167
183
|
} };
|
|
168
184
|
let wordSegmenter;
|
|
185
|
+
/**
|
|
186
|
+
* The draw-path word segmentation (Intl.Segmenter boundaries, punctuation
|
|
187
|
+
* glued to its predecessor) — exported so Text.wordBoxes() boxes EXACTLY the
|
|
188
|
+
* units the breaker flows.
|
|
189
|
+
*/
|
|
169
190
|
function segmentWords(text) {
|
|
170
191
|
if (wordSegmenter === void 0) wordSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
|
|
171
192
|
if (wordSegmenter) {
|
|
@@ -324,7 +345,7 @@ var Node = class {
|
|
|
324
345
|
* left/center/right baseline origin; Path from author-positioned bounds.
|
|
325
346
|
*/
|
|
326
347
|
drawOffset(measurer) {
|
|
327
|
-
const m = measurer ?? this.measurerSource?.() ??
|
|
348
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
328
349
|
const size = this.intrinsicSize(m) ?? {
|
|
329
350
|
w: 0,
|
|
330
351
|
h: 0
|
|
@@ -340,7 +361,7 @@ var Node = class {
|
|
|
340
361
|
* (−ax·w, −ay·h); the center default reproduces (−w/2, −h/2).
|
|
341
362
|
*/
|
|
342
363
|
flowOffset(measurer) {
|
|
343
|
-
const m = measurer ?? this.measurerSource?.() ??
|
|
364
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
344
365
|
const d = this.drawOffset(m);
|
|
345
366
|
const [sx, sy] = this.anchorShift(m);
|
|
346
367
|
return {
|
|
@@ -360,7 +381,7 @@ var Node = class {
|
|
|
360
381
|
anchorShift(measurer) {
|
|
361
382
|
if (!this.hasAnchor) return [0, 0];
|
|
362
383
|
const [ax, ay] = this.anchor;
|
|
363
|
-
const m = measurer ?? this.measurerSource?.() ??
|
|
384
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
364
385
|
const size = this.intrinsicSize(m);
|
|
365
386
|
if (!size) {
|
|
366
387
|
if (!this.#warnedAnchor) {
|
|
@@ -864,7 +885,7 @@ var Text = class extends Node {
|
|
|
864
885
|
}
|
|
865
886
|
/** Text draws from a baseline origin at its align edge, not a center (§3.6). */
|
|
866
887
|
drawOffset(measurer) {
|
|
867
|
-
const m = measurer ?? this.measurerSource?.() ??
|
|
888
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
868
889
|
const size = this.intrinsicSize(m);
|
|
869
890
|
const font = {
|
|
870
891
|
family: this.fontFamily,
|
|
@@ -884,7 +905,7 @@ var Text = class extends Node {
|
|
|
884
905
|
* text dimensions (e.g. underline width = () => title.measuredSize().w).
|
|
885
906
|
*/
|
|
886
907
|
measuredSize(measurer) {
|
|
887
|
-
return this.intrinsicSize(measurer ?? this.measurerSource?.() ??
|
|
908
|
+
return this.intrinsicSize(measurer ?? this.measurerSource?.() ?? fallbackMeasurer());
|
|
888
909
|
}
|
|
889
910
|
/**
|
|
890
911
|
* Per-line ink boxes in this node's DRAW space (origin = first baseline at
|
|
@@ -894,7 +915,7 @@ var Text = class extends Node {
|
|
|
894
915
|
* reveals, selections.
|
|
895
916
|
*/
|
|
896
917
|
lineBoxes(measurer) {
|
|
897
|
-
const m = measurer ?? this.measurerSource?.() ??
|
|
918
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
898
919
|
const text = this.text();
|
|
899
920
|
if (!text) return [];
|
|
900
921
|
const font = {
|
|
@@ -922,6 +943,56 @@ var Text = class extends Node {
|
|
|
922
943
|
}
|
|
923
944
|
return boxes;
|
|
924
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Per-word ink boxes within each laid-out line — the SAME segmentation the
|
|
948
|
+
* breaker flows (Intl.Segmenter boundaries, punctuation glued), positioned
|
|
949
|
+
* by cumulative prefix advances so cross-word kerning is exact and word
|
|
950
|
+
* widths sum to the line's width. Whitespace contributes advance but no
|
|
951
|
+
* box. Pair index-wise with a narration manifest's word timestamps for
|
|
952
|
+
* karaoke; draw your own rects for sub-line multi-color token work.
|
|
953
|
+
*/
|
|
954
|
+
wordBoxes(measurer) {
|
|
955
|
+
const m = measurer ?? this.measurerSource?.() ?? fallbackMeasurer();
|
|
956
|
+
const text = this.text();
|
|
957
|
+
if (!text) return [];
|
|
958
|
+
const font = {
|
|
959
|
+
family: this.fontFamily,
|
|
960
|
+
size: this.fontSize(),
|
|
961
|
+
weight: this.fontWeight
|
|
962
|
+
};
|
|
963
|
+
const maxWidth = this.width();
|
|
964
|
+
const lines = breakLines(text, font, maxWidth > 0 ? maxWidth : void 0, m);
|
|
965
|
+
const step = quantize(font.size * this.lineHeight);
|
|
966
|
+
const boxes = [];
|
|
967
|
+
for (let i = 0; i < lines.length; i++) {
|
|
968
|
+
const line = lines[i];
|
|
969
|
+
if (!line) continue;
|
|
970
|
+
const met = m.measureText(line, font);
|
|
971
|
+
const lineW = quantize(met.width);
|
|
972
|
+
const lineX = this.align === "left" ? 0 : this.align === "center" ? -lineW / 2 : -lineW;
|
|
973
|
+
const y = i * step - met.ascent;
|
|
974
|
+
const h = met.ascent + met.descent;
|
|
975
|
+
let prefix = "";
|
|
976
|
+
for (const seg of segmentWords(line)) {
|
|
977
|
+
const start = prefix;
|
|
978
|
+
prefix += seg;
|
|
979
|
+
const word = seg.trim();
|
|
980
|
+
if (word === "") continue;
|
|
981
|
+
const lead = seg.length - seg.trimStart().length;
|
|
982
|
+
const before = m.measureText(start + seg.slice(0, lead), font).width;
|
|
983
|
+
const after = m.measureText(start + seg.trimEnd(), font).width;
|
|
984
|
+
boxes.push({
|
|
985
|
+
text: word,
|
|
986
|
+
line: i,
|
|
987
|
+
x: lineX + before,
|
|
988
|
+
y,
|
|
989
|
+
w: after - before,
|
|
990
|
+
h
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return boxes;
|
|
995
|
+
}
|
|
925
996
|
draw(out, ctx) {
|
|
926
997
|
const text = this.text();
|
|
927
998
|
if (!text) return;
|
|
@@ -970,4 +1041,4 @@ function requireLayoutEngine() {
|
|
|
970
1041
|
return engine;
|
|
971
1042
|
}
|
|
972
1043
|
//#endregion
|
|
973
|
-
export {
|
|
1044
|
+
export { matEquals as A, filtersToCanvasFilter as C, applyToPoint as D, IDENTITY as E, fromTRS as O, createDisplayListBuilder as S, validateFilters as T, fallbackMeasurer as _, Circle as a, setDefaultMeasurer as b, Path as c, Video as d, roundedRectSegs as f, estimatingMeasurer as g, breakLines as h, setLayoutEngine as i, multiply as j, invert as k, Rect as l, resolveAnchor as m, getLayoutEngine as n, Group as o, Node as p, requireLayoutEngine as r, ImageNode as s, LayoutEngineMissingError as t, Text as u, quantize as v, glow as w, FilterValidationError as x, segmentWords as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/scene",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"yoga-layout": "^3.2.1",
|
|
23
|
-
"@glissade/core": "0.4.
|
|
23
|
+
"@glissade/core": "0.4.3"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|