@pixi-ui-editor/runtime-pixi 0.15.0 → 0.17.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 +49 -9
- package/dist/SceneViewport.d.ts +5 -1
- package/dist/SceneViewport.d.ts.map +1 -1
- package/dist/SceneViewport.js +13 -3
- package/dist/SceneViewport.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +19 -3
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +34 -4
- package/dist/layout.js.map +1 -1
- package/dist/liveTransform.d.ts +22 -0
- package/dist/liveTransform.d.ts.map +1 -0
- package/dist/liveTransform.js +81 -0
- package/dist/liveTransform.js.map +1 -0
- package/dist/scene.d.ts +7 -0
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +74 -1
- package/dist/scene.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,11 +4,30 @@ PixiJS runtime that loads and renders scene documents produced by [Pixi UI Edito
|
|
|
4
4
|
|
|
5
5
|
Consumes documents validated against [`@pixi-ui-editor/schema`](https://www.npmjs.com/package/@pixi-ui-editor/schema).
|
|
6
6
|
|
|
7
|
-
## Install
|
|
7
|
+
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pnpm add @pixi-ui-editor/runtime-pixi
|
|
11
|
-
```
|
|
10
|
+
pnpm add @pixi-ui-editor/runtime-pixi
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Reparent live views
|
|
14
|
+
|
|
15
|
+
Use `reparentPreservingWorld` for a live Pixi `Container` created by game code or taken from a
|
|
16
|
+
mounted scene. It recalculates the ancestor chain instead of reading Pixi's render-pass cache, so the
|
|
17
|
+
view does not jump even before the first frame:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { reparentPreservingWorld } from "@pixi-ui-editor/runtime-pixi";
|
|
21
|
+
|
|
22
|
+
if (!reparentPreservingWorld(symbolView, bonusLayer, 0)) {
|
|
23
|
+
// The destination parent has a singular transform, for example scale.x === 0.
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`containerWorldMatrix`, `applyWorldTransform`, and `matchWorldTransform` expose the same live-view
|
|
28
|
+
layer for lower-level use. A singular parent returns `false` without writing a non-finite transform.
|
|
29
|
+
Use `NodeTransformSpace` instead when moving serialized document nodes: it additionally resolves
|
|
30
|
+
layout profiles, anchors, Canvas scaling, and layout-managed rectangles.
|
|
12
31
|
|
|
13
32
|
## Spawn a preset
|
|
14
33
|
|
|
@@ -92,12 +111,33 @@ app.stage.addChild(root);
|
|
|
92
111
|
root.resize({ width: app.screen.width, height: app.screen.height });
|
|
93
112
|
```
|
|
94
113
|
|
|
95
|
-
Call `root.resize(...)` after the Pixi renderer changes size. It applies one uniform scale and centers
|
|
96
|
-
the unchanged authored viewport; letterbox and pillarbox space never reveal off-viewport content.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
Call `root.resize(...)` after the Pixi renderer changes size. It applies one uniform scale and centers
|
|
115
|
+
the unchanged authored viewport; letterbox and pillarbox space never reveal off-viewport content.
|
|
116
|
+
Hosts must not reproduce the fit formula or add their own viewport mask. Spawned prefab views stay
|
|
117
|
+
unclipped because they are scene content rather than player-screen boundaries.
|
|
118
|
+
|
|
119
|
+
Use `resolveViewport` for physical host measurements. It returns `null` while the host is collapsed or
|
|
120
|
+
non-finite, preventing a transient `0×0` measurement from selecting desktop and applying a singular
|
|
121
|
+
transform. `resolveProfileForViewport` and `fitViewportToHost` remain available as low-level primitives;
|
|
122
|
+
passing the live profile to the former enables a five-percent breakpoint dead zone.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
const resolved = resolveViewport(
|
|
126
|
+
document.settings,
|
|
127
|
+
scene.layout.referenceViewports,
|
|
128
|
+
host,
|
|
129
|
+
mounted.profile,
|
|
130
|
+
);
|
|
131
|
+
if (resolved === null) return; // keep the last usable profile and transform
|
|
132
|
+
if (resolved.profile !== mounted.profile) applyProfile(mounted, document, sceneId, resolved.profile);
|
|
133
|
+
mounted.root.resize(host);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Crossing the breakpoint does not require rebuilding or reloading assets. `SceneViewResult.profile` is
|
|
137
|
+
the source of truth for the live tree, and `applyProfile` updates its reference viewport, Canvas scale,
|
|
138
|
+
node transforms/styles, layout-managed children, page groups, item tables, scroll content, and fixed-grid
|
|
139
|
+
line breaks in place. Runtime state such as the current button/page, capacity override, and scroll offset
|
|
140
|
+
is retained; applying the already-live profile is a no-op.
|
|
101
141
|
|
|
102
142
|
## Localization
|
|
103
143
|
|
package/dist/SceneViewport.d.ts
CHANGED
|
@@ -8,9 +8,13 @@ import { type FittedViewport, type LayoutSize } from "./layout.js";
|
|
|
8
8
|
* off-viewport content while arranging it.
|
|
9
9
|
*/
|
|
10
10
|
export declare class SceneViewport extends Container {
|
|
11
|
-
readonly referenceViewport: LayoutSize;
|
|
12
11
|
readonly content: Container;
|
|
12
|
+
private currentReferenceViewport;
|
|
13
|
+
private readonly viewportMask?;
|
|
13
14
|
constructor(content: Container, referenceViewport: LayoutSize, clip: boolean);
|
|
15
|
+
/** Changes the authored viewport without replacing either the scene content or its clip object. */
|
|
16
|
+
setReferenceViewport(size: LayoutSize): void;
|
|
17
|
+
get referenceViewport(): LayoutSize;
|
|
14
18
|
/** Uniformly contains and centers this authored viewport inside the physical host. */
|
|
15
19
|
resize(host: LayoutSize): FittedViewport;
|
|
16
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneViewport.d.ts","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"SceneViewport.d.ts","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,OAAO,CAAC,wBAAwB,CAAa;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAW;IAEzC,YAAY,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAgB3E;IAED,mGAAmG;IACnG,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAI3C;IAED,IAAI,iBAAiB,IAAI,UAAU,CAA0C;IAE7E,sFAAsF;IACtF,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAKvC;CACF"}
|
package/dist/SceneViewport.js
CHANGED
|
@@ -8,25 +8,35 @@ import { fitViewportToHost } from "./layout.js";
|
|
|
8
8
|
* off-viewport content while arranging it.
|
|
9
9
|
*/
|
|
10
10
|
export class SceneViewport extends Container {
|
|
11
|
-
referenceViewport;
|
|
12
11
|
content;
|
|
12
|
+
currentReferenceViewport;
|
|
13
|
+
viewportMask;
|
|
13
14
|
constructor(content, referenceViewport, clip) {
|
|
14
15
|
super();
|
|
15
16
|
this.content = content;
|
|
16
|
-
this.
|
|
17
|
+
this.currentReferenceViewport = { ...referenceViewport };
|
|
17
18
|
if (clip) {
|
|
18
19
|
const viewportMask = new Graphics()
|
|
19
20
|
.rect(0, 0, referenceViewport.width, referenceViewport.height)
|
|
20
21
|
.fill(0xffffff);
|
|
21
22
|
viewportMask.eventMode = "none";
|
|
23
|
+
this.viewportMask = viewportMask;
|
|
22
24
|
content.mask = viewportMask;
|
|
23
25
|
this.addChild(viewportMask);
|
|
24
26
|
}
|
|
25
27
|
this.addChild(content);
|
|
26
28
|
}
|
|
29
|
+
/** Changes the authored viewport without replacing either the scene content or its clip object. */
|
|
30
|
+
setReferenceViewport(size) {
|
|
31
|
+
if (this.currentReferenceViewport.width === size.width && this.currentReferenceViewport.height === size.height)
|
|
32
|
+
return;
|
|
33
|
+
this.currentReferenceViewport = { ...size };
|
|
34
|
+
this.viewportMask?.clear().rect(0, 0, size.width, size.height).fill(0xffffff);
|
|
35
|
+
}
|
|
36
|
+
get referenceViewport() { return this.currentReferenceViewport; }
|
|
27
37
|
/** Uniformly contains and centers this authored viewport inside the physical host. */
|
|
28
38
|
resize(host) {
|
|
29
|
-
const fitted = fitViewportToHost(this.
|
|
39
|
+
const fitted = fitViewportToHost(this.currentReferenceViewport, host);
|
|
30
40
|
this.scale.set(fitted.scale);
|
|
31
41
|
this.position.set(fitted.x, fitted.y);
|
|
32
42
|
return fitted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneViewport.js","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAwC,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IACjC,
|
|
1
|
+
{"version":3,"file":"SceneViewport.js","sourceRoot":"","sources":["../src/SceneViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAwC,MAAM,aAAa,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IACjC,OAAO,CAAY;I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AM,GAAG,iBAAiB,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QACtE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { Container, Graphics } from \"pixi.js\";\nimport { fitViewportToHost, type FittedViewport, type LayoutSize } from \"./layout.js\";\n\n/**\n * The single host boundary for a built scene.\n *\n * Runtime scenes are clipped to the authored reference viewport and can only be fitted with one\n * uniform scale. Authoring scenes use the same wrapper without clipping so the editor can expose\n * off-viewport content while arranging it.\n */\nexport class SceneViewport extends Container {\n readonly content: Container;\n private currentReferenceViewport: LayoutSize;\n private readonly viewportMask?: Graphics;\n\n constructor(content: Container, referenceViewport: LayoutSize, clip: boolean) {\n super();\n this.content = content;\n this.currentReferenceViewport = { ...referenceViewport };\n\n if (clip) {\n const viewportMask = new Graphics()\n .rect(0, 0, referenceViewport.width, referenceViewport.height)\n .fill(0xffffff);\n viewportMask.eventMode = \"none\";\n this.viewportMask = viewportMask;\n content.mask = viewportMask;\n this.addChild(viewportMask);\n }\n\n this.addChild(content);\n }\n\n /** Changes the authored viewport without replacing either the scene content or its clip object. */\n setReferenceViewport(size: LayoutSize): void {\n if (this.currentReferenceViewport.width === size.width && this.currentReferenceViewport.height === size.height) return;\n this.currentReferenceViewport = { ...size };\n this.viewportMask?.clear().rect(0, 0, size.width, size.height).fill(0xffffff);\n }\n\n get referenceViewport(): LayoutSize { return this.currentReferenceViewport; }\n\n /** Uniformly contains and centers this authored viewport inside the physical host. */\n resize(host: LayoutSize): FittedViewport {\n const fitted = fitViewportToHost(this.currentReferenceViewport, host);\n this.scale.set(fitted.scale);\n this.position.set(fitted.x, fitted.y);\n return fitted;\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./layout.js";
|
|
|
5
5
|
export { SceneViewport } from "./SceneViewport.js";
|
|
6
6
|
export * from "./layoutGroups.js";
|
|
7
7
|
export * from "./transformSpace.js";
|
|
8
|
+
export * from "./liveTransform.js";
|
|
8
9
|
export * from "./scrollView.js";
|
|
9
10
|
export * from "./pageGroup.js";
|
|
10
11
|
export * from "./views/NodeView.js";
|
|
@@ -25,7 +26,7 @@ export { SceneLocalization } from "./localization.js";
|
|
|
25
26
|
export type { SceneLocalizationOptions } from "./localization.js";
|
|
26
27
|
export { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from "./views/basic.js";
|
|
27
28
|
export type { BuildSceneViewOptions, PrefabViewConfiguration, SceneViewResult } from "./scene.js";
|
|
28
|
-
export { buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from "./scene.js";
|
|
29
|
+
export { applyProfile, buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from "./scene.js";
|
|
29
30
|
export * from "./controls.js";
|
|
30
31
|
export { createSceneAssetCache } from "./assets/cache.js";
|
|
31
32
|
export type { SceneAssetCache } from "./assets/cache.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gB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E,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzL,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./layout.js";
|
|
|
3
3
|
export { SceneViewport } from "./SceneViewport.js";
|
|
4
4
|
export * from "./layoutGroups.js";
|
|
5
5
|
export * from "./transformSpace.js";
|
|
6
|
+
export * from "./liveTransform.js";
|
|
6
7
|
export * from "./scrollView.js";
|
|
7
8
|
export * from "./pageGroup.js";
|
|
8
9
|
export * from "./views/NodeView.js";
|
|
@@ -21,7 +22,7 @@ export * from "./particles.js";
|
|
|
21
22
|
export { collectNodeAssetIds } from "./views/createNodeView.js";
|
|
22
23
|
export { SceneLocalization } from "./localization.js";
|
|
23
24
|
export { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from "./views/basic.js";
|
|
24
|
-
export { buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from "./scene.js";
|
|
25
|
+
export { applyProfile, buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from "./scene.js";
|
|
25
26
|
export * from "./controls.js";
|
|
26
27
|
export { createSceneAssetCache } from "./assets/cache.js";
|
|
27
28
|
export * from "./assets/textures.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,M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kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzL,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC","sourcesContent":["export type { SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nexport type { Sound } from \"@pixi/sound\";\r\nexport * from \"./document.js\";\r\nexport * from \"./layout.js\";\r\nexport { SceneViewport } from \"./SceneViewport.js\";\r\nexport * from \"./layoutGroups.js\";\r\nexport * from \"./transformSpace.js\";\nexport * from \"./liveTransform.js\";\nexport * from \"./scrollView.js\";\nexport * from \"./pageGroup.js\";\r\nexport * from \"./views/NodeView.js\";\r\nexport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nexport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nexport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nexport { InputNodeView } from \"./views/InputNodeView.js\";\r\nexport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\r\nexport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\nexport { ProgressBarNodeView, SliderNodeView } from \"./views/ValueControlNodeViews.js\";\r\nexport { PaginationNodeView } from \"./views/PaginationNodeView.js\";\r\nexport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nexport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nexport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\r\nexport * from \"./particles.js\";\r\nexport { collectNodeAssetIds } from \"./views/createNodeView.js\";\r\nexport { SceneLocalization } from \"./localization.js\";\r\nexport type { SceneLocalizationOptions } from \"./localization.js\";\r\nexport { BitmapTextNodeView, ImageNodeView, MaskNodeView, OpacityGroupNodeView, TextNodeView } from \"./views/basic.js\";\r\nexport type { BuildSceneViewOptions, PrefabViewConfiguration, SceneViewResult } from \"./scene.js\";\r\nexport { applyProfile, buildPrefabView, buildSceneView, collectRenderedNodes, loadPrefabView, previewNodeView, updateNodeView, updateParticleEmitters, loadSceneView } from \"./scene.js\";\nexport * from \"./controls.js\";\r\nexport { createSceneAssetCache } from \"./assets/cache.js\";\r\nexport type { SceneAssetCache } from \"./assets/cache.js\";\r\nexport * from \"./assets/textures.js\";\r\nexport * from \"./assets/spine.js\";\r\nexport * from \"./assets/fonts.js\";\r\nexport * from \"./assets/bitmapFonts.js\";\r\nexport * from \"./assets/sounds.js\";\r\nexport * from \"./audio/bus.js\";\r\nexport * from \"./audio/director.js\";\r\n"]}
|
package/dist/layout.d.ts
CHANGED
|
@@ -25,7 +25,11 @@ export type ResolvedSpineSettings = {
|
|
|
25
25
|
};
|
|
26
26
|
export declare const DEFAULT_TEXT_STYLE: TextStyleDefinition;
|
|
27
27
|
export declare const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Uniformly contains an authored viewport inside a physical host without changing its aspect ratio.
|
|
30
|
+
* Low-level primitive: callers with host measurements should use `resolveViewport`, which rejects
|
|
31
|
+
* zero, non-finite, and otherwise degenerate sizes before any profile or fit is computed.
|
|
32
|
+
*/
|
|
29
33
|
export declare function fitViewportToHost(viewport: LayoutSize, host: LayoutSize): FittedViewport;
|
|
30
34
|
/**
|
|
31
35
|
* Unity Canvas Scaler's `Scale With Screen Size / Match Width Or Height` calculation.
|
|
@@ -50,8 +54,20 @@ export declare function resolveSpineSettings(node: SpineNode, profile: LayoutPro
|
|
|
50
54
|
* share of the parent rectangle. Canvas Scaler is deliberately outside this function.
|
|
51
55
|
*/
|
|
52
56
|
export declare function resolveAnchoredTransform(transform: UINode["transform"], parentSize?: LayoutSize): UINode["transform"];
|
|
53
|
-
/**
|
|
54
|
-
export declare function
|
|
57
|
+
/** True when a viewport can safely participate in aspect-ratio and transform calculations. */
|
|
58
|
+
export declare function isUsableViewport(size: LayoutSize): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Picks the layout profile using the document's aspect-ratio rule; the breakpoint itself is mobile.
|
|
61
|
+
* Low-level primitive: it deliberately preserves the legacy result for degenerate numbers. Host code
|
|
62
|
+
* should use `resolveViewport` instead. Passing `current` adds a five-percent dead zone around the
|
|
63
|
+
* breakpoint so small resize oscillations do not repeatedly flip an already-live scene.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveProfileForViewport(settings: ProjectDocument["settings"], width: number, height: number, current?: LayoutProfileId): LayoutProfileId;
|
|
66
|
+
/** Safely resolves both the selected profile and contain-fit for a measured host. */
|
|
67
|
+
export declare function resolveViewport(settings: ProjectDocument["settings"], referenceViewport: LayoutSize | Record<LayoutProfileId, LayoutSize>, host: LayoutSize, current?: LayoutProfileId): {
|
|
68
|
+
profile: LayoutProfileId;
|
|
69
|
+
fit: FittedViewport;
|
|
70
|
+
} | null;
|
|
55
71
|
export declare function fitSpineToTransform(bounds: {
|
|
56
72
|
x: number;
|
|
57
73
|
y: number;
|
package/dist/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,MAAM,EAAE,M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AS,CAmBtE"}
|
package/dist/layout.js
CHANGED
|
@@ -3,7 +3,12 @@ export const DEFAULT_TEXT_STYLE = {
|
|
|
3
3
|
align: "left", verticalAlign: "top", wordWrap: false, breakWords: false, letterSpacing: 0,
|
|
4
4
|
};
|
|
5
5
|
export const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;
|
|
6
|
-
|
|
6
|
+
const PROFILE_BREAKPOINT_HYSTERESIS = 0.05;
|
|
7
|
+
/**
|
|
8
|
+
* Uniformly contains an authored viewport inside a physical host without changing its aspect ratio.
|
|
9
|
+
* Low-level primitive: callers with host measurements should use `resolveViewport`, which rejects
|
|
10
|
+
* zero, non-finite, and otherwise degenerate sizes before any profile or fit is computed.
|
|
11
|
+
*/
|
|
7
12
|
export function fitViewportToHost(viewport, host) {
|
|
8
13
|
const scale = Math.min(host.width / viewport.width, host.height / viewport.height);
|
|
9
14
|
const width = viewport.width * scale;
|
|
@@ -94,9 +99,34 @@ export function resolveAnchoredTransform(transform, parentSize) {
|
|
|
94
99
|
height: (maxY - minY) * parentSize.height + transform.height,
|
|
95
100
|
};
|
|
96
101
|
}
|
|
97
|
-
/**
|
|
98
|
-
export function
|
|
99
|
-
return width
|
|
102
|
+
/** True when a viewport can safely participate in aspect-ratio and transform calculations. */
|
|
103
|
+
export function isUsableViewport(size) {
|
|
104
|
+
return Number.isFinite(size.width) && size.width > 0 && Number.isFinite(size.height) && size.height > 0;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Picks the layout profile using the document's aspect-ratio rule; the breakpoint itself is mobile.
|
|
108
|
+
* Low-level primitive: it deliberately preserves the legacy result for degenerate numbers. Host code
|
|
109
|
+
* should use `resolveViewport` instead. Passing `current` adds a five-percent dead zone around the
|
|
110
|
+
* breakpoint so small resize oscillations do not repeatedly flip an already-live scene.
|
|
111
|
+
*/
|
|
112
|
+
export function resolveProfileForViewport(settings, width, height, current) {
|
|
113
|
+
const breakpoint = settings.layoutProfileSelection.mobileMaxAspectRatio;
|
|
114
|
+
const aspectRatio = width / height;
|
|
115
|
+
if (current === "mobile" && aspectRatio <= breakpoint * (1 + PROFILE_BREAKPOINT_HYSTERESIS))
|
|
116
|
+
return current;
|
|
117
|
+
if (current === "desktop" && aspectRatio > breakpoint * (1 - PROFILE_BREAKPOINT_HYSTERESIS))
|
|
118
|
+
return current;
|
|
119
|
+
return aspectRatio <= breakpoint ? "mobile" : "desktop";
|
|
120
|
+
}
|
|
121
|
+
/** Safely resolves both the selected profile and contain-fit for a measured host. */
|
|
122
|
+
export function resolveViewport(settings, referenceViewport, host, current) {
|
|
123
|
+
if (!isUsableViewport(host))
|
|
124
|
+
return null;
|
|
125
|
+
const profile = resolveProfileForViewport(settings, host.width, host.height, current);
|
|
126
|
+
const selectedReference = "width" in referenceViewport ? referenceViewport : referenceViewport[profile];
|
|
127
|
+
if (!isUsableViewport(selectedReference))
|
|
128
|
+
return null;
|
|
129
|
+
return { profile, fit: fitViewportToHost(selectedReference, host) };
|
|
100
130
|
}
|
|
101
131
|
export function fitSpineToTransform(bounds, transform, referenceFrame) {
|
|
102
132
|
const fitBounds = referenceFrame ?? bounds;
|
package/dist/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS;IAC7F,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1F,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AAEvD,wGAAwG;AACxG,MAAM,UAAU,iBAAiB,CAAC,QAAoB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,KAAK,GAAG,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,KAAK;gBAClF,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,KAAK;aACrF;YACH,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QACnF,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE;QAClE,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import { type BitmapTextNode, type BitmapTextStyle, type LayoutProfileId, type ProjectDocument, type SpineReferenceFrame, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\n\r\nexport type ResolvedProfileTransform = {\r\n transform: UINode[\"transform\"];\r\n visible: boolean;\r\n};\r\n\r\nexport type LayoutSize = { width: number; height: number };\n\nexport type FittedViewport = {\n scale: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\r\ntype SpineNode = Extract<UINode, { type: \"spine\" }>;\r\nexport type ResolvedSpineSettings = { animation: string | undefined; autoplay: boolean; loop: boolean; animationSpeed: number };\r\n\r\nexport const DEFAULT_TEXT_STYLE: TextStyleDefinition = {\r\n fontFamily: \"Arial\", fontSize: 24, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\",\r\n align: \"left\", verticalAlign: \"top\", wordWrap: false, breakWords: false, letterSpacing: 0,\r\n};\r\n\r\nexport const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;\n\n/** Uniformly contains an authored viewport inside a physical host without changing its aspect ratio. */\nexport function fitViewportToHost(viewport: LayoutSize, host: LayoutSize): FittedViewport {\n const scale = Math.min(host.width / viewport.width, host.height / viewport.height);\n const width = viewport.width * scale;\n const height = viewport.height * scale;\n return {\n scale,\n x: (host.width - width) / 2,\n y: (host.height - height) / 2,\n width,\n height,\n };\n}\n\r\n/**\r\n * Unity Canvas Scaler's `Scale With Screen Size / Match Width Or Height` calculation.\r\n * Width and height are blended in logarithmic space, producing one uniform scale for the Canvas.\r\n */\r\nexport function getCanvasScale(\r\n screenSize: LayoutSize,\r\n referenceResolution: LayoutSize,\r\n matchWidthOrHeight = CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT,\r\n): number {\r\n const widthScale = screenSize.width / referenceResolution.width;\r\n const heightScale = screenSize.height / referenceResolution.height;\r\n const logWidth = Math.log2(widthScale);\r\n const logHeight = Math.log2(heightScale);\r\n return 2 ** (logWidth + (logHeight - logWidth) * matchWidthOrHeight);\r\n}\r\n\r\n/** Logical RectTransform space exposed by a scaled Canvas at the current screen aspect ratio. */\r\nexport function getCanvasLogicalSize(screenSize: LayoutSize, referenceResolution: LayoutSize): LayoutSize {\r\n const scale = getCanvasScale(screenSize, referenceResolution);\r\n return { width: screenSize.width / scale, height: screenSize.height / scale };\r\n}\r\n\r\n/** Resolves a node's base transform with a profile override applied field by field. */\r\nexport function resolveProfileTransform(node: UINode, profile: LayoutProfileId): ResolvedProfileTransform {\r\n const override = node.layoutOverrides?.[profile];\r\n\r\n return {\r\n transform: { ...node.transform, ...override?.transform },\r\n visible: override?.visible ?? node.visible,\r\n };\r\n}\r\n\r\n/** Resolves a text node's optional base style with the active profile's sparse style override. */\r\nexport function resolveTextStyle(node: TextNode, profile: LayoutProfileId): TextStyleDefinition | undefined {\n const override = node.textStyleOverrides?.[profile];\r\n if (node.style === undefined && override === undefined) return undefined;\r\n return { ...DEFAULT_TEXT_STYLE, ...node.style, ...override };\r\n}\n\n/** Resolves bitmap text's base visual presentation with the active sparse profile override. */\nexport function resolveBitmapTextStyle(node: BitmapTextNode, profile: LayoutProfileId): BitmapTextStyle {\n return {\n assetId: node.assetId,\n fontSize: node.fontSize,\n fill: node.fill,\n align: node.align,\n verticalAlign: node.verticalAlign,\n letterSpacing: node.letterSpacing,\n wordWrap: node.wordWrap,\n ...node.bitmapTextOverrides?.[profile],\n };\n}\n\r\n/** Resolves the authored initial Spine presentation; `null` explicitly clears a base animation. */\r\nexport function resolveSpineSettings(node: SpineNode, profile: LayoutProfileId): ResolvedSpineSettings {\r\n const override = node.spineOverrides?.[profile];\r\n return {\r\n animation: override?.animation === null ? undefined : override?.animation ?? node.animation,\r\n autoplay: override?.autoplay ?? node.autoplay ?? true,\r\n loop: override?.loop ?? node.loop ?? true,\r\n animationSpeed: override?.animationSpeed ?? node.animationSpeed ?? 1,\r\n };\r\n}\r\n\r\n/**\r\n * Resolves a Unity-style RectTransform in logical Canvas units.\r\n *\r\n * `x/y` are anchoredPosition (the pivot offset from the anchor reference), while `width/height`\r\n * are sizeDelta. A point anchor therefore keeps an absolute logical size; a split anchor adds its\r\n * share of the parent rectangle. Canvas Scaler is deliberately outside this function.\r\n */\r\nexport function resolveAnchoredTransform(transform: UINode[\"transform\"], parentSize?: LayoutSize): UINode[\"transform\"] {\r\n if (parentSize === undefined) return transform;\r\n const minX = transform.anchorMinX ?? 0;\r\n const minY = transform.anchorMinY ?? 0;\r\n const maxX = transform.anchorMaxX ?? minX;\r\n const maxY = transform.anchorMaxY ?? minY;\r\n const pivotX = transform.pivotX ?? 0;\r\n const pivotY = transform.pivotY ?? 0;\r\n return {\r\n ...transform,\r\n x: (minX + (maxX - minX) * pivotX) * parentSize.width + transform.x,\r\n y: (minY + (maxY - minY) * pivotY) * parentSize.height + transform.y,\r\n width: (maxX - minX) * parentSize.width + transform.width,\r\n height: (maxY - minY) * parentSize.height + transform.height,\r\n };\r\n}\r\n\r\n/** Picks the layout profile for a viewport using the document's aspect-ratio rule; the breakpoint itself is mobile. */\r\nexport function resolveProfileForViewport(settings: ProjectDocument[\"settings\"], width: number, height: number): LayoutProfileId {\r\n return width / height <= settings.layoutProfileSelection.mobileMaxAspectRatio ? \"mobile\" : \"desktop\";\r\n}\r\n\r\nexport function fitSpineToTransform(\r\n bounds: { x: number; y: number; width: number; height: number },\r\n transform: UINode[\"transform\"],\r\n referenceFrame?: SpineReferenceFrame,\r\n): { scaleX: number; scaleY: number; x: number; y: number } | undefined {\r\n const fitBounds = referenceFrame ?? bounds;\r\n if (!Number.isFinite(fitBounds.x) || !Number.isFinite(fitBounds.y) || !Number.isFinite(fitBounds.width) || !Number.isFinite(fitBounds.height) || fitBounds.width <= 0 || fitBounds.height <= 0) return undefined;\r\n if (referenceFrame !== undefined) {\r\n const scale = Math.min(transform.width / referenceFrame.width, transform.height / referenceFrame.height);\r\n return Number.isFinite(scale) && scale > 0\r\n ? {\r\n scaleX: scale,\r\n scaleY: scale,\r\n x: (transform.width - referenceFrame.width * scale) / 2 - referenceFrame.x * scale,\r\n y: (transform.height - referenceFrame.height * scale) / 2 - referenceFrame.y * scale,\r\n }\r\n : undefined;\r\n }\r\n const scaleX = transform.width / bounds.width;\r\n const scaleY = transform.height / bounds.height;\r\n return Number.isFinite(scaleX) && scaleX > 0 && Number.isFinite(scaleY) && scaleY > 0\r\n ? { scaleX, scaleY, x: -bounds.x * scaleX, y: -bounds.y * scaleY }\r\n : undefined;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EA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SAAS,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACzG,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;YACxC,CAAC,CAAC;gBACE,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,KAAK;gBACb,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,KAAK;gBAClF,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,GAAG,KAAK;aACrF;YACH,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QACnF,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE;QAClE,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC","sourcesContent":["import { type BitmapTextNode, type BitmapTextStyle, type LayoutProfileId, type ProjectDocument, type SpineReferenceFrame, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\n\r\nexport type ResolvedProfileTransform = {\r\n transform: UINode[\"transform\"];\r\n visible: boolean;\r\n};\r\n\r\nexport type LayoutSize = { width: number; height: number };\n\nexport type FittedViewport = {\n scale: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\r\ntype SpineNode = Extract<UINode, { type: \"spine\" }>;\r\nexport type ResolvedSpineSettings = { animation: string | undefined; autoplay: boolean; loop: boolean; animationSpeed: number };\r\n\r\nexport const DEFAULT_TEXT_STYLE: TextStyleDefinition = {\r\n fontFamily: \"Arial\", fontSize: 24, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\",\r\n align: \"left\", verticalAlign: \"top\", wordWrap: false, breakWords: false, letterSpacing: 0,\r\n};\r\n\r\nexport const CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT = 0.5;\nconst PROFILE_BREAKPOINT_HYSTERESIS = 0.05;\n\n/**\n * Uniformly contains an authored viewport inside a physical host without changing its aspect ratio.\n * Low-level primitive: callers with host measurements should use `resolveViewport`, which rejects\n * zero, non-finite, and otherwise degenerate sizes before any profile or fit is computed.\n */\nexport function fitViewportToHost(viewport: LayoutSize, host: LayoutSize): FittedViewport {\n const scale = Math.min(host.width / viewport.width, host.height / viewport.height);\n const width = viewport.width * scale;\n const height = viewport.height * scale;\n return {\n scale,\n x: (host.width - width) / 2,\n y: (host.height - height) / 2,\n width,\n height,\n };\n}\n\r\n/**\r\n * Unity Canvas Scaler's `Scale With Screen Size / Match Width Or Height` calculation.\r\n * Width and height are blended in logarithmic space, producing one uniform scale for the Canvas.\r\n */\r\nexport function getCanvasScale(\r\n screenSize: LayoutSize,\r\n referenceResolution: LayoutSize,\r\n matchWidthOrHeight = CANVAS_SCALER_MATCH_WIDTH_OR_HEIGHT,\r\n): number {\r\n const widthScale = screenSize.width / referenceResolution.width;\r\n const heightScale = screenSize.height / referenceResolution.height;\r\n const logWidth = Math.log2(widthScale);\r\n const logHeight = Math.log2(heightScale);\r\n return 2 ** (logWidth + (logHeight - logWidth) * matchWidthOrHeight);\r\n}\r\n\r\n/** Logical RectTransform space exposed by a scaled Canvas at the current screen aspect ratio. */\r\nexport function getCanvasLogicalSize(screenSize: LayoutSize, referenceResolution: LayoutSize): LayoutSize {\r\n const scale = getCanvasScale(screenSize, referenceResolution);\r\n return { width: screenSize.width / scale, height: screenSize.height / scale };\r\n}\r\n\r\n/** Resolves a node's base transform with a profile override applied field by field. */\r\nexport function resolveProfileTransform(node: UINode, profile: LayoutProfileId): ResolvedProfileTransform {\r\n const override = node.layoutOverrides?.[profile];\r\n\r\n return {\r\n transform: { ...node.transform, ...override?.transform },\r\n visible: override?.visible ?? node.visible,\r\n };\r\n}\r\n\r\n/** Resolves a text node's optional base style with the active profile's sparse style override. */\r\nexport function resolveTextStyle(node: TextNode, profile: LayoutProfileId): TextStyleDefinition | undefined {\n const override = node.textStyleOverrides?.[profile];\r\n if (node.style === undefined && override === undefined) return undefined;\r\n return { ...DEFAULT_TEXT_STYLE, ...node.style, ...override };\r\n}\n\n/** Resolves bitmap text's base visual presentation with the active sparse profile override. */\nexport function resolveBitmapTextStyle(node: BitmapTextNode, profile: LayoutProfileId): BitmapTextStyle {\n return {\n assetId: node.assetId,\n fontSize: node.fontSize,\n fill: node.fill,\n align: node.align,\n verticalAlign: node.verticalAlign,\n letterSpacing: node.letterSpacing,\n wordWrap: node.wordWrap,\n ...node.bitmapTextOverrides?.[profile],\n };\n}\n\r\n/** Resolves the authored initial Spine presentation; `null` explicitly clears a base animation. */\r\nexport function resolveSpineSettings(node: SpineNode, profile: LayoutProfileId): ResolvedSpineSettings {\r\n const override = node.spineOverrides?.[profile];\r\n return {\r\n animation: override?.animation === null ? undefined : override?.animation ?? node.animation,\r\n autoplay: override?.autoplay ?? node.autoplay ?? true,\r\n loop: override?.loop ?? node.loop ?? true,\r\n animationSpeed: override?.animationSpeed ?? node.animationSpeed ?? 1,\r\n };\r\n}\r\n\r\n/**\r\n * Resolves a Unity-style RectTransform in logical Canvas units.\r\n *\r\n * `x/y` are anchoredPosition (the pivot offset from the anchor reference), while `width/height`\r\n * are sizeDelta. A point anchor therefore keeps an absolute logical size; a split anchor adds its\r\n * share of the parent rectangle. Canvas Scaler is deliberately outside this function.\r\n */\r\nexport function resolveAnchoredTransform(transform: UINode[\"transform\"], parentSize?: LayoutSize): UINode[\"transform\"] {\r\n if (parentSize === undefined) return transform;\r\n const minX = transform.anchorMinX ?? 0;\r\n const minY = transform.anchorMinY ?? 0;\r\n const maxX = transform.anchorMaxX ?? minX;\r\n const maxY = transform.anchorMaxY ?? minY;\r\n const pivotX = transform.pivotX ?? 0;\r\n const pivotY = transform.pivotY ?? 0;\r\n return {\r\n ...transform,\r\n x: (minX + (maxX - minX) * pivotX) * parentSize.width + transform.x,\r\n y: (minY + (maxY - minY) * pivotY) * parentSize.height + transform.y,\r\n width: (maxX - minX) * parentSize.width + transform.width,\r\n height: (maxY - minY) * parentSize.height + transform.height,\r\n };\r\n}\r\n\r\n/** True when a viewport can safely participate in aspect-ratio and transform calculations. */\nexport function isUsableViewport(size: LayoutSize): boolean {\n return Number.isFinite(size.width) && size.width > 0 && Number.isFinite(size.height) && size.height > 0;\n}\n\n/**\n * Picks the layout profile using the document's aspect-ratio rule; the breakpoint itself is mobile.\n * Low-level primitive: it deliberately preserves the legacy result for degenerate numbers. Host code\n * should use `resolveViewport` instead. Passing `current` adds a five-percent dead zone around the\n * breakpoint so small resize oscillations do not repeatedly flip an already-live scene.\n */\nexport function resolveProfileForViewport(settings: ProjectDocument[\"settings\"], width: number, height: number, current?: LayoutProfileId): LayoutProfileId {\n const breakpoint = settings.layoutProfileSelection.mobileMaxAspectRatio;\n const aspectRatio = width / height;\n if (current === \"mobile\" && aspectRatio <= breakpoint * (1 + PROFILE_BREAKPOINT_HYSTERESIS)) return current;\n if (current === \"desktop\" && aspectRatio > breakpoint * (1 - PROFILE_BREAKPOINT_HYSTERESIS)) return current;\n return aspectRatio <= breakpoint ? \"mobile\" : \"desktop\";\n}\n\n/** Safely resolves both the selected profile and contain-fit for a measured host. */\nexport function resolveViewport(\n settings: ProjectDocument[\"settings\"],\n referenceViewport: LayoutSize | Record<LayoutProfileId, LayoutSize>,\n host: LayoutSize,\n current?: LayoutProfileId,\n): { profile: LayoutProfileId; fit: FittedViewport } | null {\n if (!isUsableViewport(host)) return null;\n const profile = resolveProfileForViewport(settings, host.width, host.height, current);\n const selectedReference = \"width\" in referenceViewport ? referenceViewport : referenceViewport[profile];\n if (!isUsableViewport(selectedReference)) return null;\n return { profile, fit: fitViewportToHost(selectedReference, host) };\n}\n\r\nexport function fitSpineToTransform(\r\n bounds: { x: number; y: number; width: number; height: number },\r\n transform: UINode[\"transform\"],\r\n referenceFrame?: SpineReferenceFrame,\r\n): { scaleX: number; scaleY: number; x: number; y: number } | undefined {\r\n const fitBounds = referenceFrame ?? bounds;\r\n if (!Number.isFinite(fitBounds.x) || !Number.isFinite(fitBounds.y) || !Number.isFinite(fitBounds.width) || !Number.isFinite(fitBounds.height) || fitBounds.width <= 0 || fitBounds.height <= 0) return undefined;\r\n if (referenceFrame !== undefined) {\r\n const scale = Math.min(transform.width / referenceFrame.width, transform.height / referenceFrame.height);\r\n return Number.isFinite(scale) && scale > 0\r\n ? {\r\n scaleX: scale,\r\n scaleY: scale,\r\n x: (transform.width - referenceFrame.width * scale) / 2 - referenceFrame.x * scale,\r\n y: (transform.height - referenceFrame.height * scale) / 2 - referenceFrame.y * scale,\r\n }\r\n : undefined;\r\n }\r\n const scaleX = transform.width / bounds.width;\r\n const scaleY = transform.height / bounds.height;\r\n return Number.isFinite(scaleX) && scaleX > 0 && Number.isFinite(scaleY) && scaleY > 0\r\n ? { scaleX, scaleY, x: -bounds.x * scaleX, y: -bounds.y * scaleY }\r\n : undefined;\r\n}\r\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Container, Matrix } from "pixi.js";
|
|
2
|
+
/**
|
|
3
|
+
* Мировая матрица узла, пересчитанная обходом предков.
|
|
4
|
+
* Не опирается на кэш `worldTransform`, который Pixi обновляет только в рендер-проходе, — поэтому
|
|
5
|
+
* корректна и до первого тика.
|
|
6
|
+
*/
|
|
7
|
+
export declare function containerWorldMatrix(view: Container): Matrix;
|
|
8
|
+
/**
|
|
9
|
+
* Ставит локальный transform `view` так, чтобы его мировой transform стал равен `world`,
|
|
10
|
+
* в системе координат текущего родителя `view`.
|
|
11
|
+
* `false` — родитель необратим (нулевой масштаб), transform не изменён.
|
|
12
|
+
*/
|
|
13
|
+
export declare function applyWorldTransform(view: Container, world: Matrix): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Переносит `view` под `newParent` (опционально на позицию `index` среди его детей),
|
|
16
|
+
* не двигая `view` на экране. Перенос в дереве выполняется всегда; `false` — мировой transform
|
|
17
|
+
* сохранить не удалось.
|
|
18
|
+
*/
|
|
19
|
+
export declare function reparentPreservingWorld(view: Container, newParent: Container, index?: number): boolean;
|
|
20
|
+
/** Оставляет `view` под текущим родителем, но совмещает его мировой transform с `source`. */
|
|
21
|
+
export declare function matchWorldTransform(view: Container, source: Container): boolean;
|
|
22
|
+
//# sourceMappingURL=liveTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveTransform.d.ts","sourceRoot":"","sources":["../src/liveTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAiB5C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAW5D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CA8B3E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAStG;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAE/E"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Matrix } from "pixi.js";
|
|
2
|
+
import { IDENTITY_TRANSFORM, invertAffine, multiplyAffine, transformRelativeToParent, } from "./transformSpace.js";
|
|
3
|
+
function affineFromMatrix(matrix) {
|
|
4
|
+
return { a: matrix.a, b: matrix.b, c: matrix.c, d: matrix.d, tx: matrix.tx, ty: matrix.ty };
|
|
5
|
+
}
|
|
6
|
+
function matrixFromAffine(matrix) {
|
|
7
|
+
return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Мировая матрица узла, пересчитанная обходом предков.
|
|
11
|
+
* Не опирается на кэш `worldTransform`, который Pixi обновляет только в рендер-проходе, — поэтому
|
|
12
|
+
* корректна и до первого тика.
|
|
13
|
+
*/
|
|
14
|
+
export function containerWorldMatrix(view) {
|
|
15
|
+
const chain = [];
|
|
16
|
+
for (let current = view; current !== null; current = current.parent)
|
|
17
|
+
chain.push(current);
|
|
18
|
+
let world = IDENTITY_TRANSFORM;
|
|
19
|
+
for (let index = chain.length - 1; index >= 0; index -= 1) {
|
|
20
|
+
const current = chain[index];
|
|
21
|
+
current.updateLocalTransform();
|
|
22
|
+
world = multiplyAffine(world, affineFromMatrix(current.localTransform));
|
|
23
|
+
}
|
|
24
|
+
return matrixFromAffine(world);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Ставит локальный transform `view` так, чтобы его мировой transform стал равен `world`,
|
|
28
|
+
* в системе координат текущего родителя `view`.
|
|
29
|
+
* `false` — родитель необратим (нулевой масштаб), transform не изменён.
|
|
30
|
+
*/
|
|
31
|
+
export function applyWorldTransform(view, world) {
|
|
32
|
+
const parentWorld = view.parent === null ? undefined : affineFromMatrix(containerWorldMatrix(view.parent));
|
|
33
|
+
const source = {
|
|
34
|
+
x: view.position.x,
|
|
35
|
+
y: view.position.y,
|
|
36
|
+
width: 1,
|
|
37
|
+
height: 1,
|
|
38
|
+
scaleX: view.scale.x,
|
|
39
|
+
scaleY: view.scale.y,
|
|
40
|
+
rotation: view.rotation,
|
|
41
|
+
// Schema pivots are normalized and multiplied by width/height in the shared kernel. Using a
|
|
42
|
+
// unit rectangle bridges Pixi's pixel pivot without exposing fake dimensions to callers.
|
|
43
|
+
pivotX: view.pivot.x,
|
|
44
|
+
pivotY: view.pivot.y,
|
|
45
|
+
};
|
|
46
|
+
const preserved = transformRelativeToParent(affineFromMatrix(world), parentWorld, source);
|
|
47
|
+
if (preserved !== undefined) {
|
|
48
|
+
view.position.set(preserved.x, preserved.y);
|
|
49
|
+
view.scale.set(preserved.scaleX, preserved.scaleY);
|
|
50
|
+
view.rotation = preserved.rotation;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
const inverseParent = parentWorld === undefined ? IDENTITY_TRANSFORM : invertAffine(parentWorld);
|
|
54
|
+
if (inverseParent === undefined)
|
|
55
|
+
return false;
|
|
56
|
+
// The shared schema decomposition rejected an otherwise valid affine transform because it needs
|
|
57
|
+
// skew. Pixi can represent that final branch, so let its own decomposition retain it exactly.
|
|
58
|
+
view.setFromMatrix(matrixFromAffine(multiplyAffine(inverseParent, affineFromMatrix(world))));
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Переносит `view` под `newParent` (опционально на позицию `index` среди его детей),
|
|
63
|
+
* не двигая `view` на экране. Перенос в дереве выполняется всегда; `false` — мировой transform
|
|
64
|
+
* сохранить не удалось.
|
|
65
|
+
*/
|
|
66
|
+
export function reparentPreservingWorld(view, newParent, index) {
|
|
67
|
+
const world = containerWorldMatrix(view);
|
|
68
|
+
view.parent?.removeChild(view);
|
|
69
|
+
if (index === undefined) {
|
|
70
|
+
newParent.addChild(view);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
newParent.addChildAt(view, Math.min(newParent.children.length, Math.max(0, index)));
|
|
74
|
+
}
|
|
75
|
+
return applyWorldTransform(view, world);
|
|
76
|
+
}
|
|
77
|
+
/** Оставляет `view` под текущим родителем, но совмещает его мировой transform с `source`. */
|
|
78
|
+
export function matchWorldTransform(view, source) {
|
|
79
|
+
return applyWorldTransform(view, containerWorldMatrix(source));
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=liveTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveTransform.js","sourceRoot":"","sources":["../src/liveTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,yBAAyB,GAE1B,MAAM,qBAAqB,CAAC;AAE7B,SAAS,gBAAgB,CAAC,MAAc;IACtC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;AAC9F,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAuB;IAC/C,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAClF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAe;IAClD,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,KAAK,IAAI,OAAO,GAAqB,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE3G,IAAI,KAAK,GAAG,kBAAkB,CAAC;IAC/B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O,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { Container, Matrix } from \"pixi.js\";\nimport {\n IDENTITY_TRANSFORM,\n invertAffine,\n multiplyAffine,\n transformRelativeToParent,\n type AffineTransform,\n} from \"./transformSpace.js\";\n\nfunction affineFromMatrix(matrix: Matrix): AffineTransform {\n return { a: matrix.a, b: matrix.b, c: matrix.c, d: matrix.d, tx: matrix.tx, ty: matrix.ty };\n}\n\nfunction matrixFromAffine(matrix: AffineTransform): Matrix {\n return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);\n}\n\n/**\n * Мировая матрица узла, пересчитанная обходом предков.\n * Не опирается на кэш `worldTransform`, который Pixi обновляет только в рендер-проходе, — поэтому\n * корректна и до первого тика.\n */\nexport function containerWorldMatrix(view: Container): Matrix {\n const chain: Container[] = [];\n for (let current: Container | null = view; current !== null; current = current.parent) chain.push(current);\n\n let world = IDENTITY_TRANSFORM;\n for (let index = chain.length - 1; index >= 0; index -= 1) {\n const current = chain[index]!;\n current.updateLocalTransform();\n world = multiplyAffine(world, affineFromMatrix(current.localTransform));\n }\n return matrixFromAffine(world);\n}\n\n/**\n * Ставит локальный transform `view` так, чтобы его мировой transform стал равен `world`,\n * в системе координат текущего родителя `view`.\n * `false` — родитель необратим (нулевой масштаб), transform не изменён.\n */\nexport function applyWorldTransform(view: Container, world: Matrix): boolean {\n const parentWorld = view.parent === null ? undefined : affineFromMatrix(containerWorldMatrix(view.parent));\n const source = {\n x: view.position.x,\n y: view.position.y,\n width: 1,\n height: 1,\n scaleX: view.scale.x,\n scaleY: view.scale.y,\n rotation: view.rotation,\n // Schema pivots are normalized and multiplied by width/height in the shared kernel. Using a\n // unit rectangle bridges Pixi's pixel pivot without exposing fake dimensions to callers.\n pivotX: view.pivot.x,\n pivotY: view.pivot.y,\n };\n const preserved = transformRelativeToParent(affineFromMatrix(world), parentWorld, source);\n if (preserved !== undefined) {\n view.position.set(preserved.x, preserved.y);\n view.scale.set(preserved.scaleX, preserved.scaleY);\n view.rotation = preserved.rotation;\n return true;\n }\n\n const inverseParent = parentWorld === undefined ? IDENTITY_TRANSFORM : invertAffine(parentWorld);\n if (inverseParent === undefined) return false;\n\n // The shared schema decomposition rejected an otherwise valid affine transform because it needs\n // skew. Pixi can represent that final branch, so let its own decomposition retain it exactly.\n view.setFromMatrix(matrixFromAffine(multiplyAffine(inverseParent, affineFromMatrix(world))));\n return true;\n}\n\n/**\n * Переносит `view` под `newParent` (опционально на позицию `index` среди его детей),\n * не двигая `view` на экране. Перенос в дереве выполняется всегда; `false` — мировой transform\n * сохранить не удалось.\n */\nexport function reparentPreservingWorld(view: Container, newParent: Container, index?: number): boolean {\n const world = containerWorldMatrix(view);\n view.parent?.removeChild(view);\n if (index === undefined) {\n newParent.addChild(view);\n } else {\n newParent.addChildAt(view, Math.min(newParent.children.length, Math.max(0, index)));\n }\n return applyWorldTransform(view, world);\n}\n\n/** Оставляет `view` под текущим родителем, но совмещает его мировой transform с `source`. */\nexport function matchWorldTransform(view: Container, source: Container): boolean {\n return applyWorldTransform(view, containerWorldMatrix(source));\n}\n"]}
|
package/dist/scene.d.ts
CHANGED
|
@@ -40,9 +40,16 @@ export type SceneViewResult = {
|
|
|
40
40
|
root: SceneViewport;
|
|
41
41
|
nodeViews: Map<string, Container>;
|
|
42
42
|
localization: SceneLocalization;
|
|
43
|
+
readonly profile: LayoutProfileId;
|
|
43
44
|
};
|
|
44
45
|
/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */
|
|
45
46
|
export declare function buildSceneView(document: ProjectDocument, sceneId: string, profile: LayoutProfileId, options: BuildSceneViewOptions): SceneViewResult;
|
|
47
|
+
/**
|
|
48
|
+
* Applies another layout profile to an already-built scene without loading assets or replacing views.
|
|
49
|
+
* Runtime-only state owned by the views (button state, page, capacity overrides, scroll position) is
|
|
50
|
+
* retained. Reapplying the live profile is an observable no-op.
|
|
51
|
+
*/
|
|
52
|
+
export declare function applyProfile(view: SceneViewResult, document: ProjectDocument, sceneId: string, profile: LayoutProfileId): void;
|
|
46
53
|
/**
|
|
47
54
|
* Applies a node's resolved transform, visibility, and content to an existing display object,
|
|
48
55
|
* so editors can update views in place without rebuilding the scene tree.
|
package/dist/scene.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAsG,KAAK,gBAAgB,EAA2B,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,KAAK,mBAAmB,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAA2F,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACvI,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAe1E,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,MAAM,qBAAqB,GAAG;IAClC,iGAAiG;IACjG,WAAW,EAAE,oBAAoB,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC3C,KAAK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AE;IAAE,WAAW,EAAE,oBAAoB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAAC,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,EAAE,aAAa,GAAE,uBAA4B,GAAG,OAAO,CAAC,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAGnX;AAED,yFAAyF;AACzF,wBAAsB,aAAa,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EACxB,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE;IAAE,WAAW,EAAE,oBAAoB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,GAC/J,OAAO,CAAC,eAAe,CAAC,CAY1B"}
|
package/dist/scene.js
CHANGED
|
@@ -142,7 +142,80 @@ export function buildSceneView(document, sceneId, profile, options) {
|
|
|
142
142
|
wireCheckboxGroups(owner.nodes, nodeViews);
|
|
143
143
|
wireSpineConnectors(owner.nodes, nodeViews);
|
|
144
144
|
wireNodeReferences(owner.nodes, nodeViews, interaction);
|
|
145
|
-
return { root: hostRoot, nodeViews, localization };
|
|
145
|
+
return { root: hostRoot, nodeViews, localization, profile };
|
|
146
|
+
}
|
|
147
|
+
const GRID_LINE_BREAK_LABEL = "__layout-grid-line-break__";
|
|
148
|
+
/** Recreates only technical Yoga line breaks while retaining every authored NodeView and wrapper. */
|
|
149
|
+
function syncGridLineBreaks(view, node, profile, nodesById, nodeViews) {
|
|
150
|
+
for (const child of [...view.layoutTarget.children]) {
|
|
151
|
+
if (child.label === GRID_LINE_BREAK_LABEL)
|
|
152
|
+
child.destroy();
|
|
153
|
+
}
|
|
154
|
+
const settings = resolveLayoutGroupSettings(node, profile);
|
|
155
|
+
for (const [childIndex, childId] of node.children.entries()) {
|
|
156
|
+
const childNode = nodesById.get(childId);
|
|
157
|
+
const childView = nodeViews.get(childId);
|
|
158
|
+
if (childNode !== undefined && childView instanceof NodeView && childView.parent instanceof LayoutItemContainer) {
|
|
159
|
+
view.addLayoutChild(childView.parent);
|
|
160
|
+
}
|
|
161
|
+
if (settings.constraint !== "flexible" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {
|
|
162
|
+
const lineBreak = createGridLineBreak(node, profile);
|
|
163
|
+
if (lineBreak !== undefined)
|
|
164
|
+
view.addLayoutChild(lineBreak);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Applies another layout profile to an already-built scene without loading assets or replacing views.
|
|
170
|
+
* Runtime-only state owned by the views (button state, page, capacity overrides, scroll position) is
|
|
171
|
+
* retained. Reapplying the live profile is an observable no-op.
|
|
172
|
+
*/
|
|
173
|
+
export function applyProfile(view, document, sceneId, profile) {
|
|
174
|
+
if (view.profile === profile)
|
|
175
|
+
return;
|
|
176
|
+
const scene = document.scenes.find((candidate) => candidate.id === sceneId);
|
|
177
|
+
if (scene === undefined)
|
|
178
|
+
throw new Error(`Scene '${sceneId}' does not exist in the project document.`);
|
|
179
|
+
const owner = resolveOwnerNodeGraph(document, scene);
|
|
180
|
+
const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));
|
|
181
|
+
const activeSpines = [...view.nodeViews.values()].filter((candidate) => candidate instanceof SpineNodeView && candidate.activeConnectorBones);
|
|
182
|
+
for (const spine of activeSpines)
|
|
183
|
+
spine.activeConnectorBones = false;
|
|
184
|
+
const screenSize = scene.layout.referenceViewports[profile];
|
|
185
|
+
const referenceResolution = scene.layout.preferredViewports[profile];
|
|
186
|
+
const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);
|
|
187
|
+
const updateNode = (nodeId, parentSize) => {
|
|
188
|
+
const node = nodesById.get(nodeId);
|
|
189
|
+
const nodeView = view.nodeViews.get(nodeId);
|
|
190
|
+
if (node === undefined || nodeView === undefined)
|
|
191
|
+
return;
|
|
192
|
+
const parentNode = node.parentId === null ? undefined : nodesById.get(node.parentId);
|
|
193
|
+
updateNodeView(nodeView, node, profile, parentSize, parentNode, node.type === "particle-emitter" ? document.effects.find((effect) => effect.id === node.effectId) : undefined, spineReferenceFrameFor(document, node));
|
|
194
|
+
const transform = resolveAnchoredTransform(resolveProfileTransform(node, profile).transform, parentSize);
|
|
195
|
+
const gridCell = parentNode?.type === "grid-layout" ? resolveLayoutGroupSettings(parentNode, profile) : undefined;
|
|
196
|
+
const childSize = node.parentId === null
|
|
197
|
+
? canvasSize
|
|
198
|
+
: gridCell !== undefined
|
|
199
|
+
? { width: gridCell.cellWidth, height: gridCell.cellHeight }
|
|
200
|
+
: parentNode?.type === "page-group"
|
|
201
|
+
? parentSize
|
|
202
|
+
: { width: transform.width, height: transform.height };
|
|
203
|
+
for (const childId of node.children)
|
|
204
|
+
updateNode(childId, childSize);
|
|
205
|
+
if (node.type === "grid-layout" && nodeView instanceof LayoutGroupNodeView)
|
|
206
|
+
syncGridLineBreaks(nodeView, node, profile, nodesById, view.nodeViews);
|
|
207
|
+
};
|
|
208
|
+
try {
|
|
209
|
+
for (const rootNodeId of owner.rootNodeIds)
|
|
210
|
+
updateNode(rootNodeId, canvasSize);
|
|
211
|
+
view.root.content.scale.set(getCanvasScale(screenSize, referenceResolution));
|
|
212
|
+
view.root.setReferenceViewport(screenSize);
|
|
213
|
+
view.profile = profile;
|
|
214
|
+
}
|
|
215
|
+
finally {
|
|
216
|
+
for (const spine of activeSpines)
|
|
217
|
+
spine.activeConnectorBones = true;
|
|
218
|
+
}
|
|
146
219
|
}
|
|
147
220
|
function wireSpineConnectors(nodes, nodeViews) {
|
|
148
221
|
for (const node of nodes) {
|
package/dist/scene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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AAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC;QAClM,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC;QACjE,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,CAAC;QAC/D,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC;KAC5E,CAAC,CAAC;IACH,OAAO,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AACpO,CAAC","sourcesContent":["import { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { createStableId, isLayoutGroup, isParticleEffect, resolveLayoutGroupSettings, resolveOwnerNodeGraph, type EffectDefinition, type GridLayoutSettings, type LayoutProfileId, type ProjectDocument, type Scene, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container, Texture, type Ticker } from \"pixi.js\";\r\nimport { loadSceneSpines } from \"./assets/spine.js\";\r\nimport { loadSceneTextures, type FileUrlResolver } from \"./assets/textures.js\";\r\nimport { loadSceneFonts } from \"./assets/fonts.js\";\r\nimport { loadSceneBitmapFonts } from \"./assets/bitmapFonts.js\";\r\nimport type { SceneAssetCache } from \"./assets/cache.js\";\r\nimport { getCanvasLogicalSize, getCanvasScale, resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./views/NodeView.js\";\r\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nimport { createNodeView } from \"./views/createNodeView.js\";\r\nimport { applyLayoutGroup, applyLayoutItem, createGridLineBreak, initializePixiLayout, LayoutItemContainer } from \"./layoutGroups.js\";\r\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\r\nimport { PageItemContainer } from \"./pageGroup.js\";\r\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nimport { PaginationNodeView, type PaginationArrow } from \"./views/PaginationNodeView.js\";\r\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nimport { ScrollItemContainer } from \"./scrollView.js\";\r\nimport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\r\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\nimport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\r\nimport { SceneLocalization, type SceneLocalizationOptions } from \"./localization.js\";\r\nimport { SceneViewport } from \"./SceneViewport.js\";\r\nimport { createSceneAudio, type AudioBus } from \"./audio/bus.js\";\r\n\r\nexport type BuildSceneViewOptions = {\r\n /** Explicit: an editor canvas must pass \"authoring\", Preview and the consuming app \"runtime\". */\r\n interaction: SceneInteractionMode;\r\n textures?: ReadonlyMap<string, Texture>;\r\n spines?: ReadonlyMap<string, SkeletonData>;\r\n fonts?: ReadonlyMap<string, string>;\r\n bitmapFonts?: ReadonlyMap<string, string>;\r\n /**\r\n * Шина звуковых событий (обычно `createRuntimeAudio(...)`). Без неё сцена не публикует звуковые\r\n * события вовсе — ровно так строится инертный authoring-канвас редактора.\r\n */\r\n audio?: AudioBus;\r\n /**\r\n * The host's own Application ticker, driving self-updating content such as Spine skeletons.\r\n * Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the\r\n * renderer that draws them — see the same rule as `updateParticleEmitters`.\r\n */\r\n ticker?: Ticker;\r\n /** Called after Yoga changes a managed rectangle; authoring hosts use it to refresh overlays. */\r\n onLayout?: () => void;\r\n /**\r\n * Начальное состояние локализации. Опция необязательна: при наличии `Text.textKey` base locale\r\n * каталога применяется и без неё, а документ без ключей выглядит ровно как раньше.\r\n */\r\n localization?: SceneLocalizationOptions;\r\n /** Internal host boundary override: prefab views are spawnable content, not screen viewports. */\r\n clipToViewport?: boolean;\r\n};\r\n\r\nexport type SceneViewResult = { root: SceneViewport; nodeViews: Map<string, Container>; localization: SceneLocalization };\r\nconst particleEmitterRegistry = new WeakMap<Container, readonly ParticleEmitterNodeView[]>();\r\n\r\nfunction spineReferenceFrameFor(document: ProjectDocument, node: UINode): SpineReferenceFrame | undefined {\r\n if (node.type !== \"spine\") return undefined;\r\n const asset = document.assets.find((candidate) => candidate.id === node.assetId);\r\n return asset?.type === \"spine\" ? asset.referenceFrame : undefined;\r\n}\r\n\r\n/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */\r\nexport function buildSceneView(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n profile: LayoutProfileId,\r\n options: BuildSceneViewOptions,\r\n): SceneViewResult {\r\n initializePixiLayout();\r\n const { interaction, textures, spines, fonts, bitmapFonts, ticker, onLayout } = options;\r\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\r\n\r\n if (scene === undefined) {\r\n throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n }\r\n\r\n const nodeViews = new Map<string, Container>();\r\n const particleEmitters: ParticleEmitterNodeView[] = [];\r\n // Резолв «id ассета → имя звука» живёт здесь: вьюхи знают только id, а документ — только эта функция.\r\n const sceneAudio = options.audio === undefined ? undefined : createSceneAudio(document, options.audio);\r\n\r\n // Materialized prefab children use instance-scoped IDs, so authoring and runtime can address\r\n // multiple instances independently without changing canonical definition IDs.\r\n const screenSize = scene.layout.referenceViewports[profile];\r\n const referenceResolution = scene.layout.preferredViewports[profile];\r\n const canvasScale = getCanvasScale(screenSize, referenceResolution);\r\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\r\n\r\n // Единый резолвер иерархии: тот же граф, что видит редактор, включая вложенные пресеты.\r\n const owner = resolveOwnerNodeGraph(document, scene);\r\n const prefabIds = new Set(document.prefabs.map((prefab) => prefab.id));\r\n\r\n const buildOwner = (rootSize: LayoutSize): Container => {\r\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\r\n\r\n const buildNode = (nodeId: string, parentSize: LayoutSize): NodeView => {\r\n const node = nodesById.get(nodeId);\r\n\r\n if (node === undefined) {\r\n throw new Error(`Scene '${sceneId}' references missing node '${nodeId}'.`);\r\n }\r\n\r\n const resolved = resolveProfileTransform(node, profile);\r\n const transform = resolveAnchoredTransform(resolved.transform, parentSize);\r\n const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sceneAudio, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\r\n // Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.\r\n view.update(node, profile, parentSize);\r\n nodeViews.set(node.id, view);\r\n if (view instanceof ParticleEmitterNodeView) particleEmitters.push(view);\r\n\r\n // Прямые дети корня сцены разрешают якоря относительно логического Canvas, а не размера корня.\r\n // Прямой ребёнок grid-layout (сам `node` здесь) не владеет своим отрисованным размером: Unity-подобная\r\n // фиксированная ячейка полностью переопределяет authored transform (см. applyLayoutItem). Его\r\n // собственным потомкам нужен именно cellWidth/cellHeight, а не anchor-resolved authored-размер —\r\n // иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.\r\n const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);\r\n const gridCell = gridParent?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(gridParent, profile) : undefined;\r\n // Та же логика для прямого ребёнка page-group (страницы): `PageItemContainer`/`updateManaged`\r\n // растягивают её на весь resolved rectangle группы независимо от собственных anchors ноды\r\n // (см. NodeView.applyResolvedTransform, managedByLayout). Здесь `node` — сама страница, поэтому\r\n // это переопределённый размер, который она фактически получит, — `parentSize`, уже разрешённый\r\n // как rectangle page-group. Без этой ветки дети страницы якорились бы относительно её\r\n // anchor-resolved authored-размера, который может расходиться с фактическим rectangle группы,\r\n // особенно в другом layout-профиле.\r\n const childSize = node.parentId === null\r\n ? rootSize\r\n : gridCell !== undefined\r\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\r\n : gridParent?.type === \"page-group\"\r\n ? parentSize\r\n : { width: transform.width, height: transform.height };\r\n for (const [childIndex, childId] of node.children.entries()) {\r\n const childNode = nodesById.get(childId);\r\n const childView = buildNode(childId, childSize);\r\n if (isLayoutGroup(node) && childNode !== undefined && view instanceof LayoutGroupNodeView) {\r\n const layoutItem = new LayoutItemContainer(childView, onLayout);\r\n applyLayoutItem(layoutItem, childNode, node, profile);\r\n view.addLayoutChild(layoutItem);\r\n } else if (node.type === \"scroll-view\" && childNode !== undefined && view instanceof ScrollViewNodeView) {\r\n const scrollItem = new ScrollItemContainer(childView, onLayout);\r\n // Как и у layout-item: собственный (не растянутый якорями) размер ребёнка — List не\r\n // предоставляет per-item override размера, в отличие от Yoga flexGrow/cellSize.\r\n const own = resolveProfileTransform(childNode, profile).transform;\r\n scrollItem.sync(childNode, profile, { width: own.width, height: own.height });\r\n view.addScrollItem(scrollItem);\r\n } else if (node.type === \"page-group\" && childNode !== undefined && view instanceof PageGroupNodeView) {\r\n // Unlike a scroll-view item, a page fills the group's own resolved rect completely\r\n // (`childSize`, computed above): a page is a full sub-screen, not content sized to itself.\r\n const pageItem = new PageItemContainer(childView);\r\n pageItem.sync(childNode, profile, childSize);\r\n view.addPageItem(pageItem);\r\n } else {\r\n view.addChild(childView);\r\n }\r\n if (node.type === \"grid-layout\") {\r\n const settings = node.layoutGroup.overrides?.[profile] === undefined ? node.layoutGroup.base : { ...node.layoutGroup.base, ...node.layoutGroup.overrides[profile] };\r\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\r\n const lineBreak = createGridLineBreak(node, profile);\r\n if (lineBreak !== undefined && view instanceof LayoutGroupNodeView) view.addLayoutChild(lineBreak);\r\n }\r\n }\r\n }\r\n\r\n return view;\r\n };\r\n\r\n const ownerRoot = new Container();\r\n for (const rootNodeId of owner.rootNodeIds) {\r\n ownerRoot.addChild(buildNode(rootNodeId, rootSize));\r\n }\r\n\r\n return ownerRoot;\r\n };\r\n\r\n const canvasRoot = buildOwner(canvasSize);\r\n canvasRoot.scale.set(canvasScale);\r\n const hostRoot = new SceneViewport(canvasRoot, screenSize, options.clipToViewport ?? interaction === \"runtime\");\r\n particleEmitterRegistry.set(hostRoot, particleEmitters);\r\n // Контроллер применяет переводы сразу к уже созданным views, поэтому keyed Text показывает\r\n // базовую локаль без единого дополнительного вызова со стороны хоста.\r\n const localization = new SceneLocalization(document, scene, nodeViews, options.localization);\r\n wireCheckboxGroups(owner.nodes, nodeViews);\r\n wireSpineConnectors(owner.nodes, nodeViews);\r\n wireNodeReferences(owner.nodes, nodeViews, interaction);\r\n return { root: hostRoot, nodeViews, localization };\r\n}\r\n\r\nfunction wireSpineConnectors(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\r\n for (const node of nodes) {\r\n if (node.type !== \"spine\") continue;\r\n const view = nodeViews.get(node.id);\r\n if (!(view instanceof SpineNodeView)) continue;\r\n view.setConnectorBones((node.connectors ?? []).flatMap((connector) => {\r\n const target = nodeViews.get(connector.targetNodeId);\r\n return target === undefined ? [] : [{ ...connector, target }];\r\n }));\r\n }\r\n}\r\n\r\n/**\r\n * Разрешает все ссылки «нода → нода» в живые views: элементы item table и кнопки-стрелки пагинатора.\r\n * Та же форма, что у `wireSpineConnectors`: документ хранит id, а во что он превратился, знает только\r\n * собранная сцена, поэтому сами виды никогда не резолвят id. Один проход на все виды ссылок, чтобы\r\n * следующая не завела собственный обход с чуть другой областью видимости.\r\n *\r\n * Стрелки подключаются только в runtime-сцене: на authoring-канвасе контрол инертен, как и клик по\r\n * самой точке пагинатора. Вместимость таблицы, наоборот, видна и в редакторе — это не интерактивность.\r\n */\r\nfunction wireNodeReferences(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>, interaction: SceneInteractionMode): void {\r\n const arrowView = (nodeId: string | undefined): PaginationArrow | undefined => {\r\n const view = nodeId === undefined ? undefined : nodeViews.get(nodeId);\r\n return view instanceof ButtonNodeView || view instanceof StagedButtonNodeView ? view : undefined;\r\n };\r\n for (const node of nodes) {\r\n const view = nodeViews.get(node.id);\r\n if (node.type === \"item-table\" && view instanceof ItemTableNodeView) {\r\n view.setItems((node.items ?? []).map((itemId) => nodeViews.get(itemId)));\r\n } else if (node.type === \"pagination\" && view instanceof PaginationNodeView && interaction === \"runtime\") {\r\n view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });\r\n } else if (node.type === \"page-group\" && view instanceof PageGroupNodeView && interaction === \"runtime\") {\r\n view.setArrows({ up: arrowView(node.pageUpButtonNodeId), down: arrowView(node.pageDownButtonNodeId) });\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Authored `group` gives sibling checkboxes radio-button behavior: checking one force-unchecks its\r\n * live group-mates (same `parentId`, same `group`), without touching the document. Runs once per\r\n * scene build; `CheckboxNodeView.forceCheck` never re-emits `onCheck`, so this can't recurse.\r\n */\r\nfunction wireCheckboxGroups(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\r\n const byGroup = new Map<string, CheckboxNodeView[]>();\r\n for (const node of nodes) {\r\n if (node.type !== \"checkbox\" || node.group === undefined) continue;\r\n const view = nodeViews.get(node.id);\r\n if (!(view instanceof CheckboxNodeView)) continue;\r\n const key = `${node.parentId ?? \"\"}::${node.group}`;\r\n const group = byGroup.get(key) ?? [];\r\n group.push(view);\r\n byGroup.set(key, group);\r\n }\r\n for (const group of byGroup.values()) {\r\n if (group.length < 2) continue;\r\n for (const view of group) {\r\n view.onCheck.connect((checked) => {\r\n if (!checked) return;\r\n for (const other of group) if (other !== view) other.forceCheck(false);\r\n });\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Applies a node's resolved transform, visibility, and content to an existing display object,\r\n * so editors can update views in place without rebuilding the scene tree.\r\n */\r\nexport function updateNodeView(view: Container, node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize, parentNode?: UINode, effect?: EffectDefinition, spineReferenceFrame?: SpineReferenceFrame): void {\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\r\n if (!(view instanceof NodeView)) return;\r\n if (view instanceof SpineNodeView) view.setReferenceFrame(spineReferenceFrame);\r\n if (node.type === \"particle-emitter\" && effect !== undefined && isParticleEffect(effect) && \"syncEffect\" in view && typeof (view as { syncEffect?: unknown }).syncEffect === \"function\") (view as { syncEffect(effect: import(\"@pixi-ui-editor/schema\").ParticleEffectDefinition): void }).syncEffect(effect);\r\n if (parentNode !== undefined && isLayoutGroup(parentNode) && view.parent instanceof LayoutItemContainer) {\r\n applyLayoutItem(view.parent, node, parentNode, profile);\r\n } else if (parentNode !== undefined && parentNode.type === \"scroll-view\" && view.parent instanceof ScrollItemContainer) {\r\n const own = resolveProfileTransform(node, profile).transform;\r\n view.parent.sync(node, profile, { width: own.width, height: own.height });\r\n } else if (parentNode !== undefined && parentNode.type === \"page-group\" && view.parent instanceof PageItemContainer && parentSize !== undefined) {\r\n // A page is position-managed exactly like a layout/scroll item: it fills the group's own rectangle\r\n // (`parentSize`, the same value `buildSceneView` passes as `childSize`). Without this branch an\r\n // in-place update fell through to `view.update` and handed the page back its authored x/y and\r\n // anchors, so editing anything inside a page group knocked its pages out of place.\r\n view.parent.sync(node, profile, parentSize);\r\n } else {\r\n view.update(node, profile, parentSize);\r\n }\r\n}\r\n\r\n/** Previews a resolved editor rectangle without consulting content bounds or rebuilding the view. */\r\nexport function previewNodeView(view: Container, node: UINode, profile: LayoutProfileId, transform: UINode[\"transform\"]): void {\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, undefined, { width: transform.width, height: transform.height });\r\n if (view instanceof NodeView) view.preview(node, transform, resolveProfileTransform(node, profile).visible, profile);\r\n}\r\n\r\n/** Hosts call this from their own Application ticker; runtime never subscribes to Ticker.shared. */\r\nexport function updateParticleEmitters(root: Container, deltaSeconds: number): void {\r\n const registered = particleEmitterRegistry.get(root);\r\n if (registered !== undefined) {\r\n for (const emitter of registered) emitter.updateParticles(deltaSeconds);\r\n return;\r\n }\r\n // Backward-compatible fallback for hosts that assemble a display tree manually instead of using\r\n // buildSceneView. Built scenes always take the O(emitter count) registry path above.\r\n const visit = (view: Container): void => {\r\n if (view instanceof ParticleEmitterNodeView) view.updateParticles(deltaSeconds);\r\n for (const child of view.children) visit(child);\r\n };\r\n visit(root);\r\n}\r\n\r\n/** Lists the nodes a scene renders, including nodes of prefab definitions its prefab instances expand to. */\r\nexport function collectRenderedNodes(document: ProjectDocument, scene: Scene): UINode[] {\r\n return resolveOwnerNodeGraph(document, scene).nodes;\r\n}\r\n\r\nexport type PrefabViewConfiguration = Pick<Extract<UINode, { type: \"prefab-instance\" }>, \"propertyOverrides\" | \"locallyAddedNodes\"> & { instanceId?: string };\r\n\r\nfunction prefabScene(document: ProjectDocument, prefabId: string, configuration: PrefabViewConfiguration = {}): { document: ProjectDocument; sceneId: string; instanceId: string } {\r\n const prefab = document.prefabs.find((candidate) => candidate.id === prefabId);\r\n if (prefab === undefined) throw new Error(`Prefab '${prefabId}' does not exist in the project document.`);\r\n const width = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.x) + Math.max(0, node.transform.width)));\r\n const height = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.y) + Math.max(0, node.transform.height)));\r\n const instanceId = configuration.instanceId ?? createStableId();\r\n const instance: Extract<UINode, { type: \"prefab-instance\" }> = {\r\n id: instanceId, name: prefab.name, type: \"prefab-instance\", prefabId, parentId: null, children: [],\r\n visible: true, transform: { x: 0, y: 0, width, height, scaleX: 1, scaleY: 1, rotation: 0, anchorMinX: 0, anchorMaxX: 0, anchorMinY: 0, anchorMaxY: 0, pivotX: 0, pivotY: 0 },\r\n ...(configuration.propertyOverrides === undefined ? {} : { propertyOverrides: structuredClone(configuration.propertyOverrides) }),\r\n ...(configuration.locallyAddedNodes === undefined ? {} : { locallyAddedNodes: structuredClone(configuration.locallyAddedNodes) }),\r\n };\r\n const sceneId = createStableId();\r\n const viewport = { width, height };\r\n const scene: Scene = { id: sceneId, name: prefab.name, rootNodeIds: [instance.id], nodes: [instance], layout: { referenceViewports: { desktop: viewport, mobile: viewport }, preferredViewports: { desktop: viewport, mobile: viewport } } };\r\n return { document: { ...document, scenes: [...document.scenes, scene] }, sceneId, instanceId };\r\n}\r\n\r\n/** Builds a fresh runtime prefab instance without requiring it to already exist in a scene. */\r\nexport function buildPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, options: BuildSceneViewOptions, configuration: PrefabViewConfiguration = {}): SceneViewResult & { instanceId: string } {\r\n const synthetic = prefabScene(document, prefabId, configuration);\r\n return { ...buildSceneView(synthetic.document, synthetic.sceneId, profile, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\r\n}\r\n\r\n/** Loads a prefab's assets and returns a fresh display tree suitable for dynamic game-code spawning. */\r\nexport async function loadPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, resolveFileUrl: FileUrlResolver, options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; assetCache?: SceneAssetCache }, configuration: PrefabViewConfiguration = {}): Promise<SceneViewResult & { instanceId: string }> {\r\n const synthetic = prefabScene(document, prefabId, configuration);\r\n return { ...await loadSceneView(synthetic.document, synthetic.sceneId, profile, resolveFileUrl, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\r\n}\r\n\r\n/** Loads a scene's textures and Spine data, then builds its display tree in one call. */\r\nexport async function loadSceneView(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n profile: LayoutProfileId,\r\n resolveFileUrl: FileUrlResolver,\r\n options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; clipToViewport?: boolean; assetCache?: SceneAssetCache },\r\n): Promise<SceneViewResult> {\r\n // Без assetCache каждый вызов начинает с пустых кэшей: для одиночной загрузки сцены это нормально, а вот\r\n // игровой код, который поднимает пресеты по одному, обязан передать собственный кэш — иначе один и тот же\r\n // скелет, атлас и текстура парсятся заново на каждую вьюху и дублируются в видеопамяти.\r\n const cache = options.assetCache;\r\n const [textures, spines, fonts, bitmapFonts] = await Promise.all([\r\n loadSceneTextures(document, sceneId, (asset) => (asset.type === \"image\" ? resolveFileUrl(asset.source.uri) : undefined), resolveFileUrl, cache?.textures, cache?.spritesheets, cache?.bitmapFonts),\r\n loadSceneSpines(document, sceneId, resolveFileUrl, cache?.spines),\r\n loadSceneFonts(document, sceneId, resolveFileUrl, cache?.fonts),\r\n loadSceneBitmapFonts(document, sceneId, resolveFileUrl, cache?.bitmapFonts),\r\n ]);\r\n return buildSceneView(document, sceneId, profile, { interaction: options.interaction, textures, spines, fonts, bitmapFonts, ticker: options.ticker, localization: options.localization, clipToViewport: options.clipToViewport });\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,qBAAqB,EAAiJ,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAA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EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AACpO,CAAC","sourcesContent":["import { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { createStableId, isLayoutGroup, isParticleEffect, resolveLayoutGroupSettings, resolveOwnerNodeGraph, type EffectDefinition, type GridLayoutSettings, type LayoutProfileId, type ProjectDocument, type Scene, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container, Texture, type Ticker } from \"pixi.js\";\r\nimport { loadSceneSpines } from \"./assets/spine.js\";\r\nimport { loadSceneTextures, type FileUrlResolver } from \"./assets/textures.js\";\r\nimport { loadSceneFonts } from \"./assets/fonts.js\";\r\nimport { loadSceneBitmapFonts } from \"./assets/bitmapFonts.js\";\r\nimport type { SceneAssetCache } from \"./assets/cache.js\";\r\nimport { getCanvasLogicalSize, getCanvasScale, resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./views/NodeView.js\";\r\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nimport { createNodeView } from \"./views/createNodeView.js\";\r\nimport { applyLayoutGroup, applyLayoutItem, createGridLineBreak, initializePixiLayout, LayoutItemContainer } from \"./layoutGroups.js\";\r\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\r\nimport { PageItemContainer } from \"./pageGroup.js\";\r\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nimport { PaginationNodeView, type PaginationArrow } from \"./views/PaginationNodeView.js\";\r\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nimport { ScrollItemContainer } from \"./scrollView.js\";\r\nimport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\r\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\nimport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\r\nimport { SceneLocalization, type SceneLocalizationOptions } from \"./localization.js\";\r\nimport { SceneViewport } from \"./SceneViewport.js\";\r\nimport { createSceneAudio, type AudioBus } from \"./audio/bus.js\";\r\n\r\nexport type BuildSceneViewOptions = {\r\n /** Explicit: an editor canvas must pass \"authoring\", Preview and the consuming app \"runtime\". */\r\n interaction: SceneInteractionMode;\r\n textures?: ReadonlyMap<string, Texture>;\r\n spines?: ReadonlyMap<string, SkeletonData>;\r\n fonts?: ReadonlyMap<string, string>;\r\n bitmapFonts?: ReadonlyMap<string, string>;\r\n /**\r\n * Шина звуковых событий (обычно `createRuntimeAudio(...)`). Без неё сцена не публикует звуковые\r\n * события вовсе — ровно так строится инертный authoring-канвас редактора.\r\n */\r\n audio?: AudioBus;\r\n /**\r\n * The host's own Application ticker, driving self-updating content such as Spine skeletons.\r\n * Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the\r\n * renderer that draws them — see the same rule as `updateParticleEmitters`.\r\n */\r\n ticker?: Ticker;\r\n /** Called after Yoga changes a managed rectangle; authoring hosts use it to refresh overlays. */\r\n onLayout?: () => void;\r\n /**\r\n * Начальное состояние локализации. Опция необязательна: при наличии `Text.textKey` base locale\r\n * каталога применяется и без неё, а документ без ключей выглядит ровно как раньше.\r\n */\r\n localization?: SceneLocalizationOptions;\r\n /** Internal host boundary override: prefab views are spawnable content, not screen viewports. */\r\n clipToViewport?: boolean;\r\n};\r\n\r\nexport type SceneViewResult = { root: SceneViewport; nodeViews: Map<string, Container>; localization: SceneLocalization; readonly profile: LayoutProfileId };\nconst particleEmitterRegistry = new WeakMap<Container, readonly ParticleEmitterNodeView[]>();\r\n\r\nfunction spineReferenceFrameFor(document: ProjectDocument, node: UINode): SpineReferenceFrame | undefined {\r\n if (node.type !== \"spine\") return undefined;\r\n const asset = document.assets.find((candidate) => candidate.id === node.assetId);\r\n return asset?.type === \"spine\" ? asset.referenceFrame : undefined;\r\n}\r\n\r\n/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */\r\nexport function buildSceneView(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n profile: LayoutProfileId,\r\n options: BuildSceneViewOptions,\r\n): SceneViewResult {\r\n initializePixiLayout();\r\n const { interaction, textures, spines, fonts, bitmapFonts, ticker, onLayout } = options;\r\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\r\n\r\n if (scene === undefined) {\r\n throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n }\r\n\r\n const nodeViews = new Map<string, Container>();\r\n const particleEmitters: ParticleEmitterNodeView[] = [];\r\n // Резолв «id ассета → имя звука» живёт здесь: вьюхи знают только id, а документ — только эта функция.\r\n const sceneAudio = options.audio === undefined ? undefined : createSceneAudio(document, options.audio);\r\n\r\n // Materialized prefab children use instance-scoped IDs, so authoring and runtime can address\r\n // multiple instances independently without changing canonical definition IDs.\r\n const screenSize = scene.layout.referenceViewports[profile];\r\n const referenceResolution = scene.layout.preferredViewports[profile];\r\n const canvasScale = getCanvasScale(screenSize, referenceResolution);\r\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\r\n\r\n // Единый резолвер иерархии: тот же граф, что видит редактор, включая вложенные пресеты.\r\n const owner = resolveOwnerNodeGraph(document, scene);\r\n const prefabIds = new Set(document.prefabs.map((prefab) => prefab.id));\r\n\r\n const buildOwner = (rootSize: LayoutSize): Container => {\r\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\r\n\r\n const buildNode = (nodeId: string, parentSize: LayoutSize): NodeView => {\r\n const node = nodesById.get(nodeId);\r\n\r\n if (node === undefined) {\r\n throw new Error(`Scene '${sceneId}' references missing node '${nodeId}'.`);\r\n }\r\n\r\n const resolved = resolveProfileTransform(node, profile);\r\n const transform = resolveAnchoredTransform(resolved.transform, parentSize);\r\n const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sceneAudio, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\r\n // Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.\r\n view.update(node, profile, parentSize);\r\n nodeViews.set(node.id, view);\r\n if (view instanceof ParticleEmitterNodeView) particleEmitters.push(view);\r\n\r\n // Прямые дети корня сцены разрешают якоря относительно логического Canvas, а не размера корня.\r\n // Прямой ребёнок grid-layout (сам `node` здесь) не владеет своим отрисованным размером: Unity-подобная\r\n // фиксированная ячейка полностью переопределяет authored transform (см. applyLayoutItem). Его\r\n // собственным потомкам нужен именно cellWidth/cellHeight, а не anchor-resolved authored-размер —\r\n // иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.\r\n const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);\r\n const gridCell = gridParent?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(gridParent, profile) : undefined;\r\n // Та же логика для прямого ребёнка page-group (страницы): `PageItemContainer`/`updateManaged`\r\n // растягивают её на весь resolved rectangle группы независимо от собственных anchors ноды\r\n // (см. NodeView.applyResolvedTransform, managedByLayout). Здесь `node` — сама страница, поэтому\r\n // это переопределённый размер, который она фактически получит, — `parentSize`, уже разрешённый\r\n // как rectangle page-group. Без этой ветки дети страницы якорились бы относительно её\r\n // anchor-resolved authored-размера, который может расходиться с фактическим rectangle группы,\r\n // особенно в другом layout-профиле.\r\n const childSize = node.parentId === null\r\n ? rootSize\r\n : gridCell !== undefined\r\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\r\n : gridParent?.type === \"page-group\"\r\n ? parentSize\r\n : { width: transform.width, height: transform.height };\r\n for (const [childIndex, childId] of node.children.entries()) {\r\n const childNode = nodesById.get(childId);\r\n const childView = buildNode(childId, childSize);\r\n if (isLayoutGroup(node) && childNode !== undefined && view instanceof LayoutGroupNodeView) {\r\n const layoutItem = new LayoutItemContainer(childView, onLayout);\r\n applyLayoutItem(layoutItem, childNode, node, profile);\r\n view.addLayoutChild(layoutItem);\r\n } else if (node.type === \"scroll-view\" && childNode !== undefined && view instanceof ScrollViewNodeView) {\r\n const scrollItem = new ScrollItemContainer(childView, onLayout);\r\n // Как и у layout-item: собственный (не растянутый якорями) размер ребёнка — List не\r\n // предоставляет per-item override размера, в отличие от Yoga flexGrow/cellSize.\r\n const own = resolveProfileTransform(childNode, profile).transform;\r\n scrollItem.sync(childNode, profile, { width: own.width, height: own.height });\r\n view.addScrollItem(scrollItem);\r\n } else if (node.type === \"page-group\" && childNode !== undefined && view instanceof PageGroupNodeView) {\r\n // Unlike a scroll-view item, a page fills the group's own resolved rect completely\r\n // (`childSize`, computed above): a page is a full sub-screen, not content sized to itself.\r\n const pageItem = new PageItemContainer(childView);\r\n pageItem.sync(childNode, profile, childSize);\r\n view.addPageItem(pageItem);\r\n } else {\r\n view.addChild(childView);\r\n }\r\n if (node.type === \"grid-layout\") {\r\n const settings = node.layoutGroup.overrides?.[profile] === undefined ? node.layoutGroup.base : { ...node.layoutGroup.base, ...node.layoutGroup.overrides[profile] };\r\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\r\n const lineBreak = createGridLineBreak(node, profile);\r\n if (lineBreak !== undefined && view instanceof LayoutGroupNodeView) view.addLayoutChild(lineBreak);\r\n }\r\n }\r\n }\r\n\r\n return view;\r\n };\r\n\r\n const ownerRoot = new Container();\r\n for (const rootNodeId of owner.rootNodeIds) {\r\n ownerRoot.addChild(buildNode(rootNodeId, rootSize));\r\n }\r\n\r\n return ownerRoot;\r\n };\r\n\r\n const canvasRoot = buildOwner(canvasSize);\r\n canvasRoot.scale.set(canvasScale);\r\n const hostRoot = new SceneViewport(canvasRoot, screenSize, options.clipToViewport ?? interaction === \"runtime\");\r\n particleEmitterRegistry.set(hostRoot, particleEmitters);\r\n // Контроллер применяет переводы сразу к уже созданным views, поэтому keyed Text показывает\r\n // базовую локаль без единого дополнительного вызова со стороны хоста.\r\n const localization = new SceneLocalization(document, scene, nodeViews, options.localization);\r\n wireCheckboxGroups(owner.nodes, nodeViews);\r\n wireSpineConnectors(owner.nodes, nodeViews);\r\n wireNodeReferences(owner.nodes, nodeViews, interaction);\r\n return { root: hostRoot, nodeViews, localization, profile };\n}\n\nconst GRID_LINE_BREAK_LABEL = \"__layout-grid-line-break__\";\n\n/** Recreates only technical Yoga line breaks while retaining every authored NodeView and wrapper. */\nfunction syncGridLineBreaks(view: LayoutGroupNodeView, node: Extract<UINode, { type: \"grid-layout\" }>, profile: LayoutProfileId, nodesById: ReadonlyMap<string, UINode>, nodeViews: ReadonlyMap<string, Container>): void {\n for (const child of [...view.layoutTarget.children]) {\n if (child.label === GRID_LINE_BREAK_LABEL) child.destroy();\n }\n const settings = resolveLayoutGroupSettings<GridLayoutSettings>(node, profile);\n for (const [childIndex, childId] of node.children.entries()) {\n const childNode = nodesById.get(childId);\n const childView = nodeViews.get(childId);\n if (childNode !== undefined && childView instanceof NodeView && childView.parent instanceof LayoutItemContainer) {\n view.addLayoutChild(childView.parent);\n }\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\n const lineBreak = createGridLineBreak(node, profile);\n if (lineBreak !== undefined) view.addLayoutChild(lineBreak);\n }\n }\n}\n\n/**\n * Applies another layout profile to an already-built scene without loading assets or replacing views.\n * Runtime-only state owned by the views (button state, page, capacity overrides, scroll position) is\n * retained. Reapplying the live profile is an observable no-op.\n */\nexport function applyProfile(view: SceneViewResult, document: ProjectDocument, sceneId: string, profile: LayoutProfileId): void {\n if (view.profile === profile) return;\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\n if (scene === undefined) throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\n\n const owner = resolveOwnerNodeGraph(document, scene);\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\n const activeSpines = [...view.nodeViews.values()].filter((candidate): candidate is SpineNodeView => candidate instanceof SpineNodeView && candidate.activeConnectorBones);\n for (const spine of activeSpines) spine.activeConnectorBones = false;\n\n const screenSize = scene.layout.referenceViewports[profile];\n const referenceResolution = scene.layout.preferredViewports[profile];\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\n\n const updateNode = (nodeId: string, parentSize: LayoutSize): void => {\n const node = nodesById.get(nodeId);\n const nodeView = view.nodeViews.get(nodeId);\n if (node === undefined || nodeView === undefined) return;\n const parentNode = node.parentId === null ? undefined : nodesById.get(node.parentId);\n updateNodeView(nodeView, node, profile, parentSize, parentNode, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId) : undefined, spineReferenceFrameFor(document, node));\n\n const transform = resolveAnchoredTransform(resolveProfileTransform(node, profile).transform, parentSize);\n const gridCell = parentNode?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(parentNode, profile) : undefined;\n const childSize = node.parentId === null\n ? canvasSize\n : gridCell !== undefined\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\n : parentNode?.type === \"page-group\"\n ? parentSize\n : { width: transform.width, height: transform.height };\n for (const childId of node.children) updateNode(childId, childSize);\n if (node.type === \"grid-layout\" && nodeView instanceof LayoutGroupNodeView) syncGridLineBreaks(nodeView, node, profile, nodesById, view.nodeViews);\n };\n\n try {\n for (const rootNodeId of owner.rootNodeIds) updateNode(rootNodeId, canvasSize);\n view.root.content.scale.set(getCanvasScale(screenSize, referenceResolution));\n view.root.setReferenceViewport(screenSize);\n (view as { profile: LayoutProfileId }).profile = profile;\n } finally {\n for (const spine of activeSpines) spine.activeConnectorBones = true;\n }\n}\n\r\nfunction wireSpineConnectors(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\r\n for (const node of nodes) {\r\n if (node.type !== \"spine\") continue;\r\n const view = nodeViews.get(node.id);\r\n if (!(view instanceof SpineNodeView)) continue;\r\n view.setConnectorBones((node.connectors ?? []).flatMap((connector) => {\r\n const target = nodeViews.get(connector.targetNodeId);\r\n return target === undefined ? [] : [{ ...connector, target }];\r\n }));\r\n }\r\n}\r\n\r\n/**\r\n * Разрешает все ссылки «нода → нода» в живые views: элементы item table и кнопки-стрелки пагинатора.\r\n * Та же форма, что у `wireSpineConnectors`: документ хранит id, а во что он превратился, знает только\r\n * собранная сцена, поэтому сами виды никогда не резолвят id. Один проход на все виды ссылок, чтобы\r\n * следующая не завела собственный обход с чуть другой областью видимости.\r\n *\r\n * Стрелки подключаются только в runtime-сцене: на authoring-канвасе контрол инертен, как и клик по\r\n * самой точке пагинатора. Вместимость таблицы, наоборот, видна и в редакторе — это не интерактивность.\r\n */\r\nfunction wireNodeReferences(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>, interaction: SceneInteractionMode): void {\r\n const arrowView = (nodeId: string | undefined): PaginationArrow | undefined => {\r\n const view = nodeId === undefined ? undefined : nodeViews.get(nodeId);\r\n return view instanceof ButtonNodeView || view instanceof StagedButtonNodeView ? view : undefined;\r\n };\r\n for (const node of nodes) {\r\n const view = nodeViews.get(node.id);\r\n if (node.type === \"item-table\" && view instanceof ItemTableNodeView) {\r\n view.setItems((node.items ?? []).map((itemId) => nodeViews.get(itemId)));\r\n } else if (node.type === \"pagination\" && view instanceof PaginationNodeView && interaction === \"runtime\") {\r\n view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });\r\n } else if (node.type === \"page-group\" && view instanceof PageGroupNodeView && interaction === \"runtime\") {\r\n view.setArrows({ up: arrowView(node.pageUpButtonNodeId), down: arrowView(node.pageDownButtonNodeId) });\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Authored `group` gives sibling checkboxes radio-button behavior: checking one force-unchecks its\r\n * live group-mates (same `parentId`, same `group`), without touching the document. Runs once per\r\n * scene build; `CheckboxNodeView.forceCheck` never re-emits `onCheck`, so this can't recurse.\r\n */\r\nfunction wireCheckboxGroups(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\r\n const byGroup = new Map<string, CheckboxNodeView[]>();\r\n for (const node of nodes) {\r\n if (node.type !== \"checkbox\" || node.group === undefined) continue;\r\n const view = nodeViews.get(node.id);\r\n if (!(view instanceof CheckboxNodeView)) continue;\r\n const key = `${node.parentId ?? \"\"}::${node.group}`;\r\n const group = byGroup.get(key) ?? [];\r\n group.push(view);\r\n byGroup.set(key, group);\r\n }\r\n for (const group of byGroup.values()) {\r\n if (group.length < 2) continue;\r\n for (const view of group) {\r\n view.onCheck.connect((checked) => {\r\n if (!checked) return;\r\n for (const other of group) if (other !== view) other.forceCheck(false);\r\n });\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Applies a node's resolved transform, visibility, and content to an existing display object,\r\n * so editors can update views in place without rebuilding the scene tree.\r\n */\r\nexport function updateNodeView(view: Container, node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize, parentNode?: UINode, effect?: EffectDefinition, spineReferenceFrame?: SpineReferenceFrame): void {\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\r\n if (!(view instanceof NodeView)) return;\r\n if (view instanceof SpineNodeView) view.setReferenceFrame(spineReferenceFrame);\r\n if (node.type === \"particle-emitter\" && effect !== undefined && isParticleEffect(effect) && \"syncEffect\" in view && typeof (view as { syncEffect?: unknown }).syncEffect === \"function\") (view as { syncEffect(effect: import(\"@pixi-ui-editor/schema\").ParticleEffectDefinition): void }).syncEffect(effect);\r\n if (parentNode !== undefined && isLayoutGroup(parentNode) && view.parent instanceof LayoutItemContainer) {\r\n applyLayoutItem(view.parent, node, parentNode, profile);\r\n } else if (parentNode !== undefined && parentNode.type === \"scroll-view\" && view.parent instanceof ScrollItemContainer) {\r\n const own = resolveProfileTransform(node, profile).transform;\r\n view.parent.sync(node, profile, { width: own.width, height: own.height });\r\n } else if (parentNode !== undefined && parentNode.type === \"page-group\" && view.parent instanceof PageItemContainer && parentSize !== undefined) {\r\n // A page is position-managed exactly like a layout/scroll item: it fills the group's own rectangle\r\n // (`parentSize`, the same value `buildSceneView` passes as `childSize`). Without this branch an\r\n // in-place update fell through to `view.update` and handed the page back its authored x/y and\r\n // anchors, so editing anything inside a page group knocked its pages out of place.\r\n view.parent.sync(node, profile, parentSize);\r\n } else {\r\n view.update(node, profile, parentSize);\r\n }\r\n}\r\n\r\n/** Previews a resolved editor rectangle without consulting content bounds or rebuilding the view. */\r\nexport function previewNodeView(view: Container, node: UINode, profile: LayoutProfileId, transform: UINode[\"transform\"]): void {\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, undefined, { width: transform.width, height: transform.height });\r\n if (view instanceof NodeView) view.preview(node, transform, resolveProfileTransform(node, profile).visible, profile);\r\n}\r\n\r\n/** Hosts call this from their own Application ticker; runtime never subscribes to Ticker.shared. */\r\nexport function updateParticleEmitters(root: Container, deltaSeconds: number): void {\r\n const registered = particleEmitterRegistry.get(root);\r\n if (registered !== undefined) {\r\n for (const emitter of registered) emitter.updateParticles(deltaSeconds);\r\n return;\r\n }\r\n // Backward-compatible fallback for hosts that assemble a display tree manually instead of using\r\n // buildSceneView. Built scenes always take the O(emitter count) registry path above.\r\n const visit = (view: Container): void => {\r\n if (view instanceof ParticleEmitterNodeView) view.updateParticles(deltaSeconds);\r\n for (const child of view.children) visit(child);\r\n };\r\n visit(root);\r\n}\r\n\r\n/** Lists the nodes a scene renders, including nodes of prefab definitions its prefab instances expand to. */\r\nexport function collectRenderedNodes(document: ProjectDocument, scene: Scene): UINode[] {\r\n return resolveOwnerNodeGraph(document, scene).nodes;\r\n}\r\n\r\nexport type PrefabViewConfiguration = Pick<Extract<UINode, { type: \"prefab-instance\" }>, \"propertyOverrides\" | \"locallyAddedNodes\"> & { instanceId?: string };\r\n\r\nfunction prefabScene(document: ProjectDocument, prefabId: string, configuration: PrefabViewConfiguration = {}): { document: ProjectDocument; sceneId: string; instanceId: string } {\r\n const prefab = document.prefabs.find((candidate) => candidate.id === prefabId);\r\n if (prefab === undefined) throw new Error(`Prefab '${prefabId}' does not exist in the project document.`);\r\n const width = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.x) + Math.max(0, node.transform.width)));\r\n const height = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.y) + Math.max(0, node.transform.height)));\r\n const instanceId = configuration.instanceId ?? createStableId();\r\n const instance: Extract<UINode, { type: \"prefab-instance\" }> = {\r\n id: instanceId, name: prefab.name, type: \"prefab-instance\", prefabId, parentId: null, children: [],\r\n visible: true, transform: { x: 0, y: 0, width, height, scaleX: 1, scaleY: 1, rotation: 0, anchorMinX: 0, anchorMaxX: 0, anchorMinY: 0, anchorMaxY: 0, pivotX: 0, pivotY: 0 },\r\n ...(configuration.propertyOverrides === undefined ? {} : { propertyOverrides: structuredClone(configuration.propertyOverrides) }),\r\n ...(configuration.locallyAddedNodes === undefined ? {} : { locallyAddedNodes: structuredClone(configuration.locallyAddedNodes) }),\r\n };\r\n const sceneId = createStableId();\r\n const viewport = { width, height };\r\n const scene: Scene = { id: sceneId, name: prefab.name, rootNodeIds: [instance.id], nodes: [instance], layout: { referenceViewports: { desktop: viewport, mobile: viewport }, preferredViewports: { desktop: viewport, mobile: viewport } } };\r\n return { document: { ...document, scenes: [...document.scenes, scene] }, sceneId, instanceId };\r\n}\r\n\r\n/** Builds a fresh runtime prefab instance without requiring it to already exist in a scene. */\r\nexport function buildPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, options: BuildSceneViewOptions, configuration: PrefabViewConfiguration = {}): SceneViewResult & { instanceId: string } {\r\n const synthetic = prefabScene(document, prefabId, configuration);\r\n return { ...buildSceneView(synthetic.document, synthetic.sceneId, profile, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\r\n}\r\n\r\n/** Loads a prefab's assets and returns a fresh display tree suitable for dynamic game-code spawning. */\r\nexport async function loadPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, resolveFileUrl: FileUrlResolver, options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; assetCache?: SceneAssetCache }, configuration: PrefabViewConfiguration = {}): Promise<SceneViewResult & { instanceId: string }> {\r\n const synthetic = prefabScene(document, prefabId, configuration);\r\n return { ...await loadSceneView(synthetic.document, synthetic.sceneId, profile, resolveFileUrl, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\r\n}\r\n\r\n/** Loads a scene's textures and Spine data, then builds its display tree in one call. */\r\nexport async function loadSceneView(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n profile: LayoutProfileId,\r\n resolveFileUrl: FileUrlResolver,\r\n options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; clipToViewport?: boolean; assetCache?: SceneAssetCache },\r\n): Promise<SceneViewResult> {\r\n // Без assetCache каждый вызов начинает с пустых кэшей: для одиночной загрузки сцены это нормально, а вот\r\n // игровой код, который поднимает пресеты по одному, обязан передать собственный кэш — иначе один и тот же\r\n // скелет, атлас и текстура парсятся заново на каждую вьюху и дублируются в видеопамяти.\r\n const cache = options.assetCache;\r\n const [textures, spines, fonts, bitmapFonts] = await Promise.all([\r\n loadSceneTextures(document, sceneId, (asset) => (asset.type === \"image\" ? resolveFileUrl(asset.source.uri) : undefined), resolveFileUrl, cache?.textures, cache?.spritesheets, cache?.bitmapFonts),\r\n loadSceneSpines(document, sceneId, resolveFileUrl, cache?.spines),\r\n loadSceneFonts(document, sceneId, resolveFileUrl, cache?.fonts),\r\n loadSceneBitmapFonts(document, sceneId, resolveFileUrl, cache?.bitmapFonts),\r\n ]);\r\n return buildSceneView(document, sceneId, profile, { interaction: options.interaction, textures, spines, fonts, bitmapFonts, ticker: options.ticker, localization: options.localization, clipToViewport: options.clipToViewport });\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixi-ui-editor/runtime-pixi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "PixiJS runtime that renders Pixi UI Editor scene documents in a game.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"pixi.js": "^8.19.0",
|
|
31
31
|
"typed-signals": "^2.5.0",
|
|
32
32
|
"yoga-layout": "^3.2.1",
|
|
33
|
-
"@pixi-ui-editor/schema": "0.
|
|
33
|
+
"@pixi-ui-editor/schema": "0.17.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^26.2.0"
|