@glissade/scene 0.4.4 → 0.4.5
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 +3 -1
- package/dist/index.js +13 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
-
import { BindableSignal, BoundTimeline, CompiledTimeline, Playhead, Timeline } from "@glissade/core";
|
|
2
|
+
import { BindableSignal, BoundTimeline, CompiledTimeline, Playhead, Timeline, Vec2 } from "@glissade/core";
|
|
3
3
|
|
|
4
4
|
//#region src/highlight.d.ts
|
|
5
5
|
|
|
@@ -42,6 +42,8 @@ interface TokenRange {
|
|
|
42
42
|
progress?: PropInit<number>;
|
|
43
43
|
/** scale about the range rect's center; default 1 */
|
|
44
44
|
scale?: PropInit<number>;
|
|
45
|
+
/** translation of the range's rects, px — shakes and nudges; default [0, 0] */
|
|
46
|
+
offset?: PropInit<Vec2>;
|
|
45
47
|
}
|
|
46
48
|
interface TokenHighlightProps extends NodeProps {
|
|
47
49
|
/** the Text whose tokens get highlighted; place this node as an EARLIER sibling */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
-
import { bindTimeline, compileTimeline, createPlayhead, emitDevWarning, evaluateAt, signal } from "@glissade/core";
|
|
2
|
+
import { bindTimeline, compileTimeline, createPlayhead, emitDevWarning, evaluateAt, signal, vec2Signal } from "@glissade/core";
|
|
3
3
|
//#region src/highlight.ts
|
|
4
4
|
/**
|
|
5
5
|
* Marker-style text highlight: per-line rounded rects behind a Text node's
|
|
@@ -145,6 +145,7 @@ var TokenHighlight = class extends Node {
|
|
|
145
145
|
opacity: init(signal(1), spec.opacity),
|
|
146
146
|
progress: init(signal(1), spec.progress),
|
|
147
147
|
scale: init(signal(1), spec.scale),
|
|
148
|
+
offset: initVec(vec2Signal([0, 0]), spec.offset),
|
|
148
149
|
run,
|
|
149
150
|
bound: runText(boxes, run)
|
|
150
151
|
};
|
|
@@ -152,6 +153,9 @@ var TokenHighlight = class extends Node {
|
|
|
152
153
|
this.registerTarget(`${id}/opacity`, r.opacity);
|
|
153
154
|
this.registerTarget(`${id}/progress`, r.progress);
|
|
154
155
|
this.registerTarget(`${id}/scale`, r.scale);
|
|
156
|
+
this.registerTarget(`${id}/offset`, r.offset);
|
|
157
|
+
this.registerTarget(`${id}/offset.x`, r.offset.x);
|
|
158
|
+
this.registerTarget(`${id}/offset.y`, r.offset.y);
|
|
155
159
|
return r;
|
|
156
160
|
});
|
|
157
161
|
}
|
|
@@ -209,13 +213,14 @@ var TokenHighlight = class extends Node {
|
|
|
209
213
|
});
|
|
210
214
|
const fill = r.fill();
|
|
211
215
|
const scale = r.scale();
|
|
216
|
+
const [ox, oy] = r.offset();
|
|
212
217
|
let remaining = progress * lineRects.reduce((sum, q) => sum + q.w, 0);
|
|
213
218
|
for (const q of lineRects) {
|
|
214
219
|
const fillW = Math.min(q.w, remaining);
|
|
215
220
|
remaining -= fillW;
|
|
216
221
|
if (fillW <= 0) break;
|
|
217
|
-
const cx = q.x + q.w / 2;
|
|
218
|
-
const cy = q.y + q.h / 2;
|
|
222
|
+
const cx = q.x + q.w / 2 + ox;
|
|
223
|
+
const cy = q.y + q.h / 2 + oy;
|
|
219
224
|
const w = fillW * scale;
|
|
220
225
|
const h = q.h * scale;
|
|
221
226
|
const x = cx - q.w / 2 * scale;
|
|
@@ -257,6 +262,11 @@ function init(sig, v) {
|
|
|
257
262
|
else if (v !== void 0) sig.set(v);
|
|
258
263
|
return sig;
|
|
259
264
|
}
|
|
265
|
+
function initVec(sig, v) {
|
|
266
|
+
if (typeof v === "function") sig.bindSource(v);
|
|
267
|
+
else if (v !== void 0) sig.set(v);
|
|
268
|
+
return sig;
|
|
269
|
+
}
|
|
260
270
|
//#endregion
|
|
261
271
|
//#region src/assets.ts
|
|
262
272
|
var ColdAssetError = class extends Error {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/scene",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
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.5"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|