@pixi-ui-editor/runtime-pixi 0.16.0 → 0.18.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 -27
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/liveTransform.d.ts +23 -0
- package/dist/liveTransform.d.ts.map +1 -0
- package/dist/liveTransform.js +91 -0
- package/dist/liveTransform.js.map +1 -0
- package/dist/views/PaginationNodeView.d.ts +26 -1
- package/dist/views/PaginationNodeView.d.ts.map +1 -1
- package/dist/views/PaginationNodeView.js +31 -5
- package/dist/views/PaginationNodeView.js.map +1 -1
- package/dist/views/basic.d.ts +11 -1
- package/dist/views/basic.d.ts.map +1 -1
- package/dist/views/basic.js +63 -21
- package/dist/views/basic.js.map +1 -1
- package/dist/views/createNodeView.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,6 +10,28 @@ Consumes documents validated against [`@pixi-ui-editor/schema`](https://www.npmj
|
|
|
10
10
|
pnpm add @pixi-ui-editor/runtime-pixi
|
|
11
11
|
```
|
|
12
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
|
+
// World transform could not be preserved: the destination parent, or the view's own current
|
|
24
|
+
// world matrix, is singular (for example scale.x === 0). The tree move still happened.
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`containerWorldMatrix`, `applyWorldTransform`, and `matchWorldTransform` expose the same live-view
|
|
29
|
+
layer for lower-level use. `applyWorldTransform` returns `false` and leaves the local transform
|
|
30
|
+
untouched when either the target world matrix or the current parent is singular; on its successful
|
|
31
|
+
branch it also clears any stale `view.skew` so it cannot shear the result.
|
|
32
|
+
Use `NodeTransformSpace` instead when moving serialized document nodes: it additionally resolves
|
|
33
|
+
layout profiles, anchors, Canvas scaling, and layout-managed rectangles.
|
|
34
|
+
|
|
13
35
|
## Spawn a preset
|
|
14
36
|
|
|
15
37
|
```ts
|
|
@@ -92,33 +114,33 @@ app.stage.addChild(root);
|
|
|
92
114
|
root.resize({ width: app.screen.width, height: app.screen.height });
|
|
93
115
|
```
|
|
94
116
|
|
|
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
|
-
Hosts must not reproduce the fit formula or add their own viewport mask. Spawned prefab views stay
|
|
98
|
-
unclipped because they are scene content rather than player-screen boundaries.
|
|
99
|
-
|
|
100
|
-
Use `resolveViewport` for physical host measurements. It returns `null` while the host is collapsed or
|
|
101
|
-
non-finite, preventing a transient `0×0` measurement from selecting desktop and applying a singular
|
|
102
|
-
transform. `resolveProfileForViewport` and `fitViewportToHost` remain available as low-level primitives;
|
|
103
|
-
passing the live profile to the former enables a five-percent breakpoint dead zone.
|
|
104
|
-
|
|
105
|
-
```ts
|
|
106
|
-
const resolved = resolveViewport(
|
|
107
|
-
document.settings,
|
|
108
|
-
scene.layout.referenceViewports,
|
|
109
|
-
host,
|
|
110
|
-
mounted.profile,
|
|
111
|
-
);
|
|
112
|
-
if (resolved === null) return; // keep the last usable profile and transform
|
|
113
|
-
if (resolved.profile !== mounted.profile) applyProfile(mounted, document, sceneId, resolved.profile);
|
|
114
|
-
mounted.root.resize(host);
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Crossing the breakpoint does not require rebuilding or reloading assets. `SceneViewResult.profile` is
|
|
118
|
-
the source of truth for the live tree, and `applyProfile` updates its reference viewport, Canvas scale,
|
|
119
|
-
node transforms/styles, layout-managed children, page groups, item tables, scroll content, and fixed-grid
|
|
120
|
-
line breaks in place. Runtime state such as the current button/page, capacity override, and scroll offset
|
|
121
|
-
is retained; applying the already-live profile is a no-op.
|
|
117
|
+
Call `root.resize(...)` after the Pixi renderer changes size. It applies one uniform scale and centers
|
|
118
|
+
the unchanged authored viewport; letterbox and pillarbox space never reveal off-viewport content.
|
|
119
|
+
Hosts must not reproduce the fit formula or add their own viewport mask. Spawned prefab views stay
|
|
120
|
+
unclipped because they are scene content rather than player-screen boundaries.
|
|
121
|
+
|
|
122
|
+
Use `resolveViewport` for physical host measurements. It returns `null` while the host is collapsed or
|
|
123
|
+
non-finite, preventing a transient `0×0` measurement from selecting desktop and applying a singular
|
|
124
|
+
transform. `resolveProfileForViewport` and `fitViewportToHost` remain available as low-level primitives;
|
|
125
|
+
passing the live profile to the former enables a five-percent breakpoint dead zone.
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
const resolved = resolveViewport(
|
|
129
|
+
document.settings,
|
|
130
|
+
scene.layout.referenceViewports,
|
|
131
|
+
host,
|
|
132
|
+
mounted.profile,
|
|
133
|
+
);
|
|
134
|
+
if (resolved === null) return; // keep the last usable profile and transform
|
|
135
|
+
if (resolved.profile !== mounted.profile) applyProfile(mounted, document, sceneId, resolved.profile);
|
|
136
|
+
mounted.root.resize(host);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Crossing the breakpoint does not require rebuilding or reloading assets. `SceneViewResult.profile` is
|
|
140
|
+
the source of truth for the live tree, and `applyProfile` updates its reference viewport, Canvas scale,
|
|
141
|
+
node transforms/styles, layout-managed children, page groups, item tables, scroll content, and fixed-grid
|
|
142
|
+
line breaks in place. Runtime state such as the current button/page, capacity override, and scroll offset
|
|
143
|
+
is retained; applying the already-live profile is a no-op.
|
|
122
144
|
|
|
123
145
|
## Localization
|
|
124
146
|
|
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";
|
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,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,MA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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";
|
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,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\";\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B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C;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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 не удалось (вырожден сам `world` либо родитель `view`),
|
|
12
|
+
* локальный transform при этом не изменён, чтобы вызывающий мог откатиться по снимку.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyWorldTransform(view: Container, world: Matrix): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Переносит `view` под `newParent` (опционально на позицию `index` среди его детей),
|
|
17
|
+
* не двигая `view` на экране. Перенос в дереве выполняется всегда; `false` — мировой transform
|
|
18
|
+
* сохранить не удалось.
|
|
19
|
+
*/
|
|
20
|
+
export declare function reparentPreservingWorld(view: Container, newParent: Container, index?: number): boolean;
|
|
21
|
+
/** Оставляет `view` под текущим родителем, но совмещает его мировой transform с `source`. */
|
|
22
|
+
export declare function matchWorldTransform(view: Container, source: Container): boolean;
|
|
23
|
+
//# 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;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAsC3E;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,91 @@
|
|
|
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 не удалось (вырожден сам `world` либо родитель `view`),
|
|
30
|
+
* локальный transform при этом не изменён, чтобы вызывающий мог откатиться по снимку.
|
|
31
|
+
*/
|
|
32
|
+
export function applyWorldTransform(view, world) {
|
|
33
|
+
const worldAffine = affineFromMatrix(world);
|
|
34
|
+
// Вырожденная исходная мировая матрица (узел уже побывал под родителем с нулевым масштабом):
|
|
35
|
+
// любое разложение назад в локальный transform — молчаливый мусор, а не сохранение картинки.
|
|
36
|
+
if (invertAffine(worldAffine) === undefined)
|
|
37
|
+
return false;
|
|
38
|
+
const parentWorld = view.parent === null ? undefined : affineFromMatrix(containerWorldMatrix(view.parent));
|
|
39
|
+
const source = {
|
|
40
|
+
x: view.position.x,
|
|
41
|
+
y: view.position.y,
|
|
42
|
+
width: 1,
|
|
43
|
+
height: 1,
|
|
44
|
+
scaleX: view.scale.x,
|
|
45
|
+
scaleY: view.scale.y,
|
|
46
|
+
rotation: view.rotation,
|
|
47
|
+
// Schema pivots are normalized and multiplied by width/height in the shared kernel. Using a
|
|
48
|
+
// unit rectangle bridges Pixi's pixel pivot without exposing fake dimensions to callers.
|
|
49
|
+
pivotX: view.pivot.x,
|
|
50
|
+
pivotY: view.pivot.y,
|
|
51
|
+
};
|
|
52
|
+
const preserved = transformRelativeToParent(worldAffine, parentWorld, source);
|
|
53
|
+
if (preserved !== undefined) {
|
|
54
|
+
view.position.set(preserved.x, preserved.y);
|
|
55
|
+
view.scale.set(preserved.scaleX, preserved.scaleY);
|
|
56
|
+
view.rotation = preserved.rotation;
|
|
57
|
+
// Разложение схемы по построению без skew, а итоговая локальная матрица — ровно
|
|
58
|
+
// `inverseParent * world`. Уже стоявший на вьюхе skew в неё не входит, иначе он лёг бы поверх
|
|
59
|
+
// записанных значений и перекосил узел (fallback-ветка чистит его сама через setFromMatrix).
|
|
60
|
+
view.skew.set(0, 0);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
const inverseParent = parentWorld === undefined ? IDENTITY_TRANSFORM : invertAffine(parentWorld);
|
|
64
|
+
if (inverseParent === undefined)
|
|
65
|
+
return false;
|
|
66
|
+
// The shared schema decomposition rejected an otherwise valid affine transform because it needs
|
|
67
|
+
// skew. Pixi can represent that final branch, so let its own decomposition retain it exactly.
|
|
68
|
+
view.setFromMatrix(matrixFromAffine(multiplyAffine(inverseParent, worldAffine)));
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Переносит `view` под `newParent` (опционально на позицию `index` среди его детей),
|
|
73
|
+
* не двигая `view` на экране. Перенос в дереве выполняется всегда; `false` — мировой transform
|
|
74
|
+
* сохранить не удалось.
|
|
75
|
+
*/
|
|
76
|
+
export function reparentPreservingWorld(view, newParent, index) {
|
|
77
|
+
const world = containerWorldMatrix(view);
|
|
78
|
+
view.parent?.removeChild(view);
|
|
79
|
+
if (index === undefined) {
|
|
80
|
+
newParent.addChild(view);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
newParent.addChildAt(view, Math.min(newParent.children.length, Math.max(0, index)));
|
|
84
|
+
}
|
|
85
|
+
return applyWorldTransform(view, world);
|
|
86
|
+
}
|
|
87
|
+
/** Оставляет `view` под текущим родителем, но совмещает его мировой transform с `source`. */
|
|
88
|
+
export function matchWorldTransform(view, source) {
|
|
89
|
+
return applyWorldTransform(view, containerWorldMatrix(source));
|
|
90
|
+
}
|
|
91
|
+
//# 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,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IA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,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,mBAAmB,CAAC,IAAe,EAAE,MAAiB;IACpE,OAAO,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { Container, Matrix } from \"pixi.js\";\r\nimport {\r\n IDENTITY_TRANSFORM,\r\n invertAffine,\r\n multiplyAffine,\r\n transformRelativeToParent,\r\n type AffineTransform,\r\n} from \"./transformSpace.js\";\r\n\r\nfunction affineFromMatrix(matrix: Matrix): AffineTransform {\r\n return { a: matrix.a, b: matrix.b, c: matrix.c, d: matrix.d, tx: matrix.tx, ty: matrix.ty };\r\n}\r\n\r\nfunction matrixFromAffine(matrix: AffineTransform): Matrix {\r\n return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);\r\n}\r\n\r\n/**\r\n * Мировая матрица узла, пересчитанная обходом предков.\r\n * Не опирается на кэш `worldTransform`, который Pixi обновляет только в рендер-проходе, — поэтому\r\n * корректна и до первого тика.\r\n */\r\nexport function containerWorldMatrix(view: Container): Matrix {\r\n const chain: Container[] = [];\r\n for (let current: Container | null = view; current !== null; current = current.parent) chain.push(current);\r\n\r\n let world = IDENTITY_TRANSFORM;\r\n for (let index = chain.length - 1; index >= 0; index -= 1) {\r\n const current = chain[index]!;\r\n current.updateLocalTransform();\r\n world = multiplyAffine(world, affineFromMatrix(current.localTransform));\r\n }\r\n return matrixFromAffine(world);\r\n}\r\n\r\n/**\r\n * Ставит локальный transform `view` так, чтобы его мировой transform стал равен `world`,\r\n * в системе координат текущего родителя `view`.\r\n * `false` — сохранить мировой transform не удалось (вырожден сам `world` либо родитель `view`),\r\n * локальный transform при этом не изменён, чтобы вызывающий мог откатиться по снимку.\r\n */\r\nexport function applyWorldTransform(view: Container, world: Matrix): boolean {\r\n const worldAffine = affineFromMatrix(world);\r\n // Вырожденная исходная мировая матрица (узел уже побывал под родителем с нулевым масштабом):\r\n // любое разложение назад в локальный transform — молчаливый мусор, а не сохранение картинки.\r\n if (invertAffine(worldAffine) === undefined) return false;\r\n const parentWorld = view.parent === null ? undefined : affineFromMatrix(containerWorldMatrix(view.parent));\r\n const source = {\r\n x: view.position.x,\r\n y: view.position.y,\r\n width: 1,\r\n height: 1,\r\n scaleX: view.scale.x,\r\n scaleY: view.scale.y,\r\n rotation: view.rotation,\r\n // Schema pivots are normalized and multiplied by width/height in the shared kernel. Using a\r\n // unit rectangle bridges Pixi's pixel pivot without exposing fake dimensions to callers.\r\n pivotX: view.pivot.x,\r\n pivotY: view.pivot.y,\r\n };\r\n const preserved = transformRelativeToParent(worldAffine, parentWorld, source);\r\n if (preserved !== undefined) {\r\n view.position.set(preserved.x, preserved.y);\r\n view.scale.set(preserved.scaleX, preserved.scaleY);\r\n view.rotation = preserved.rotation;\r\n // Разложение схемы по построению без skew, а итоговая локальная матрица — ровно\r\n // `inverseParent * world`. Уже стоявший на вьюхе skew в неё не входит, иначе он лёг бы поверх\r\n // записанных значений и перекосил узел (fallback-ветка чистит его сама через setFromMatrix).\r\n view.skew.set(0, 0);\r\n return true;\r\n }\r\n\r\n const inverseParent = parentWorld === undefined ? IDENTITY_TRANSFORM : invertAffine(parentWorld);\r\n if (inverseParent === undefined) return false;\r\n\r\n // The shared schema decomposition rejected an otherwise valid affine transform because it needs\r\n // skew. Pixi can represent that final branch, so let its own decomposition retain it exactly.\r\n view.setFromMatrix(matrixFromAffine(multiplyAffine(inverseParent, worldAffine)));\r\n return true;\r\n}\r\n\r\n/**\r\n * Переносит `view` под `newParent` (опционально на позицию `index` среди его детей),\r\n * не двигая `view` на экране. Перенос в дереве выполняется всегда; `false` — мировой transform\r\n * сохранить не удалось.\r\n */\r\nexport function reparentPreservingWorld(view: Container, newParent: Container, index?: number): boolean {\r\n const world = containerWorldMatrix(view);\r\n view.parent?.removeChild(view);\r\n if (index === undefined) {\r\n newParent.addChild(view);\r\n } else {\r\n newParent.addChildAt(view, Math.min(newParent.children.length, Math.max(0, index)));\r\n }\r\n return applyWorldTransform(view, world);\r\n}\r\n\r\n/** Оставляет `view` под текущим родителем, но совмещает его мировой transform с `source`. */\r\nexport function matchWorldTransform(view: Container, source: Container): boolean {\r\n return applyWorldTransform(view, containerWorldMatrix(source));\r\n}\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PaginationNode, type UINode } from "@pixi-ui-editor/schema";
|
|
2
|
-
import { Texture } from "pixi.js";
|
|
2
|
+
import { Container, NineSliceSprite, Sprite, Text, Texture } from "pixi.js";
|
|
3
3
|
import { Signal } from "typed-signals";
|
|
4
4
|
import { NodeView, type SceneInteractionMode } from "./NodeView.js";
|
|
5
5
|
export type { PaginationNode };
|
|
@@ -14,6 +14,30 @@ export type PaginationArrow = {
|
|
|
14
14
|
};
|
|
15
15
|
enabled: boolean;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* One `numbers`-style item: a centered page-number label, plus an optional "pill" background shown
|
|
19
|
+
* only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the
|
|
20
|
+
* same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly
|
|
21
|
+
* whether or not its (rarely-present) background happens to be attached right now.
|
|
22
|
+
*/
|
|
23
|
+
/** @internal Exported only so DOM-free render-contract tests can exercise the background in isolation. */
|
|
24
|
+
export declare class NumberItem extends Container {
|
|
25
|
+
readonly numberText: Text;
|
|
26
|
+
private itemWidth;
|
|
27
|
+
private itemHeight;
|
|
28
|
+
private background?;
|
|
29
|
+
private backgroundMask?;
|
|
30
|
+
private backgroundCornerRadius?;
|
|
31
|
+
constructor(numberText: Text);
|
|
32
|
+
get width(): number;
|
|
33
|
+
set width(value: number);
|
|
34
|
+
get height(): number;
|
|
35
|
+
set height(value: number);
|
|
36
|
+
resize(width: number, height: number): void;
|
|
37
|
+
/** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */
|
|
38
|
+
setBackground(view: Sprite | NineSliceSprite | undefined, cornerRadius: number | undefined): void;
|
|
39
|
+
private syncBackgroundMask;
|
|
40
|
+
}
|
|
17
41
|
/**
|
|
18
42
|
* Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same
|
|
19
43
|
* approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never
|
|
@@ -52,6 +76,7 @@ export declare class PaginationNodeView extends NodeView {
|
|
|
52
76
|
private numberActiveColor;
|
|
53
77
|
private numberActiveBackgroundTexture;
|
|
54
78
|
private numberActiveNineSlice;
|
|
79
|
+
private numberActiveCornerRadius;
|
|
55
80
|
private pageCountState;
|
|
56
81
|
private currentPage;
|
|
57
82
|
private dotWidth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationNodeView.d.ts","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAA4B,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAExH,OAAO,
|
|
1
|
+
{"version":3,"file":"PaginationNodeView.d.ts","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAA4B,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAExH,OAAO,EAAE,SAAS,EAAY,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAyB,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpE,YAAY,EAAE,cAAc,EAAE,CAAC;AAuB/B;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE;QAAE,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI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G,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAKrB;IAED,iHAAiH;IACjH,OAAO,CAAC,OAAO;CAKhB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { List } from "@pixi/ui";
|
|
2
|
-
import { Container, NineSliceSprite, Sprite, Text, Texture } from "pixi.js";
|
|
2
|
+
import { Container, Graphics, NineSliceSprite, Sprite, Text, Texture } from "pixi.js";
|
|
3
3
|
import { Signal } from "typed-signals";
|
|
4
4
|
import { NodeView } from "./NodeView.js";
|
|
5
5
|
const DEFAULT_NUMBER_STYLE = { fontFamily: "Arial", fontSize: 18, fontWeight: "normal", fontStyle: "normal", fill: "#FFFFFF", align: "center", verticalAlign: "middle", wordWrap: false, breakWords: false, letterSpacing: 0 };
|
|
@@ -31,11 +31,14 @@ function clampPage(page, pageCount) {
|
|
|
31
31
|
* same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly
|
|
32
32
|
* whether or not its (rarely-present) background happens to be attached right now.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
/** @internal Exported only so DOM-free render-contract tests can exercise the background in isolation. */
|
|
35
|
+
export class NumberItem extends Container {
|
|
35
36
|
numberText;
|
|
36
37
|
itemWidth = 0;
|
|
37
38
|
itemHeight = 0;
|
|
38
39
|
background;
|
|
40
|
+
backgroundMask;
|
|
41
|
+
backgroundCornerRadius;
|
|
39
42
|
// Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.
|
|
40
43
|
constructor(numberText) {
|
|
41
44
|
super();
|
|
@@ -52,18 +55,38 @@ class NumberItem extends Container {
|
|
|
52
55
|
this.itemHeight = height;
|
|
53
56
|
this.numberText.position.set(width / 2, height / 2);
|
|
54
57
|
this.background?.setSize(width, height);
|
|
58
|
+
this.syncBackgroundMask();
|
|
55
59
|
}
|
|
56
60
|
/** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */
|
|
57
|
-
setBackground(view) {
|
|
61
|
+
setBackground(view, cornerRadius) {
|
|
58
62
|
if (this.background !== undefined) {
|
|
59
63
|
super.removeChild(this.background);
|
|
60
64
|
this.background.destroy();
|
|
61
65
|
}
|
|
66
|
+
if (this.backgroundMask !== undefined) {
|
|
67
|
+
super.removeChild(this.backgroundMask);
|
|
68
|
+
this.backgroundMask.destroy();
|
|
69
|
+
this.backgroundMask = undefined;
|
|
70
|
+
}
|
|
62
71
|
this.background = view;
|
|
72
|
+
this.backgroundCornerRadius = cornerRadius;
|
|
63
73
|
if (view === undefined)
|
|
64
74
|
return;
|
|
65
75
|
view.setSize(this.itemWidth, this.itemHeight);
|
|
66
76
|
super.addChildAt(view, 0);
|
|
77
|
+
if (cornerRadius !== undefined) {
|
|
78
|
+
this.backgroundMask = new Graphics();
|
|
79
|
+
this.syncBackgroundMask();
|
|
80
|
+
// Keep the mask before the background in this item's render tree, as SceneViewport does.
|
|
81
|
+
super.addChildAt(this.backgroundMask, 0);
|
|
82
|
+
view.mask = this.backgroundMask;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
syncBackgroundMask() {
|
|
86
|
+
if (this.backgroundMask === undefined)
|
|
87
|
+
return;
|
|
88
|
+
const radius = Math.min(this.backgroundCornerRadius ?? 0, this.itemWidth / 2, this.itemHeight / 2);
|
|
89
|
+
this.backgroundMask.clear().roundRect(0, 0, this.itemWidth, this.itemHeight, radius).fill(0xffffff);
|
|
67
90
|
}
|
|
68
91
|
}
|
|
69
92
|
/**
|
|
@@ -104,6 +127,7 @@ export class PaginationNodeView extends NodeView {
|
|
|
104
127
|
numberActiveColor;
|
|
105
128
|
numberActiveBackgroundTexture;
|
|
106
129
|
numberActiveNineSlice;
|
|
130
|
+
numberActiveCornerRadius;
|
|
107
131
|
pageCountState;
|
|
108
132
|
currentPage;
|
|
109
133
|
dotWidth;
|
|
@@ -122,6 +146,7 @@ export class PaginationNodeView extends NodeView {
|
|
|
122
146
|
this.numberActiveColor = node.numberActiveColor;
|
|
123
147
|
this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);
|
|
124
148
|
this.numberActiveNineSlice = node.numberActiveNineSlice;
|
|
149
|
+
this.numberActiveCornerRadius = node.numberActiveNineSlice === undefined ? node.numberActiveCornerRadius : undefined;
|
|
125
150
|
this.pageCountState = Math.max(1, Math.round(node.pageCount));
|
|
126
151
|
this.visibleSlots = node.visiblePageCount;
|
|
127
152
|
this.currentPage = clampPage(node.defaultPage, this.pageCount);
|
|
@@ -161,7 +186,7 @@ export class PaginationNodeView extends NodeView {
|
|
|
161
186
|
const item = new NumberItem(new Text({ text: exists ? String(page + 1) : "", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));
|
|
162
187
|
item.resize(this.dotWidth, this.dotHeight);
|
|
163
188
|
if (isActive && this.numberActiveBackgroundTexture !== undefined)
|
|
164
|
-
item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));
|
|
189
|
+
item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture), this.numberActiveCornerRadius);
|
|
165
190
|
return item;
|
|
166
191
|
}
|
|
167
192
|
/** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */
|
|
@@ -200,7 +225,7 @@ export class PaginationNodeView extends NodeView {
|
|
|
200
225
|
if (item instanceof NumberItem) {
|
|
201
226
|
item.numberText.text = exists ? String(page + 1) : "";
|
|
202
227
|
item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);
|
|
203
|
-
item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);
|
|
228
|
+
item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined, this.numberActiveCornerRadius);
|
|
204
229
|
return;
|
|
205
230
|
}
|
|
206
231
|
item.texture = isActive ? this.activeTexture : this.inactiveTexture;
|
|
@@ -247,6 +272,7 @@ export class PaginationNodeView extends NodeView {
|
|
|
247
272
|
this.numberActiveColor = node.numberActiveColor;
|
|
248
273
|
this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);
|
|
249
274
|
this.numberActiveNineSlice = node.numberActiveNineSlice;
|
|
275
|
+
this.numberActiveCornerRadius = node.numberActiveNineSlice === undefined ? node.numberActiveCornerRadius : undefined;
|
|
250
276
|
this.dotWidth = node.dotSize.width;
|
|
251
277
|
this.dotHeight = node.dotSize.height;
|
|
252
278
|
this.currentPage = clampPage(this.currentPage, this.pageCount);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationNodeView.js","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAyB,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAIpE,MAAM,oBAAoB,GAAwB,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAEpP;wGACwG;AACxG,SAAS,eAAe,CAAC,KAAsC,EAAE,IAAY,EAAE,KAA8C;IAC3H,MAAM,QAAQ,GAAG,KAAK,IAAI,oBAAoB,CAAC;IAC/C,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,QA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AI,IAAI,KAAK,IAAI,CAAC,cAAc;YAAE,OAAO;QACzC,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,IAAI,CAAC,SAAS,KAAK,iBAAiB;YAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;;YAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE/C,4GAA4G;IAC5G,IAAI,IAAI,CAAC,KAAa;QACpB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,iHAAiH;IACzG,OAAO,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { type LayoutPadding, type PaginationNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\nimport { List } from \"@pixi/ui\";\nimport { Container, NineSliceSprite, Sprite, Text, Texture, type TextStyleOptions } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { PaginationNode };\n\nconst DEFAULT_NUMBER_STYLE: TextStyleDefinition = { fontFamily: \"Arial\", fontSize: 18, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\", align: \"center\", verticalAlign: \"middle\", wordWrap: false, breakWords: false, letterSpacing: 0 };\n\n/** Same shape `ValueControlNodeViews.ts`'s own `textStyle` resolves — kept as its own small copy rather\n * than shared, the same call ADR 0029 makes for two similar-but-separately-evolving style resolvers. */\nfunction numberTextStyle(style: TextStyleDefinition | undefined, fill: string, fonts: ReadonlyMap<string, string> | undefined): Partial<TextStyleOptions> {\n const resolved = style ?? DEFAULT_NUMBER_STYLE;\n return {\n fontFamily: resolved.fontAssetId === undefined ? resolved.fontFamily : fonts?.get(resolved.fontAssetId) ?? resolved.fontFamily,\n fontSize: resolved.fontSize,\n fontWeight: resolved.fontWeight,\n fontStyle: resolved.fontStyle,\n fill,\n align: resolved.align,\n wordWrap: resolved.wordWrap,\n breakWords: resolved.breakWords,\n lineHeight: resolved.lineHeight,\n letterSpacing: resolved.letterSpacing,\n stroke: resolved.stroke === undefined ? undefined : { color: resolved.stroke.color, width: resolved.stroke.width },\n };\n}\n\n/**\n * Кнопка-стрелка пагинатора: ровно та часть `ButtonNodeView`/`StagedButtonNodeView`, которая нужна\n * виджету, — нажатие и «доступна ли». Тип объявлен структурно, чтобы этот файл не зависел от обоих\n * классов кнопок и не решал, какой из них «настоящий».\n */\nexport type PaginationArrow = { onPress: { connect(handler: () => void): unknown }; enabled: boolean };\n\n/** Clamps a page index into the valid `[0, pageCount)` range; an empty widget still shows dot 0. */\nfunction clampPage(page: number, pageCount: number): number {\n return Math.min(Math.max(0, Math.round(page)), Math.max(0, pageCount - 1));\n}\n\n/**\n * One `numbers`-style item: a centered page-number label, plus an optional \"pill\" background shown\n * only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the\n * same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly\n * whether or not its (rarely-present) background happens to be attached right now.\n */\nclass NumberItem extends Container {\n private itemWidth = 0;\n private itemHeight = 0;\n private background?: Sprite | NineSliceSprite;\n\n // Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.\n constructor(readonly numberText: Text) {\n super();\n numberText.anchor.set(0.5);\n super.addChild(numberText);\n }\n\n override get width(): number { return this.itemWidth; }\n override set width(value: number) { this.itemWidth = value; }\n override get height(): number { return this.itemHeight; }\n override set height(value: number) { this.itemHeight = value; }\n\n resize(width: number, height: number): void {\n this.itemWidth = width;\n this.itemHeight = height;\n this.numberText.position.set(width / 2, height / 2);\n this.background?.setSize(width, height);\n }\n\n /** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */\n setBackground(view: Sprite | NineSliceSprite | undefined): void {\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); }\n this.background = view;\n if (view === undefined) return;\n view.setSize(this.itemWidth, this.itemHeight);\n super.addChildAt(view, 0);\n }\n}\n\n/**\n * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same\n * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never\n * reimplements arrangement. Deliberately not wired to any scroll-view: game code owns the actual page\n * transition and drives the widget one-way through `setPaginationViewPage`/`setPaginationViewPageCount`,\n * the same relationship a slider or progress bar has to whatever value it displays.\n *\n * `style` picks between two mutually exclusive, differently-rendered item kinds — image dots\n * (`Sprite`, two states) or rendered page-number text (`NumberItem`: a label, base style + an optional\n * highlight color, plus an optional pill background behind only the current page) — never both.\n * Switching `style` rebuilds every item, the same \"view's required *type* changed\" rule\n * `StagedButtonNodeView` follows for its state views; `pageCount`/`dotSize` changes do too, since the\n * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this\n * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself\n * is not structural: switching pages only recreates the (one) background view that needs to move.\n *\n * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active\n * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real\n * page range keeps its footprint and renders nothing, so the active page never shifts sideways.\n *\n * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the\n * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution\n * Spine connector targets use) and steps the page on press. It never draws an arrow itself.\n */\nexport class PaginationNodeView extends NodeView {\n private readonly list: List;\n private readonly interaction: SceneInteractionMode;\n private readonly fonts: ReadonlyMap<string, string> | undefined;\n private items: (Sprite | NumberItem)[] = [];\n private visibleSlots: number | undefined;\n private arrows?: { previous?: PaginationArrow; next?: PaginationArrow };\n private styleMode: PaginationNode[\"style\"];\n private activeTexture: Texture;\n private inactiveTexture: Texture;\n private numberStyle: TextStyleDefinition | undefined;\n private numberActiveColor: string | undefined;\n private numberActiveBackgroundTexture: Texture | undefined;\n private numberActiveNineSlice: LayoutPadding | undefined;\n private pageCountState: number;\n private currentPage: number;\n private dotWidth: number;\n private dotHeight: number;\n private clickableState: boolean;\n\n /** Fires only from a click on an item (when `clickable`); setting `page` programmatically never emits. */\n readonly onPageChange = new Signal<(page: number) => void>();\n\n constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined) {\n super(textures);\n this.interaction = interaction;\n this.fonts = fonts;\n this.styleMode = node.style;\n this.activeTexture = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n this.inactiveTexture = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.pageCountState = Math.max(1, Math.round(node.pageCount));\n this.visibleSlots = node.visiblePageCount;\n this.currentPage = clampPage(node.defaultPage, this.pageCount);\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.clickableState = node.clickable;\n this.list = new List({ type: node.direction, elementsMargin: node.spacing });\n this.buildItems();\n this.setContent(this.list);\n }\n\n private createBackgroundView(texture: Texture): Sprite | NineSliceSprite {\n return this.numberActiveNineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });\n }\n\n /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */\n private get slotCount(): number {\n return this.visibleSlots === undefined ? this.pageCount : Math.max(1, Math.round(this.visibleSlots));\n }\n\n /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */\n private pageForSlot(slot: number): number {\n return this.visibleSlots === undefined ? slot : this.currentPage - Math.floor(this.slotCount / 2) + slot;\n }\n\n private createItem(slot: number): Sprite | NumberItem {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (this.styleMode === \"dots\") {\n const dot = new Sprite(isActive ? this.activeTexture : this.inactiveTexture);\n dot.setSize(this.dotWidth, this.dotHeight);\n // An out-of-range slot renders nothing but keeps its size, so `List` still reserves its place.\n dot.visible = exists;\n return dot;\n }\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\n const item = new NumberItem(new Text({ text: exists ? String(page + 1) : \"\", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));\n item.resize(this.dotWidth, this.dotHeight);\n if (isActive && this.numberActiveBackgroundTexture !== undefined) item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));\n return item;\n }\n\n /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */\n private buildItems(): void {\n this.list.removeChildren();\n this.items = [];\n for (let slot = 0; slot < this.slotCount; slot++) {\n const item = this.createItem(slot);\n this.wireItem(item, slot);\n this.items.push(item);\n this.list.addChild(item);\n }\n this.applyArrowState();\n }\n\n /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */\n private wireItem(item: Sprite | NumberItem, slot: number): void {\n if (this.interaction === \"authoring\" || !this.clickableState) { item.eventMode = \"none\"; return; }\n item.eventMode = \"static\";\n item.cursor = \"pointer\";\n // Resolved on click, not captured: a windowed slot points at a different page after every move.\n item.on(\"pointertap\", () => {\n const page = this.pageForSlot(slot);\n if (page >= 0 && page < this.pageCount) this.setPage(page);\n });\n }\n\n private applyCurrentPage(): void {\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n this.items.forEach((item, slot) => {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (item instanceof NumberItem) {\n item.numberText.text = exists ? String(page + 1) : \"\";\n item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);\n item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);\n return;\n }\n item.texture = isActive ? this.activeTexture : this.inactiveTexture;\n item.setSize(this.dotWidth, this.dotHeight);\n item.visible = exists;\n });\n this.applyArrowState();\n }\n\n /**\n * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит\n * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только\n * подписывается на них и гасит ту, за которой страниц больше нет.\n */\n setArrows(arrows: { previous?: PaginationArrow; next?: PaginationArrow }): void {\n this.arrows = arrows;\n arrows.previous?.onPress.connect(() => this.setPage(this.currentPage - 1));\n arrows.next?.onPress.connect(() => this.setPage(this.currentPage + 1));\n this.applyArrowState();\n }\n\n /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */\n private applyArrowState(): void {\n if (this.arrows === undefined) return;\n if (this.arrows.previous !== undefined) this.arrows.previous.enabled = this.currentPage > 0;\n if (this.arrows.next !== undefined) this.arrows.next.enabled = this.currentPage < this.pageCount - 1;\n }\n\n protected syncContent(node: UINode): void {\n if (node.type !== \"pagination\") return;\n const active = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n const pageCount = Math.max(1, Math.round(node.pageCount));\n this.clickableState = node.clickable;\n\n const previousSlotCount = this.slotCount;\n this.visibleSlots = node.visiblePageCount;\n this.pageCountState = pageCount;\n const structureChanged = node.style !== this.styleMode || this.slotCount !== previousSlotCount || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;\n this.styleMode = node.style;\n this.activeTexture = active;\n this.inactiveTexture = inactive;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n\n if (this.list.type !== node.direction) this.list.type = node.direction;\n if (this.list.elementsMargin !== node.spacing) this.list.elementsMargin = node.spacing;\n\n if (structureChanged) this.buildItems();\n else this.applyCurrentPage();\n }\n\n get pageCount(): number { return this.pageCountState; }\n\n /** Used by `setPaginationViewPageCount` once game code knows the real content length. */\n set pageCount(value: number) {\n const next = Math.max(1, Math.round(value));\n if (next === this.pageCountState) return;\n const previousSlotCount = this.slotCount;\n this.pageCountState = next;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n if (this.slotCount === previousSlotCount) this.applyCurrentPage();\n else this.buildItems();\n }\n\n get page(): number { return this.currentPage; }\n\n /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */\n set page(value: number) {\n const next = clampPage(value, this.pageCountState);\n if (next === this.currentPage) return;\n this.currentPage = next;\n this.applyCurrentPage();\n }\n\n /** An item click: highlights immediately, then notifies game code — the same order a checkbox/slider follows. */\n private setPage(index: number): void {\n const next = clampPage(index, this.pageCountState);\n if (next !== this.currentPage) { this.currentPage = next; this.applyCurrentPage(); }\n this.onPageChange.emit(next);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PaginationNodeView.js","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAyB,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAIpE,MAAM,oBAAoB,GAAwB,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAEpP;wGACwG;AACxG,SAAS,eAAe,CAAC,KAAsC,EAAE,IAAY,EAAE,KAA8C;IAC3H,MAAM,QAAQ,GAAG,KAAK,IAAI,oBAAoB,CAAC;IAC/C,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,UAAU;QAC9H,QAAQ,EAAE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,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,IAAI,IAAI,KAAK,IAAI,CAAC,cAAc;YAAE,OAAO;QACzC,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,IAAI,CAAC,SAAS,KAAK,iBAAiB;YAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;;YAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE/C,4GAA4G;IAC5G,IAAI,IAAI,CAAC,KAAa;QACpB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,iHAAiH;IACzG,OAAO,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { type LayoutPadding, type PaginationNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\nimport { List } from \"@pixi/ui\";\nimport { Container, Graphics, NineSliceSprite, Sprite, Text, Texture, type TextStyleOptions } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { PaginationNode };\n\nconst DEFAULT_NUMBER_STYLE: TextStyleDefinition = { fontFamily: \"Arial\", fontSize: 18, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\", align: \"center\", verticalAlign: \"middle\", wordWrap: false, breakWords: false, letterSpacing: 0 };\n\n/** Same shape `ValueControlNodeViews.ts`'s own `textStyle` resolves — kept as its own small copy rather\n * than shared, the same call ADR 0029 makes for two similar-but-separately-evolving style resolvers. */\nfunction numberTextStyle(style: TextStyleDefinition | undefined, fill: string, fonts: ReadonlyMap<string, string> | undefined): Partial<TextStyleOptions> {\n const resolved = style ?? DEFAULT_NUMBER_STYLE;\n return {\n fontFamily: resolved.fontAssetId === undefined ? resolved.fontFamily : fonts?.get(resolved.fontAssetId) ?? resolved.fontFamily,\n fontSize: resolved.fontSize,\n fontWeight: resolved.fontWeight,\n fontStyle: resolved.fontStyle,\n fill,\n align: resolved.align,\n wordWrap: resolved.wordWrap,\n breakWords: resolved.breakWords,\n lineHeight: resolved.lineHeight,\n letterSpacing: resolved.letterSpacing,\n stroke: resolved.stroke === undefined ? undefined : { color: resolved.stroke.color, width: resolved.stroke.width },\n };\n}\n\n/**\n * Кнопка-стрелка пагинатора: ровно та часть `ButtonNodeView`/`StagedButtonNodeView`, которая нужна\n * виджету, — нажатие и «доступна ли». Тип объявлен структурно, чтобы этот файл не зависел от обоих\n * классов кнопок и не решал, какой из них «настоящий».\n */\nexport type PaginationArrow = { onPress: { connect(handler: () => void): unknown }; enabled: boolean };\n\n/** Clamps a page index into the valid `[0, pageCount)` range; an empty widget still shows dot 0. */\nfunction clampPage(page: number, pageCount: number): number {\n return Math.min(Math.max(0, Math.round(page)), Math.max(0, pageCount - 1));\n}\n\n/**\n * One `numbers`-style item: a centered page-number label, plus an optional \"pill\" background shown\n * only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the\n * same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly\n * whether or not its (rarely-present) background happens to be attached right now.\n */\n/** @internal Exported only so DOM-free render-contract tests can exercise the background in isolation. */\nexport class NumberItem extends Container {\n private itemWidth = 0;\n private itemHeight = 0;\n private background?: Sprite | NineSliceSprite;\n private backgroundMask?: Graphics;\n private backgroundCornerRadius?: number;\n\n // Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.\n constructor(readonly numberText: Text) {\n super();\n numberText.anchor.set(0.5);\n super.addChild(numberText);\n }\n\n override get width(): number { return this.itemWidth; }\n override set width(value: number) { this.itemWidth = value; }\n override get height(): number { return this.itemHeight; }\n override set height(value: number) { this.itemHeight = value; }\n\n resize(width: number, height: number): void {\n this.itemWidth = width;\n this.itemHeight = height;\n this.numberText.position.set(width / 2, height / 2);\n this.background?.setSize(width, height);\n this.syncBackgroundMask();\n }\n\n /** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */\n setBackground(view: Sprite | NineSliceSprite | undefined, cornerRadius: number | undefined): void {\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); }\n if (this.backgroundMask !== undefined) { super.removeChild(this.backgroundMask); this.backgroundMask.destroy(); this.backgroundMask = undefined; }\n this.background = view;\n this.backgroundCornerRadius = cornerRadius;\n if (view === undefined) return;\n view.setSize(this.itemWidth, this.itemHeight);\n super.addChildAt(view, 0);\n if (cornerRadius !== undefined) {\n this.backgroundMask = new Graphics();\n this.syncBackgroundMask();\n // Keep the mask before the background in this item's render tree, as SceneViewport does.\n super.addChildAt(this.backgroundMask, 0);\n view.mask = this.backgroundMask;\n }\n }\n\n private syncBackgroundMask(): void {\n if (this.backgroundMask === undefined) return;\n const radius = Math.min(this.backgroundCornerRadius ?? 0, this.itemWidth / 2, this.itemHeight / 2);\n this.backgroundMask.clear().roundRect(0, 0, this.itemWidth, this.itemHeight, radius).fill(0xffffff);\n }\n}\n\n/**\n * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same\n * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never\n * reimplements arrangement. Deliberately not wired to any scroll-view: game code owns the actual page\n * transition and drives the widget one-way through `setPaginationViewPage`/`setPaginationViewPageCount`,\n * the same relationship a slider or progress bar has to whatever value it displays.\n *\n * `style` picks between two mutually exclusive, differently-rendered item kinds — image dots\n * (`Sprite`, two states) or rendered page-number text (`NumberItem`: a label, base style + an optional\n * highlight color, plus an optional pill background behind only the current page) — never both.\n * Switching `style` rebuilds every item, the same \"view's required *type* changed\" rule\n * `StagedButtonNodeView` follows for its state views; `pageCount`/`dotSize` changes do too, since the\n * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this\n * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself\n * is not structural: switching pages only recreates the (one) background view that needs to move.\n *\n * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active\n * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real\n * page range keeps its footprint and renders nothing, so the active page never shifts sideways.\n *\n * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the\n * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution\n * Spine connector targets use) and steps the page on press. It never draws an arrow itself.\n */\nexport class PaginationNodeView extends NodeView {\n private readonly list: List;\n private readonly interaction: SceneInteractionMode;\n private readonly fonts: ReadonlyMap<string, string> | undefined;\n private items: (Sprite | NumberItem)[] = [];\n private visibleSlots: number | undefined;\n private arrows?: { previous?: PaginationArrow; next?: PaginationArrow };\n private styleMode: PaginationNode[\"style\"];\n private activeTexture: Texture;\n private inactiveTexture: Texture;\n private numberStyle: TextStyleDefinition | undefined;\n private numberActiveColor: string | undefined;\n private numberActiveBackgroundTexture: Texture | undefined;\n private numberActiveNineSlice: LayoutPadding | undefined;\n private numberActiveCornerRadius: number | undefined;\n private pageCountState: number;\n private currentPage: number;\n private dotWidth: number;\n private dotHeight: number;\n private clickableState: boolean;\n\n /** Fires only from a click on an item (when `clickable`); setting `page` programmatically never emits. */\n readonly onPageChange = new Signal<(page: number) => void>();\n\n constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined) {\n super(textures);\n this.interaction = interaction;\n this.fonts = fonts;\n this.styleMode = node.style;\n this.activeTexture = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n this.inactiveTexture = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.numberActiveCornerRadius = node.numberActiveNineSlice === undefined ? node.numberActiveCornerRadius : undefined;\n this.pageCountState = Math.max(1, Math.round(node.pageCount));\n this.visibleSlots = node.visiblePageCount;\n this.currentPage = clampPage(node.defaultPage, this.pageCount);\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.clickableState = node.clickable;\n this.list = new List({ type: node.direction, elementsMargin: node.spacing });\n this.buildItems();\n this.setContent(this.list);\n }\n\n private createBackgroundView(texture: Texture): Sprite | NineSliceSprite {\n return this.numberActiveNineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });\n }\n\n /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */\n private get slotCount(): number {\n return this.visibleSlots === undefined ? this.pageCount : Math.max(1, Math.round(this.visibleSlots));\n }\n\n /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */\n private pageForSlot(slot: number): number {\n return this.visibleSlots === undefined ? slot : this.currentPage - Math.floor(this.slotCount / 2) + slot;\n }\n\n private createItem(slot: number): Sprite | NumberItem {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (this.styleMode === \"dots\") {\n const dot = new Sprite(isActive ? this.activeTexture : this.inactiveTexture);\n dot.setSize(this.dotWidth, this.dotHeight);\n // An out-of-range slot renders nothing but keeps its size, so `List` still reserves its place.\n dot.visible = exists;\n return dot;\n }\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\n const item = new NumberItem(new Text({ text: exists ? String(page + 1) : \"\", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));\n item.resize(this.dotWidth, this.dotHeight);\n if (isActive && this.numberActiveBackgroundTexture !== undefined) item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture), this.numberActiveCornerRadius);\n return item;\n }\n\n /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */\n private buildItems(): void {\n this.list.removeChildren();\n this.items = [];\n for (let slot = 0; slot < this.slotCount; slot++) {\n const item = this.createItem(slot);\n this.wireItem(item, slot);\n this.items.push(item);\n this.list.addChild(item);\n }\n this.applyArrowState();\n }\n\n /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */\n private wireItem(item: Sprite | NumberItem, slot: number): void {\n if (this.interaction === \"authoring\" || !this.clickableState) { item.eventMode = \"none\"; return; }\n item.eventMode = \"static\";\n item.cursor = \"pointer\";\n // Resolved on click, not captured: a windowed slot points at a different page after every move.\n item.on(\"pointertap\", () => {\n const page = this.pageForSlot(slot);\n if (page >= 0 && page < this.pageCount) this.setPage(page);\n });\n }\n\n private applyCurrentPage(): void {\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n this.items.forEach((item, slot) => {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (item instanceof NumberItem) {\n item.numberText.text = exists ? String(page + 1) : \"\";\n item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);\n item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined, this.numberActiveCornerRadius);\n return;\n }\n item.texture = isActive ? this.activeTexture : this.inactiveTexture;\n item.setSize(this.dotWidth, this.dotHeight);\n item.visible = exists;\n });\n this.applyArrowState();\n }\n\n /**\n * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит\n * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только\n * подписывается на них и гасит ту, за которой страниц больше нет.\n */\n setArrows(arrows: { previous?: PaginationArrow; next?: PaginationArrow }): void {\n this.arrows = arrows;\n arrows.previous?.onPress.connect(() => this.setPage(this.currentPage - 1));\n arrows.next?.onPress.connect(() => this.setPage(this.currentPage + 1));\n this.applyArrowState();\n }\n\n /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */\n private applyArrowState(): void {\n if (this.arrows === undefined) return;\n if (this.arrows.previous !== undefined) this.arrows.previous.enabled = this.currentPage > 0;\n if (this.arrows.next !== undefined) this.arrows.next.enabled = this.currentPage < this.pageCount - 1;\n }\n\n protected syncContent(node: UINode): void {\n if (node.type !== \"pagination\") return;\n const active = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n const pageCount = Math.max(1, Math.round(node.pageCount));\n this.clickableState = node.clickable;\n\n const previousSlotCount = this.slotCount;\n this.visibleSlots = node.visiblePageCount;\n this.pageCountState = pageCount;\n const structureChanged = node.style !== this.styleMode || this.slotCount !== previousSlotCount || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;\n this.styleMode = node.style;\n this.activeTexture = active;\n this.inactiveTexture = inactive;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.numberActiveCornerRadius = node.numberActiveNineSlice === undefined ? node.numberActiveCornerRadius : undefined;\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n\n if (this.list.type !== node.direction) this.list.type = node.direction;\n if (this.list.elementsMargin !== node.spacing) this.list.elementsMargin = node.spacing;\n\n if (structureChanged) this.buildItems();\n else this.applyCurrentPage();\n }\n\n get pageCount(): number { return this.pageCountState; }\n\n /** Used by `setPaginationViewPageCount` once game code knows the real content length. */\n set pageCount(value: number) {\n const next = Math.max(1, Math.round(value));\n if (next === this.pageCountState) return;\n const previousSlotCount = this.slotCount;\n this.pageCountState = next;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n if (this.slotCount === previousSlotCount) this.applyCurrentPage();\n else this.buildItems();\n }\n\n get page(): number { return this.currentPage; }\n\n /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */\n set page(value: number) {\n const next = clampPage(value, this.pageCountState);\n if (next === this.currentPage) return;\n this.currentPage = next;\n this.applyCurrentPage();\n }\n\n /** An item click: highlights immediately, then notifies game code — the same order a checkbox/slider follows. */\n private setPage(index: number): void {\n const next = clampPage(index, this.pageCountState);\n if (next !== this.currentPage) { this.currentPage = next; this.applyCurrentPage(); }\n this.onPageChange.emit(next);\n }\n}\n"]}
|
package/dist/views/basic.d.ts
CHANGED
|
@@ -54,9 +54,19 @@ export declare class LayoutGroupNodeView extends NodeView {
|
|
|
54
54
|
* `@pixi/ui`'s `fillPaddings`, только здесь это применяется напрямую к содержимому Image-ноды.
|
|
55
55
|
*/
|
|
56
56
|
export declare class ImageNodeView extends NodeView {
|
|
57
|
+
/** Internal wrapper keeps a rounded mask away from authored children attached to the NodeView. */
|
|
58
|
+
private readonly visual;
|
|
59
|
+
private surface?;
|
|
60
|
+
private roundedMask?;
|
|
57
61
|
constructor(assetId: string | undefined, textures: ReadonlyMap<string, Texture> | undefined, nineSlice?: LayoutPadding);
|
|
58
|
-
private
|
|
62
|
+
private createSurface;
|
|
63
|
+
private replaceSurface;
|
|
59
64
|
protected syncContent(node: UINode, transform: UINode["transform"]): void;
|
|
65
|
+
/**
|
|
66
|
+
* Uses Pixi's native Graphics mask rather than rasterizing the texture or applying a filter.
|
|
67
|
+
* Thus a rounded image remains a normal, freely stretched Sprite and its source stays crisp.
|
|
68
|
+
*/
|
|
69
|
+
private syncCornerMask;
|
|
60
70
|
/**
|
|
61
71
|
* Editor-only live preview of border edits while dragging the canvas nine-slice gizmo; the
|
|
62
72
|
* document is only written once, on drag release. A no-op without a `NineSliceSprite` content —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,aAAa,EAAE,KAAK,eAAe,EAA0D,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3L,OAAO,EAAc,SAAS,EAA2C,OAAO,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGpE,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,SAAS,CAAC,WAAW,IAAI,IAAI,CAAG;CACjC;AAED,iFAAiF;AACjF,qBAAa,YAAa,SAAQ,QAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAE5C,cAMC;IAED,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAGxE;CACF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G;IACH,OAAO,CAAC,gBAAgB;IA8BxB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAM1B;IAED,4FAA4F;IAC5F,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAG/C;IAED;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAG7C;IAED;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAQzB;IAED,OAAO,CAAC,KAAK;CAUd;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAKlC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAJnC,OAAO,CAAC,aAAa,CAAC,CAAsB;IAC5C,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,iBAAiB,CAAsC;IAE/D,YAA6B,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,YAAA,EAG/D;IAED,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAiBlG;IAED;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IA6BxB;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK;CASd;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,YAAY,QAAQ,EAAE,OAAO,EAG5B;IAED,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAEzE;CACF"}
|
package/dist/views/basic.js
CHANGED
|
@@ -109,29 +109,43 @@ export class LayoutGroupNodeView extends NodeView {
|
|
|
109
109
|
* `@pixi/ui`'s `fillPaddings`, только здесь это применяется напрямую к содержимому Image-ноды.
|
|
110
110
|
*/
|
|
111
111
|
export class ImageNodeView extends NodeView {
|
|
112
|
+
/** Internal wrapper keeps a rounded mask away from authored children attached to the NodeView. */
|
|
113
|
+
visual = new Container();
|
|
114
|
+
surface;
|
|
115
|
+
roundedMask;
|
|
112
116
|
constructor(assetId, textures, nineSlice) {
|
|
113
117
|
super(textures);
|
|
114
118
|
const texture = assetId === undefined ? undefined : this.textureFor(assetId);
|
|
115
|
-
this.setContent(
|
|
119
|
+
this.setContent(this.visual);
|
|
120
|
+
this.replaceSurface(texture, nineSlice);
|
|
116
121
|
}
|
|
117
|
-
|
|
122
|
+
createSurface(texture, nineSlice) {
|
|
118
123
|
if (texture === undefined)
|
|
119
124
|
return new Graphics();
|
|
120
125
|
return nineSlice === undefined
|
|
121
126
|
? new Sprite(texture)
|
|
122
127
|
: new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });
|
|
123
128
|
}
|
|
129
|
+
replaceSurface(texture, nineSlice) {
|
|
130
|
+
if (this.surface !== undefined) {
|
|
131
|
+
this.surface.mask = null;
|
|
132
|
+
this.visual.removeChild(this.surface);
|
|
133
|
+
this.surface.destroy();
|
|
134
|
+
}
|
|
135
|
+
this.surface = this.createSurface(texture, nineSlice);
|
|
136
|
+
this.visual.addChildAt(this.surface, 0);
|
|
137
|
+
}
|
|
124
138
|
syncContent(node, transform) {
|
|
125
139
|
if (node.type !== "image")
|
|
126
140
|
return;
|
|
127
141
|
const texture = node.assetId === undefined ? undefined : this.textureFor(node.assetId);
|
|
128
142
|
const nineSlice = node.nineSlice;
|
|
129
|
-
// Sprite ↔ NineSliceSprite ↔ Graphics меняются
|
|
130
|
-
// включает assetId/nineSlice, поэтому переключение
|
|
143
|
+
// Sprite ↔ NineSliceSprite ↔ Graphics меняются внутри stable visual-wrapper: structural key
|
|
144
|
+
// сцены не включает assetId/nineSlice, поэтому переключение не пересобирает сцену.
|
|
131
145
|
if (texture !== undefined && nineSlice !== undefined) {
|
|
132
|
-
if (!(this.
|
|
133
|
-
this.
|
|
134
|
-
const sprite = this.
|
|
146
|
+
if (!(this.surface instanceof NineSliceSprite))
|
|
147
|
+
this.replaceSurface(texture, nineSlice);
|
|
148
|
+
const sprite = this.surface;
|
|
135
149
|
// Keep the NineSliceSprite and its layout rectangle stable when its image asset/borders change.
|
|
136
150
|
if (sprite.texture !== texture)
|
|
137
151
|
sprite.texture = texture;
|
|
@@ -143,26 +157,54 @@ export class ImageNodeView extends NodeView {
|
|
|
143
157
|
}
|
|
144
158
|
else if (texture !== undefined) {
|
|
145
159
|
// `NineSliceSprite` is a Sprite sibling, not a subclass, so this rebuilds when switching back from it.
|
|
146
|
-
if (!(this.
|
|
147
|
-
this.
|
|
148
|
-
const sprite = this.
|
|
160
|
+
if (!(this.surface instanceof Sprite))
|
|
161
|
+
this.replaceSurface(texture, undefined);
|
|
162
|
+
const sprite = this.surface;
|
|
149
163
|
// Keep the Sprite and its layout rectangle stable when its image asset changes.
|
|
150
164
|
if (sprite.texture !== texture)
|
|
151
165
|
sprite.texture = texture;
|
|
152
166
|
sprite.setSize(transform.width, transform.height);
|
|
153
167
|
}
|
|
154
168
|
else {
|
|
155
|
-
if (!(this.
|
|
156
|
-
this.
|
|
157
|
-
const graphics = this.
|
|
169
|
+
if (!(this.surface instanceof Graphics))
|
|
170
|
+
this.replaceSurface(undefined, undefined);
|
|
171
|
+
const graphics = this.surface.clear().rect(0, 0, transform.width, transform.height);
|
|
158
172
|
if (node.assetId === undefined)
|
|
159
173
|
graphics.fill(node.tint ?? 0xffffff);
|
|
160
174
|
else
|
|
161
175
|
graphics.fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });
|
|
162
176
|
}
|
|
163
|
-
this.
|
|
164
|
-
if (this.
|
|
165
|
-
this.
|
|
177
|
+
this.visual.alpha = node.opacity ?? 1;
|
|
178
|
+
if (this.surface instanceof Sprite || this.surface instanceof NineSliceSprite)
|
|
179
|
+
this.surface.tint = node.tint ?? 0xffffff;
|
|
180
|
+
this.syncCornerMask(node.cornerRadius, transform);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Uses Pixi's native Graphics mask rather than rasterizing the texture or applying a filter.
|
|
184
|
+
* Thus a rounded image remains a normal, freely stretched Sprite and its source stays crisp.
|
|
185
|
+
*/
|
|
186
|
+
syncCornerMask(cornerRadius, transform) {
|
|
187
|
+
if (cornerRadius === undefined) {
|
|
188
|
+
if (this.roundedMask !== undefined) {
|
|
189
|
+
if (this.surface !== undefined)
|
|
190
|
+
this.surface.mask = null;
|
|
191
|
+
this.visual.removeChild(this.roundedMask);
|
|
192
|
+
this.roundedMask.destroy();
|
|
193
|
+
this.roundedMask = undefined;
|
|
194
|
+
}
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this.roundedMask ??= new Graphics();
|
|
198
|
+
// Pixi's mask pass must precede the masked visual in this local render tree.
|
|
199
|
+
if (this.roundedMask.parent === null)
|
|
200
|
+
this.visual.addChildAt(this.roundedMask, 0);
|
|
201
|
+
const radius = Math.min(cornerRadius, Math.max(0, transform.width) / 2, Math.max(0, transform.height) / 2);
|
|
202
|
+
this.roundedMask.clear().roundRect(0, 0, transform.width, transform.height, radius).fill(0xffffff);
|
|
203
|
+
// Mask the owned surface, not its parent wrapper. A container cannot reliably use one of its own
|
|
204
|
+
// descendants as a mask: that creates a self-referential render subtree, which Pixi's mask pipe
|
|
205
|
+
// skips in the real renderer even though the object graph still reports a non-null `mask`.
|
|
206
|
+
if (this.surface !== undefined)
|
|
207
|
+
this.surface.mask = this.roundedMask;
|
|
166
208
|
}
|
|
167
209
|
/**
|
|
168
210
|
* Editor-only live preview of border edits while dragging the canvas nine-slice gizmo; the
|
|
@@ -170,12 +212,12 @@ export class ImageNodeView extends NodeView {
|
|
|
170
212
|
* e.g. mid-drag right after the asset was cleared, before the next document sync catches up.
|
|
171
213
|
*/
|
|
172
214
|
previewNineSlice(nineSlice) {
|
|
173
|
-
if (!(this.
|
|
215
|
+
if (!(this.surface instanceof NineSliceSprite))
|
|
174
216
|
return;
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
217
|
+
this.surface.leftWidth = nineSlice.left;
|
|
218
|
+
this.surface.topHeight = nineSlice.top;
|
|
219
|
+
this.surface.rightWidth = nineSlice.right;
|
|
220
|
+
this.surface.bottomHeight = nineSlice.bottom;
|
|
179
221
|
}
|
|
180
222
|
}
|
|
181
223
|
export class TextNodeView extends NodeView {
|
package/dist/views/basic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsI,MAAM,wBAAwB,CAAC;AAC3L,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAW,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExE,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IACnC,WAAW,KAAU,CAAC;CACjC;AAED,iFAAiF;AACjF,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACvB,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;IAE5C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,mGAAmG;QACnG,yGAAyG;QACzG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;IAC7B,CAAC;IAES,WAAW,CAAC,IAAY,EAAE,SAA8B;QAChE,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO;QACjC,IAAI,CAAC,SAAS,CAAC,KA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QAAQ,CAAC,CAAC;IAC1H,CAAC;CACF","sourcesContent":["import { applyTextCase, type BitmapTextNode, type LayoutPadding, type LayoutProfileId, type TextCase, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { BitmapText, Container, Graphics, NineSliceSprite, Sprite, Text, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\nimport { resolveBitmapTextStyle, resolveTextStyle } from \"../layout.js\";\n\r\nexport class ContainerNodeView extends NodeView {\r\n protected syncContent(): void {}\r\n}\r\n\r\n/** Clips every authored child to the node's resolved rectangular layout area. */\r\nexport class MaskNodeView extends NodeView {\r\n private readonly maskShape = new Graphics();\r\n\r\n constructor() {\r\n super();\r\n this.addChild(this.maskShape);\r\n // A Graphics mask keeps the shape GPU-native and avoids the offscreen texture pass of alpha masks.\r\n // Pixi's regular mask contract also preserves correct clipping through rotation and transformed parents.\r\n this.mask = this.maskShape;\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"mask\") return;\r\n this.maskShape.clear().rect(0, 0, transform.width, transform.height).fill(0xffffff);\r\n }\r\n}\r\n\r\n/**\r\n * Multiplies one opacity into its whole child subtree, the same contract as Unity's `CanvasGroup.alpha`:\r\n * PixiJS already folds a container's `alpha` into every descendant's `worldAlpha`, so this costs one\r\n * multiply per object in a traversal that happens anyway — no offscreen render pass, and a fade over an\r\n * arbitrarily large subtree stays a single number written once per frame. Overlapping children therefore\r\n * show through each other at intermediate values, exactly as they do under a Unity `CanvasGroup`; true\r\n * flattened group opacity would need an `AlphaFilter` and its per-frame render texture, which is\r\n * deliberately not what this node is for.\r\n *\r\n * At zero opacity a runtime scene also stops rendering and hit-testing the subtree outright — the\r\n * `blocksRaycasts` half of `CanvasGroup`, without which a fully faded-out screen keeps eating the\r\n * pointer input of the one faded in over it. Both are skipped while authoring: `eventMode = \"none\"` on\r\n * the view itself would drop the node and its children out of editor selection, and hit testing stays\r\n * `NodeView`'s responsibility.\r\n */\r\nexport class OpacityGroupNodeView extends NodeView {\r\n private readonly interaction: SceneInteractionMode;\r\n /** Transient runtime override; `undefined` keeps the authored `opacity` from the document. */\r\n private runtimeOpacity?: number;\r\n private authoredOpacity = 1;\r\n\r\n constructor(interaction: SceneInteractionMode) {\r\n super();\r\n this.interaction = interaction;\r\n }\r\n\r\n /** Drives a fade from game code without touching the document; `undefined` restores the authored value. */\r\n setOpacity(opacity: number | undefined): void {\r\n this.runtimeOpacity = opacity === undefined ? undefined : Math.min(1, Math.max(0, opacity));\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n\r\n private applyOpacity(opacity: number): void {\r\n this.alpha = opacity;\r\n if (this.interaction === \"authoring\") return;\r\n const hidden = opacity <= 0;\r\n this.renderable = !hidden;\r\n this.eventMode = hidden ? \"none\" : \"passive\";\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"opacity-group\") return;\r\n this.authoredOpacity = node.opacity;\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n}\r\n\r\n/** Layout groups may optionally paint one image behind their managed children. No asset means no content/view at all. */\r\nexport class LayoutGroupNodeView extends NodeView {\r\n private readonly layoutContent = new Container();\r\n private background?: Sprite;\r\n\r\n constructor(textures: ReadonlyMap<string, Texture> | undefined) {\r\n super(textures);\r\n // Yoga owns this inner container only. The NodeView itself retains the authored transform,\r\n // pivot and grab rectangle used by both editor gizmos and runtime interaction.\r\n super.addChild(this.layoutContent);\r\n }\r\n\r\n get layoutTarget(): Container { return this.layoutContent; }\r\n\r\n addLayoutChild<T extends Container[]>(...children: T): T[0] {\r\n return this.layoutContent.addChild(...children);\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"horizontal-layout\" && node.type !== \"vertical-layout\" && node.type !== \"grid-layout\") return;\r\n const texture = node.backgroundAssetId === undefined ? undefined : this.textureFor(node.backgroundAssetId);\r\n if (texture === undefined) {\r\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); this.background = undefined; }\r\n return;\r\n }\r\n if (this.background === undefined) { this.background = new Sprite(texture); super.addChildAt(this.background, 0); }\r\n else if (this.background.texture !== texture) this.background.texture = texture;\r\n this.background.setSize(transform.width, transform.height);\r\n }\r\n}\r\n\r\n/**\r\n * Ноде-картинке источник не обязателен: без `assetId` она рисует белый прямоугольник своего размера,\r\n * а серо-синяя заглушка остаётся признаком того, что назначенный ассет не загрузился.\r\n *\r\n * `nineSlice` переключает контент на `NineSliceSprite`: углы источника остаются нерастянутыми, а\r\n * растягиваются только края/середина — то же 9-slice, что уже использует Slider/ProgressBar через\r\n * `@pixi/ui`'s `fillPaddings`, только здесь это применяется напрямую к содержимому Image-ноды.\r\n */\r\nexport class ImageNodeView extends NodeView {\r\n constructor(assetId: string | undefined, textures: ReadonlyMap<string, Texture> | undefined, nineSlice?: LayoutPadding) {\r\n super(textures);\r\n const texture = assetId === undefined ? undefined : this.textureFor(assetId);\r\n this.setContent(ImageNodeView.createSpriteContent(texture, nineSlice));\r\n }\r\n\r\n private static createSpriteContent(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\r\n if (texture === undefined) return new Graphics();\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"image\") return;\r\n const texture = node.assetId === undefined ? undefined : this.textureFor(node.assetId);\r\n const nineSlice = node.nineSlice;\r\n // Sprite ↔ NineSliceSprite ↔ Graphics меняются местами прямо здесь: структурный ключ сцены не\r\n // включает assetId/nineSlice, поэтому переключение (в том числе на None) не пересобирает сцену.\r\n if (texture !== undefined && nineSlice !== undefined) {\r\n if (!(this.content instanceof NineSliceSprite)) this.setContent(ImageNodeView.createSpriteContent(texture, nineSlice));\r\n const sprite = this.content as NineSliceSprite;\r\n // Keep the NineSliceSprite and its layout rectangle stable when its image asset/borders change.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.leftWidth = nineSlice.left;\r\n sprite.topHeight = nineSlice.top;\r\n sprite.rightWidth = nineSlice.right;\r\n sprite.bottomHeight = nineSlice.bottom;\r\n sprite.setSize(transform.width, transform.height);\r\n } else if (texture !== undefined) {\r\n // `NineSliceSprite` is a Sprite sibling, not a subclass, so this rebuilds when switching back from it.\r\n if (!(this.content instanceof Sprite)) this.setContent(new Sprite(texture));\r\n const sprite = this.content as Sprite;\r\n // Keep the Sprite and its layout rectangle stable when its image asset changes.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.setSize(transform.width, transform.height);\r\n } else {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n const graphics = (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height);\r\n if (node.assetId === undefined) graphics.fill(node.tint ?? 0xffffff);\r\n else graphics.fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n }\r\n this.content!.alpha = node.opacity ?? 1;\r\n if (this.content instanceof Sprite || this.content instanceof NineSliceSprite) this.content.tint = node.tint ?? 0xffffff;\r\n }\r\n\r\n /**\r\n * Editor-only live preview of border edits while dragging the canvas nine-slice gizmo; the\r\n * document is only written once, on drag release. A no-op without a `NineSliceSprite` content —\r\n * e.g. mid-drag right after the asset was cleared, before the next document sync catches up.\r\n */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n if (!(this.content instanceof NineSliceSprite)) return;\r\n this.content.leftWidth = nineSlice.left;\r\n this.content.topHeight = nineSlice.top;\r\n this.content.rightWidth = nineSlice.right;\r\n this.content.bottomHeight = nineSlice.bottom;\r\n }\r\n\r\n}\r\n\r\nexport class TextNodeView extends NodeView {\r\n /**\r\n * Строка, применённая локализацией поверх авторской. Она переживает `updateNodeView`: без неё\r\n * любая синхронизация документа возвращала бы fallback `node.text` вместо текущего перевода.\r\n */\r\n private localizedText?: string;\r\n /** Последний применённый прямоугольник и стиль — их же переиспользует инкрементальный `setText`. */\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastStyle?: TextStyleDefinition;\r\n /** `Text.textCase` from the last synced node — `setText`'s incremental path re-applies it without waiting for a full `syncContent`. */\r\n private textCase?: TextCase;\r\n\r\n constructor(text: string, private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Text({ text, style: { fontFamily: \"Arial\", fontSize: 24, fill: 0xffffff } }));\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (node.type !== \"text\" || !(this.content instanceof Text)) return;\r\n this.textCase = node.textCase;\r\n const text = applyTextCase(this.localizedText ?? node.text, this.textCase);\r\n if (this.content.text !== text) this.content.text = text;\r\n const style = resolveTextStyle(node, profile);\r\n this.lastTransform = transform;\r\n this.lastStyle = style;\r\n if (style === undefined) return;\r\n this.applyFittedStyle(this.content, node, style, transform);\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the resolved style at the largest font size (down to `minFontSize`) that keeps the\r\n * rendered text inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the\r\n * authored size\" contract as `BitmapTextNodeView.applyFittedStyle` / Unity legacy Text's Best Fit.\r\n * A binary search over candidate sizes rather than a closed-form scale, because word-wrapped text\r\n * re-flows at every size: a smaller font fits more words per line, so height doesn't shrink linearly\r\n * with font size the way unwrapped bounds would — the same reasoning `measureOverflow` follows.\r\n */\r\n private applyFittedStyle(text: Text, node: TextNode, style: TextStyleDefinition, transform: UINode[\"transform\"]): void {\r\n const baseStyle = { fontFamily: style.fontAssetId === undefined ? style.fontFamily : this.fonts?.get(style.fontAssetId) ?? style.fontFamily, fontWeight: style.fontWeight, fontStyle: style.fontStyle, fill: style.fill, align: style.align, wordWrap: style.wordWrap, breakWords: style.breakWords, wordWrapWidth: transform.width, lineHeight: style.lineHeight, letterSpacing: style.letterSpacing, stroke: style.stroke === undefined ? undefined : { color: style.stroke.color, width: style.stroke.width } };\r\n const fits = (fontSize: number): boolean => {\r\n text.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = text.getLocalBounds();\r\n const tolerance = 0.5;\r\n return style.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(style.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `text.style` frozen at whatever the constructor\r\n // set it to and silently dropping every later font/color/align/wrap edit (see the identical fix\r\n // in `BitmapTextNodeView.applyFittedStyle`).\r\n const fitsAtAuthoredSize = fits(style.fontSize);\r\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\r\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\r\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `text.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Инкрементальная смена строки: та же строка не делает работы вообще, новая — только переизмеряет\r\n * и выравнивает текст в текущем authored rectangle. `TextStyle` не пересоздаётся, а сам view\r\n * сохраняет identity, поэтому смена локали не трогает ни сцену, ни GPU-ресурсы стиля.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof Text)) return;\r\n const cased = applyTextCase(text, this.textCase);\r\n if (this.content.text === cased) return;\r\n this.content.text = cased;\r\n this.align();\r\n }\r\n\r\n /** `undefined` возвращает ноду к авторской строке при следующей синхронизации документа. */\r\n setLocalizedText(text: string | undefined): void {\r\n this.localizedText = text;\r\n if (text !== undefined) this.setText(text);\r\n }\r\n\r\n /**\r\n * Rasterizes the canvas-based `Text` at a higher pixel density than the renderer's own backing\r\n * resolution, so authoring-camera zoom doesn't magnify an already-rasterized bitmap past its\r\n * source resolution. `Application.resolution` (see `resolveCanvasResolution`) only matches the\r\n * *display's* pixel density — it knows nothing about the editor's independent camera zoom, which\r\n * can reach 8x (`MAX_ZOOM`). Without this, zooming in to inspect a text node (exactly what\r\n * `autoSize`/shrink-to-fit users do, since it converges to a smaller font) reads as soft/blurred\r\n * even on a display this app already renders crisply on. A no-op if unchanged: assigning\r\n * `.resolution` always re-rasterizes, so skip it when the caller (the authoring canvas, on every\r\n * camera-zoom tick) passes back the same value.\r\n */\r\n setContentResolution(resolution: number): void {\r\n if (!(this.content instanceof Text) || this.content.resolution === resolution) return;\r\n this.content.resolution = resolution;\r\n }\r\n\r\n /**\r\n * Вылезает ли фактически отрисованный текст за логический прямоугольник ноды.\r\n *\r\n * Меряется уже готовый `Text`, а не длина строки: перенос по словам, шрифт и обводка известны\r\n * только рендеру. Без `wordWrap` переполнение возможно по ширине, с ним — по высоте, потому что\r\n * перенос сам удерживает ширину в пределах `wordWrapWidth`. Диагностика transient: она ничего не\r\n * пишет ни в документ, ни в view.\r\n */\r\n measureOverflow(): boolean {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof Text) || transform === undefined || typeof globalThis.document === \"undefined\") return false;\r\n const bounds = this.content.getLocalBounds();\r\n const tolerance = 0.5;\r\n return this.lastStyle?.wordWrap === true\r\n ? bounds.height > transform.height + tolerance\r\n : bounds.width > transform.width + tolerance || bounds.height > transform.height + tolerance;\r\n }\r\n\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n const style = this.lastStyle;\r\n if (!(this.content instanceof Text) || transform === undefined || style === undefined) return;\r\n // Headless loaders and schema tests intentionally have no browser canvas. In that boundary\r\n // text still owns its authored rectangle; browser rendering keeps the precise measurement.\r\n const bounds = typeof globalThis.document === \"undefined\" ? { x: 0, y: 0, width: 0, height: 0 } : this.content.getLocalBounds();\r\n this.content.x = style.align === \"center\" ? (transform.width - bounds.width) / 2 - bounds.x : style.align === \"right\" ? transform.width - bounds.width - bounds.x : -bounds.x;\r\n this.content.y = style.verticalAlign === \"middle\" ? (transform.height - bounds.height) / 2 - bounds.y : style.verticalAlign === \"bottom\" ? transform.height - bounds.height - bounds.y : -bounds.y;\r\n }\r\n}\r\n\r\n/**\r\n * A bitmap font's rendered glyphs come from its texture, not an arbitrary system/TTF face, so unlike\r\n * `TextNodeView` there is no style-driven fallback: without a loaded font (asset deleted, still\r\n * loading, or failed to parse) this draws the same missing-asset placeholder `ImageNodeView` does.\r\n */\r\nexport class BitmapTextNodeView extends NodeView {\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastAlign: \"left\" | \"center\" | \"right\" = \"left\";\r\n private lastVerticalAlign: \"top\" | \"middle\" | \"bottom\" = \"top\";\r\n\r\n constructor(private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\n if (node.type !== \"bitmap-text\") return;\n const style = resolveBitmapTextStyle(node, profile);\n this.lastTransform = transform;\n this.lastAlign = style.align;\n this.lastVerticalAlign = style.verticalAlign;\n const family = this.fonts?.get(style.assetId);\n if (family === undefined) {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n return;\r\n }\r\n if (!(this.content instanceof BitmapText)) this.setContent(new BitmapText({ text: node.text, style: { fontFamily: family, fontSize: style.fontSize, fill: style.fill } }));\n const bitmapText = this.content as BitmapText;\r\n if (bitmapText.text !== node.text) bitmapText.text = node.text;\r\n this.applyFittedStyle(bitmapText, node, style, family, transform);\n this.align();\r\n }\r\n\r\n /**\r\n * Updates the rendered bitmap text without reapplying the node transform. This lets game code\r\n * refresh counters that are temporarily attached to a Spine connector without dislodging them.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof BitmapText) || this.content.text === text) return;\r\n this.content.text = text;\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the node's style at the largest font size (down to `minFontSize`) that keeps the text\r\n * inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the authored size\"\r\n * contract as Unity legacy Text's Best Fit. A binary search over candidate sizes rather than a\r\n * closed-form scale, because word-wrapped text re-flows at every size: a smaller font can fit more\r\n * words per line, so height doesn't shrink linearly with font size the way unwrapped bounds would.\r\n */\r\n private applyFittedStyle(bitmapText: BitmapText, node: BitmapTextNode, style: import(\"@pixi-ui-editor/schema\").BitmapTextStyle, family: string, transform: UINode[\"transform\"]): void {\n const baseStyle = { fontFamily: family, fill: style.fill, align: style.align, letterSpacing: style.letterSpacing, wordWrap: style.wordWrap, wordWrapWidth: transform.width };\n const fits = (fontSize: number): boolean => {\r\n bitmapText.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = bitmapText.getLocalBounds();\r\n const tolerance = 0.5;\r\n return node.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(node.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `bitmapText.style` frozen at whatever the\r\n // constructor set it to and silently dropping every later fill/align/letterSpacing/wordWrap edit.\r\n const fitsAtAuthoredSize = fits(style.fontSize);\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `bitmapText.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Positions via PixiJS's own `anchor`, not a manual `getLocalBounds()` computation like\r\n * `TextNodeView.align()` uses: `BitmapText.updateBounds()` reports a coarse line-metrics box\r\n * (built from the font's `lineHeight`/`baseLineOffset`), not the tight pixel bounds a canvas\r\n * `Text` or `Sprite` reports. Its own glyphs are drawn with an additional baseline-derived offset\r\n * that box doesn't account for, so computing `-bounds.y`-style positions from it lands text\r\n * slightly (but consistently, for every vertical setting) off — `anchor` is the one code path\r\n * PixiJS keeps in sync with how it actually renders the glyphs.\r\n */\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof BitmapText) || transform === undefined) return;\r\n const anchorX = this.lastAlign === \"center\" ? 0.5 : this.lastAlign === \"right\" ? 1 : 0;\r\n const anchorY = this.lastVerticalAlign === \"middle\" ? 0.5 : this.lastVerticalAlign === \"bottom\" ? 1 : 0;\r\n this.content.anchor.set(anchorX, anchorY);\r\n this.content.x = anchorX * transform.width;\r\n this.content.y = anchorY * transform.height;\r\n }\r\n}\r\n\r\n/**\r\n * Содержимое инстанса приходит обычными детьми из общего резолвера иерархии. Собственный контент\r\n * нужен только как заметная заглушка, когда определение пресета отсутствует в документе.\r\n */\r\nexport class PrefabInstanceNodeView extends NodeView {\r\n constructor(resolved: boolean) {\r\n super();\r\n if (!resolved) this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(_node: UINode, transform: UINode[\"transform\"]): void {\r\n if (this.content instanceof Graphics) this.content.clear().rect(0, 0, transform.width, transform.height).fill(0xff00ff);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO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C,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1H,CAAC;CACF","sourcesContent":["import { applyTextCase, type BitmapTextNode, type LayoutPadding, type LayoutProfileId, type TextCase, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { BitmapText, Container, Graphics, NineSliceSprite, Sprite, Text, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\nimport { resolveBitmapTextStyle, resolveTextStyle } from \"../layout.js\";\n\r\nexport class ContainerNodeView extends NodeView {\r\n protected syncContent(): void {}\r\n}\r\n\r\n/** Clips every authored child to the node's resolved rectangular layout area. */\r\nexport class MaskNodeView extends NodeView {\r\n private readonly maskShape = new Graphics();\r\n\r\n constructor() {\r\n super();\r\n this.addChild(this.maskShape);\r\n // A Graphics mask keeps the shape GPU-native and avoids the offscreen texture pass of alpha masks.\r\n // Pixi's regular mask contract also preserves correct clipping through rotation and transformed parents.\r\n this.mask = this.maskShape;\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"mask\") return;\r\n this.maskShape.clear().rect(0, 0, transform.width, transform.height).fill(0xffffff);\r\n }\r\n}\r\n\r\n/**\r\n * Multiplies one opacity into its whole child subtree, the same contract as Unity's `CanvasGroup.alpha`:\r\n * PixiJS already folds a container's `alpha` into every descendant's `worldAlpha`, so this costs one\r\n * multiply per object in a traversal that happens anyway — no offscreen render pass, and a fade over an\r\n * arbitrarily large subtree stays a single number written once per frame. Overlapping children therefore\r\n * show through each other at intermediate values, exactly as they do under a Unity `CanvasGroup`; true\r\n * flattened group opacity would need an `AlphaFilter` and its per-frame render texture, which is\r\n * deliberately not what this node is for.\r\n *\r\n * At zero opacity a runtime scene also stops rendering and hit-testing the subtree outright — the\r\n * `blocksRaycasts` half of `CanvasGroup`, without which a fully faded-out screen keeps eating the\r\n * pointer input of the one faded in over it. Both are skipped while authoring: `eventMode = \"none\"` on\r\n * the view itself would drop the node and its children out of editor selection, and hit testing stays\r\n * `NodeView`'s responsibility.\r\n */\r\nexport class OpacityGroupNodeView extends NodeView {\r\n private readonly interaction: SceneInteractionMode;\r\n /** Transient runtime override; `undefined` keeps the authored `opacity` from the document. */\r\n private runtimeOpacity?: number;\r\n private authoredOpacity = 1;\r\n\r\n constructor(interaction: SceneInteractionMode) {\r\n super();\r\n this.interaction = interaction;\r\n }\r\n\r\n /** Drives a fade from game code without touching the document; `undefined` restores the authored value. */\r\n setOpacity(opacity: number | undefined): void {\r\n this.runtimeOpacity = opacity === undefined ? undefined : Math.min(1, Math.max(0, opacity));\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n\r\n private applyOpacity(opacity: number): void {\r\n this.alpha = opacity;\r\n if (this.interaction === \"authoring\") return;\r\n const hidden = opacity <= 0;\r\n this.renderable = !hidden;\r\n this.eventMode = hidden ? \"none\" : \"passive\";\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"opacity-group\") return;\r\n this.authoredOpacity = node.opacity;\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n}\r\n\r\n/** Layout groups may optionally paint one image behind their managed children. No asset means no content/view at all. */\r\nexport class LayoutGroupNodeView extends NodeView {\r\n private readonly layoutContent = new Container();\r\n private background?: Sprite;\r\n\r\n constructor(textures: ReadonlyMap<string, Texture> | undefined) {\r\n super(textures);\r\n // Yoga owns this inner container only. The NodeView itself retains the authored transform,\r\n // pivot and grab rectangle used by both editor gizmos and runtime interaction.\r\n super.addChild(this.layoutContent);\r\n }\r\n\r\n get layoutTarget(): Container { return this.layoutContent; }\r\n\r\n addLayoutChild<T extends Container[]>(...children: T): T[0] {\r\n return this.layoutContent.addChild(...children);\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"horizontal-layout\" && node.type !== \"vertical-layout\" && node.type !== \"grid-layout\") return;\r\n const texture = node.backgroundAssetId === undefined ? undefined : this.textureFor(node.backgroundAssetId);\r\n if (texture === undefined) {\r\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); this.background = undefined; }\r\n return;\r\n }\r\n if (this.background === undefined) { this.background = new Sprite(texture); super.addChildAt(this.background, 0); }\r\n else if (this.background.texture !== texture) this.background.texture = texture;\r\n this.background.setSize(transform.width, transform.height);\r\n }\r\n}\r\n\r\n/**\r\n * Ноде-картинке источник не обязателен: без `assetId` она рисует белый прямоугольник своего размера,\r\n * а серо-синяя заглушка остаётся признаком того, что назначенный ассет не загрузился.\r\n *\r\n * `nineSlice` переключает контент на `NineSliceSprite`: углы источника остаются нерастянутыми, а\r\n * растягиваются только края/середина — то же 9-slice, что уже использует Slider/ProgressBar через\r\n * `@pixi/ui`'s `fillPaddings`, только здесь это применяется напрямую к содержимому Image-ноды.\r\n */\r\nexport class ImageNodeView extends NodeView {\n /** Internal wrapper keeps a rounded mask away from authored children attached to the NodeView. */\n private readonly visual = new Container();\n private surface?: Sprite | NineSliceSprite | Graphics;\n private roundedMask?: Graphics;\n\n constructor(assetId: string | undefined, textures: ReadonlyMap<string, Texture> | undefined, nineSlice?: LayoutPadding) {\n super(textures);\n const texture = assetId === undefined ? undefined : this.textureFor(assetId);\n this.setContent(this.visual);\n this.replaceSurface(texture, nineSlice);\n }\n\n private createSurface(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Sprite | NineSliceSprite | Graphics {\n if (texture === undefined) return new Graphics();\n return nineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\n }\n\n private replaceSurface(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): void {\n if (this.surface !== undefined) {\n this.surface.mask = null;\n this.visual.removeChild(this.surface);\n this.surface.destroy();\n }\n this.surface = this.createSurface(texture, nineSlice);\n this.visual.addChildAt(this.surface, 0);\n }\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\n if (node.type !== \"image\") return;\r\n const texture = node.assetId === undefined ? undefined : this.textureFor(node.assetId);\r\n const nineSlice = node.nineSlice;\r\n // Sprite ↔ NineSliceSprite ↔ Graphics меняются внутри stable visual-wrapper: structural key\n // сцены не включает assetId/nineSlice, поэтому переключение не пересобирает сцену.\n if (texture !== undefined && nineSlice !== undefined) {\n if (!(this.surface instanceof NineSliceSprite)) this.replaceSurface(texture, nineSlice);\n const sprite = this.surface as NineSliceSprite;\n // Keep the NineSliceSprite and its layout rectangle stable when its image asset/borders change.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.leftWidth = nineSlice.left;\r\n sprite.topHeight = nineSlice.top;\r\n sprite.rightWidth = nineSlice.right;\r\n sprite.bottomHeight = nineSlice.bottom;\r\n sprite.setSize(transform.width, transform.height);\r\n } else if (texture !== undefined) {\n // `NineSliceSprite` is a Sprite sibling, not a subclass, so this rebuilds when switching back from it.\n if (!(this.surface instanceof Sprite)) this.replaceSurface(texture, undefined);\n const sprite = this.surface as Sprite;\n // Keep the Sprite and its layout rectangle stable when its image asset changes.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.setSize(transform.width, transform.height);\r\n } else {\n if (!(this.surface instanceof Graphics)) this.replaceSurface(undefined, undefined);\n const graphics = (this.surface as Graphics).clear().rect(0, 0, transform.width, transform.height);\n if (node.assetId === undefined) graphics.fill(node.tint ?? 0xffffff);\r\n else graphics.fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n }\r\n this.visual.alpha = node.opacity ?? 1;\n if (this.surface instanceof Sprite || this.surface instanceof NineSliceSprite) this.surface.tint = node.tint ?? 0xffffff;\n this.syncCornerMask(node.cornerRadius, transform);\n }\n\n /**\n * Uses Pixi's native Graphics mask rather than rasterizing the texture or applying a filter.\n * Thus a rounded image remains a normal, freely stretched Sprite and its source stays crisp.\n */\n private syncCornerMask(cornerRadius: number | undefined, transform: UINode[\"transform\"]): void {\n if (cornerRadius === undefined) {\n if (this.roundedMask !== undefined) {\n if (this.surface !== undefined) this.surface.mask = null;\n this.visual.removeChild(this.roundedMask);\n this.roundedMask.destroy();\n this.roundedMask = undefined;\n }\n return;\n }\n this.roundedMask ??= new Graphics();\n // Pixi's mask pass must precede the masked visual in this local render tree.\n if (this.roundedMask.parent === null) this.visual.addChildAt(this.roundedMask, 0);\n const radius = Math.min(cornerRadius, Math.max(0, transform.width) / 2, Math.max(0, transform.height) / 2);\n this.roundedMask.clear().roundRect(0, 0, transform.width, transform.height, radius).fill(0xffffff);\n // Mask the owned surface, not its parent wrapper. A container cannot reliably use one of its own\n // descendants as a mask: that creates a self-referential render subtree, which Pixi's mask pipe\n // skips in the real renderer even though the object graph still reports a non-null `mask`.\n if (this.surface !== undefined) this.surface.mask = this.roundedMask;\n }\n\r\n /**\r\n * Editor-only live preview of border edits while dragging the canvas nine-slice gizmo; the\r\n * document is only written once, on drag release. A no-op without a `NineSliceSprite` content —\r\n * e.g. mid-drag right after the asset was cleared, before the next document sync catches up.\r\n */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\n if (!(this.surface instanceof NineSliceSprite)) return;\n this.surface.leftWidth = nineSlice.left;\n this.surface.topHeight = nineSlice.top;\n this.surface.rightWidth = nineSlice.right;\n this.surface.bottomHeight = nineSlice.bottom;\n }\r\n\r\n}\r\n\r\nexport class TextNodeView extends NodeView {\r\n /**\r\n * Строка, применённая локализацией поверх авторской. Она переживает `updateNodeView`: без неё\r\n * любая синхронизация документа возвращала бы fallback `node.text` вместо текущего перевода.\r\n */\r\n private localizedText?: string;\r\n /** Последний применённый прямоугольник и стиль — их же переиспользует инкрементальный `setText`. */\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastStyle?: TextStyleDefinition;\r\n /** `Text.textCase` from the last synced node — `setText`'s incremental path re-applies it without waiting for a full `syncContent`. */\r\n private textCase?: TextCase;\r\n\r\n constructor(text: string, private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Text({ text, style: { fontFamily: \"Arial\", fontSize: 24, fill: 0xffffff } }));\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (node.type !== \"text\" || !(this.content instanceof Text)) return;\r\n this.textCase = node.textCase;\r\n const text = applyTextCase(this.localizedText ?? node.text, this.textCase);\r\n if (this.content.text !== text) this.content.text = text;\r\n const style = resolveTextStyle(node, profile);\r\n this.lastTransform = transform;\r\n this.lastStyle = style;\r\n if (style === undefined) return;\r\n this.applyFittedStyle(this.content, node, style, transform);\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the resolved style at the largest font size (down to `minFontSize`) that keeps the\r\n * rendered text inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the\r\n * authored size\" contract as `BitmapTextNodeView.applyFittedStyle` / Unity legacy Text's Best Fit.\r\n * A binary search over candidate sizes rather than a closed-form scale, because word-wrapped text\r\n * re-flows at every size: a smaller font fits more words per line, so height doesn't shrink linearly\r\n * with font size the way unwrapped bounds would — the same reasoning `measureOverflow` follows.\r\n */\r\n private applyFittedStyle(text: Text, node: TextNode, style: TextStyleDefinition, transform: UINode[\"transform\"]): void {\r\n const baseStyle = { fontFamily: style.fontAssetId === undefined ? style.fontFamily : this.fonts?.get(style.fontAssetId) ?? style.fontFamily, fontWeight: style.fontWeight, fontStyle: style.fontStyle, fill: style.fill, align: style.align, wordWrap: style.wordWrap, breakWords: style.breakWords, wordWrapWidth: transform.width, lineHeight: style.lineHeight, letterSpacing: style.letterSpacing, stroke: style.stroke === undefined ? undefined : { color: style.stroke.color, width: style.stroke.width } };\r\n const fits = (fontSize: number): boolean => {\r\n text.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = text.getLocalBounds();\r\n const tolerance = 0.5;\r\n return style.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(style.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `text.style` frozen at whatever the constructor\r\n // set it to and silently dropping every later font/color/align/wrap edit (see the identical fix\r\n // in `BitmapTextNodeView.applyFittedStyle`).\r\n const fitsAtAuthoredSize = fits(style.fontSize);\r\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\r\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\r\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `text.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Инкрементальная смена строки: та же строка не делает работы вообще, новая — только переизмеряет\r\n * и выравнивает текст в текущем authored rectangle. `TextStyle` не пересоздаётся, а сам view\r\n * сохраняет identity, поэтому смена локали не трогает ни сцену, ни GPU-ресурсы стиля.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof Text)) return;\r\n const cased = applyTextCase(text, this.textCase);\r\n if (this.content.text === cased) return;\r\n this.content.text = cased;\r\n this.align();\r\n }\r\n\r\n /** `undefined` возвращает ноду к авторской строке при следующей синхронизации документа. */\r\n setLocalizedText(text: string | undefined): void {\r\n this.localizedText = text;\r\n if (text !== undefined) this.setText(text);\r\n }\r\n\r\n /**\r\n * Rasterizes the canvas-based `Text` at a higher pixel density than the renderer's own backing\r\n * resolution, so authoring-camera zoom doesn't magnify an already-rasterized bitmap past its\r\n * source resolution. `Application.resolution` (see `resolveCanvasResolution`) only matches the\r\n * *display's* pixel density — it knows nothing about the editor's independent camera zoom, which\r\n * can reach 8x (`MAX_ZOOM`). Without this, zooming in to inspect a text node (exactly what\r\n * `autoSize`/shrink-to-fit users do, since it converges to a smaller font) reads as soft/blurred\r\n * even on a display this app already renders crisply on. A no-op if unchanged: assigning\r\n * `.resolution` always re-rasterizes, so skip it when the caller (the authoring canvas, on every\r\n * camera-zoom tick) passes back the same value.\r\n */\r\n setContentResolution(resolution: number): void {\r\n if (!(this.content instanceof Text) || this.content.resolution === resolution) return;\r\n this.content.resolution = resolution;\r\n }\r\n\r\n /**\r\n * Вылезает ли фактически отрисованный текст за логический прямоугольник ноды.\r\n *\r\n * Меряется уже готовый `Text`, а не длина строки: перенос по словам, шрифт и обводка известны\r\n * только рендеру. Без `wordWrap` переполнение возможно по ширине, с ним — по высоте, потому что\r\n * перенос сам удерживает ширину в пределах `wordWrapWidth`. Диагностика transient: она ничего не\r\n * пишет ни в документ, ни в view.\r\n */\r\n measureOverflow(): boolean {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof Text) || transform === undefined || typeof globalThis.document === \"undefined\") return false;\r\n const bounds = this.content.getLocalBounds();\r\n const tolerance = 0.5;\r\n return this.lastStyle?.wordWrap === true\r\n ? bounds.height > transform.height + tolerance\r\n : bounds.width > transform.width + tolerance || bounds.height > transform.height + tolerance;\r\n }\r\n\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n const style = this.lastStyle;\r\n if (!(this.content instanceof Text) || transform === undefined || style === undefined) return;\r\n // Headless loaders and schema tests intentionally have no browser canvas. In that boundary\r\n // text still owns its authored rectangle; browser rendering keeps the precise measurement.\r\n const bounds = typeof globalThis.document === \"undefined\" ? { x: 0, y: 0, width: 0, height: 0 } : this.content.getLocalBounds();\r\n this.content.x = style.align === \"center\" ? (transform.width - bounds.width) / 2 - bounds.x : style.align === \"right\" ? transform.width - bounds.width - bounds.x : -bounds.x;\r\n this.content.y = style.verticalAlign === \"middle\" ? (transform.height - bounds.height) / 2 - bounds.y : style.verticalAlign === \"bottom\" ? transform.height - bounds.height - bounds.y : -bounds.y;\r\n }\r\n}\r\n\r\n/**\r\n * A bitmap font's rendered glyphs come from its texture, not an arbitrary system/TTF face, so unlike\r\n * `TextNodeView` there is no style-driven fallback: without a loaded font (asset deleted, still\r\n * loading, or failed to parse) this draws the same missing-asset placeholder `ImageNodeView` does.\r\n */\r\nexport class BitmapTextNodeView extends NodeView {\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastAlign: \"left\" | \"center\" | \"right\" = \"left\";\r\n private lastVerticalAlign: \"top\" | \"middle\" | \"bottom\" = \"top\";\r\n\r\n constructor(private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\n if (node.type !== \"bitmap-text\") return;\n const style = resolveBitmapTextStyle(node, profile);\n this.lastTransform = transform;\n this.lastAlign = style.align;\n this.lastVerticalAlign = style.verticalAlign;\n const family = this.fonts?.get(style.assetId);\n if (family === undefined) {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n return;\r\n }\r\n if (!(this.content instanceof BitmapText)) this.setContent(new BitmapText({ text: node.text, style: { fontFamily: family, fontSize: style.fontSize, fill: style.fill } }));\n const bitmapText = this.content as BitmapText;\r\n if (bitmapText.text !== node.text) bitmapText.text = node.text;\r\n this.applyFittedStyle(bitmapText, node, style, family, transform);\n this.align();\r\n }\r\n\r\n /**\r\n * Updates the rendered bitmap text without reapplying the node transform. This lets game code\r\n * refresh counters that are temporarily attached to a Spine connector without dislodging them.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof BitmapText) || this.content.text === text) return;\r\n this.content.text = text;\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the node's style at the largest font size (down to `minFontSize`) that keeps the text\r\n * inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the authored size\"\r\n * contract as Unity legacy Text's Best Fit. A binary search over candidate sizes rather than a\r\n * closed-form scale, because word-wrapped text re-flows at every size: a smaller font can fit more\r\n * words per line, so height doesn't shrink linearly with font size the way unwrapped bounds would.\r\n */\r\n private applyFittedStyle(bitmapText: BitmapText, node: BitmapTextNode, style: import(\"@pixi-ui-editor/schema\").BitmapTextStyle, family: string, transform: UINode[\"transform\"]): void {\n const baseStyle = { fontFamily: family, fill: style.fill, align: style.align, letterSpacing: style.letterSpacing, wordWrap: style.wordWrap, wordWrapWidth: transform.width };\n const fits = (fontSize: number): boolean => {\r\n bitmapText.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = bitmapText.getLocalBounds();\r\n const tolerance = 0.5;\r\n return node.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(node.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `bitmapText.style` frozen at whatever the\r\n // constructor set it to and silently dropping every later fill/align/letterSpacing/wordWrap edit.\r\n const fitsAtAuthoredSize = fits(style.fontSize);\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `bitmapText.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Positions via PixiJS's own `anchor`, not a manual `getLocalBounds()` computation like\r\n * `TextNodeView.align()` uses: `BitmapText.updateBounds()` reports a coarse line-metrics box\r\n * (built from the font's `lineHeight`/`baseLineOffset`), not the tight pixel bounds a canvas\r\n * `Text` or `Sprite` reports. Its own glyphs are drawn with an additional baseline-derived offset\r\n * that box doesn't account for, so computing `-bounds.y`-style positions from it lands text\r\n * slightly (but consistently, for every vertical setting) off — `anchor` is the one code path\r\n * PixiJS keeps in sync with how it actually renders the glyphs.\r\n */\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof BitmapText) || transform === undefined) return;\r\n const anchorX = this.lastAlign === \"center\" ? 0.5 : this.lastAlign === \"right\" ? 1 : 0;\r\n const anchorY = this.lastVerticalAlign === \"middle\" ? 0.5 : this.lastVerticalAlign === \"bottom\" ? 1 : 0;\r\n this.content.anchor.set(anchorX, anchorY);\r\n this.content.x = anchorX * transform.width;\r\n this.content.y = anchorY * transform.height;\r\n }\r\n}\r\n\r\n/**\r\n * Содержимое инстанса приходит обычными детьми из общего резолвера иерархии. Собственный контент\r\n * нужен только как заметная заглушка, когда определение пресета отсутствует в документе.\r\n */\r\nexport class PrefabInstanceNodeView extends NodeView {\r\n constructor(resolved: boolean) {\r\n super();\r\n if (!resolved) this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(_node: UINode, transform: UINode[\"transform\"]): void {\r\n if (this.content instanceof Graphics) this.content.clear().rect(0, 0, transform.width, transform.height).fill(0xff00ff);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNodeView.js","sourceRoot":"","sources":["../../src/views/createNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAwE,MAAM,wBAAwB,CAAC;AAGtJ,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAA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ACb,CAAC;QACD,KAAK,cAAc;YACjB,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpD,KAAK,YAAY;YACf,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;QACrL,KAAK,kBAAkB;YACrB,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { BUTTON_STATE_KEYS, CHECKBOX_STATE_KEYS, type ParticleEffectDefinition, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { Container, Texture, type Ticker } from \"pixi.js\";\r\nimport { ButtonNodeView } from \"./ButtonNodeView.js\";\r\nimport { CheckboxNodeView } from \"./CheckboxNodeView.js\";\r\nimport { BitmapTextNodeView, ContainerNodeView, ImageNodeView, LayoutGroupNodeView, MaskNodeView, OpacityGroupNodeView, PrefabInstanceNodeView, TextNodeView } from \"./basic.js\";\r\nimport { InputNodeView } from \"./InputNodeView.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\nimport type { SceneAudio } from \"../audio/bus.js\";\r\nimport { ItemTableNodeView } from \"./ItemTableNodeView.js\";\r\nimport { PageGroupNodeView } from \"./PageGroupNodeView.js\";\r\nimport { PaginationNodeView } from \"./PaginationNodeView.js\";\r\nimport { ScrollViewNodeView } from \"./ScrollViewNodeView.js\";\r\nimport { SpineNodeView } from \"./SpineNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./StagedButtonNodeView.js\";\r\nimport { ProgressBarNodeView, SliderNodeView } from \"./ValueControlNodeViews.js\";\r\nimport { ParticleEmitterNodeView } from \"./ParticleEmitterNodeView.js\";\r\n\r\n/**\r\n * `hasPrefab` только сообщает, существует ли определение пресета: содержимое инстанса приходит его\r\n * обычными детьми из общего резолвера иерархии, а не отдельной веткой сборки.\r\n */\r\nexport function createNodeView(node: UINode, interaction: SceneInteractionMode, textures?: ReadonlyMap<string, Texture>, spines?: ReadonlyMap<string, SkeletonData>, hasPrefab?: (prefabId: string) => boolean, fonts?: ReadonlyMap<string, string>, audio?: SceneAudio, effect?: ParticleEffectDefinition, spineReferenceFrame?: SpineReferenceFrame, ticker?: Ticker, bitmapFonts?: ReadonlyMap<string, string>): NodeView {\r\n switch (node.type) {\r\n case \"container\":\r\n return new ContainerNodeView();\r\n case \"mask\":\r\n return new MaskNodeView();\r\n case \"opacity-group\":\r\n return new OpacityGroupNodeView(interaction);\r\n case \"horizontal-layout\":\r\n case \"vertical-layout\":\r\n case \"grid-layout\":\r\n return new LayoutGroupNodeView(textures);\r\n case \"scroll-view\":\r\n return new ScrollViewNodeView(node, textures, interaction);\r\n case \"page-group\":\r\n return new PageGroupNodeView(node, textures);\r\n case \"item-table\":\r\n return new ItemTableNodeView();\r\n case \"image\":\r\n return new ImageNodeView(node.assetId, textures, node.nineSlice);\r\n case \"text\":\r\n return new TextNodeView(node.text, fonts);\r\n case \"bitmap-text\":\r\n return new BitmapTextNodeView(bitmapFonts);\r\n case \"spine\":\r\n return new SpineNodeView(spines?.get(node.assetId), node.animation, node.autoplay ?? true, node.loop ?? true, node.animationSpeed ?? 1, interaction === \"authoring\", spineReferenceFrame, ticker);\r\n case \"button\":\r\n return new ButtonNodeView(node, textures, interaction, audio);\r\n case \"staged-button\":\r\n return new StagedButtonNodeView(node, textures, interaction, audio);\r\n case \"checkbox\":\r\n return new CheckboxNodeView(node, textures, interaction, audio);\r\n case \"input\":\r\n return new InputNodeView(node, textures, interaction, fonts);\r\n case \"slider\":\r\n return new SliderNodeView(node, textures, interaction, fonts);\r\n case \"progress-bar\":\r\n return new ProgressBarNodeView(node, textures);\r\n case \"pagination\":\r\n return new PaginationNodeView(node, textures, interaction, fonts);\r\n case \"particle-emitter\":\r\n return effect === undefined ? new ContainerNodeView() : new ParticleEmitterNodeView(effect, textures);\r\n case \"prefab-instance\":\r\n return new PrefabInstanceNodeView(hasPrefab?.(node.prefabId) ?? false);\r\n }\r\n}\r\n\r\n/**\r\n * Every asset a node references: the image, the Spine data, or each of a button's state images.\r\n * Single source of truth for \"which assets does this node use\" — texture loading and the editor's\r\n * usage count both read it, so a new node type can never silently drop out of one of them.\r\n */\r\nexport function collectNodeAssetIds(node: UINode): string[] {\r\n switch (node.type) {\r\n case \"image\":\r\n return node.assetId === undefined ? [] : [node.assetId];\r\n case \"spine\":\r\n return [node.assetId];\r\n case \"button\":\r\n return [\r\n ...BUTTON_STATE_KEYS\r\n .map((state) => node.states[`${state}AssetId`])\r\n .filter((assetId): assetId is string => assetId !== undefined),\r\n ...[node.sounds?.pressAssetId, node.sounds?.hoverAssetId].filter((assetId): assetId is string => assetId !== undefined),\r\n ];\r\n case \"staged-button\":\r\n return [...new Set([\r\n ...node.stages.flatMap((stage) => BUTTON_STATE_KEYS.map((state) => stage.states[`${state}AssetId`])),\r\n node.sounds?.pressAssetId,\r\n node.sounds?.hoverAssetId,\r\n ].filter((assetId): assetId is string => assetId !== undefined))];\r\n case \"checkbox\":\r\n return [\r\n ...CHECKBOX_STATE_KEYS\r\n .map((state) => node.states[`${state}AssetId`])\r\n .filter((assetId): assetId is string => assetId !== undefined),\r\n ...[node.sounds?.checkAssetId, node.sounds?.uncheckAssetId].filter((assetId): assetId is string => assetId !== undefined),\r\n ];\r\n case \"container\":\r\n case \"mask\":\r\n case \"opacity-group\":\r\n case \"item-table\":\r\n case \"prefab-instance\":\r\n return [];\r\n case \"horizontal-layout\":\r\n case \"vertical-layout\":\r\n case \"grid-layout\": {\r\n const backgroundAssetId = node.backgroundAssetId;\r\n return backgroundAssetId === undefined ? [] : [backgroundAssetId];\r\n }\r\n case \"scroll-view\":\r\n case \"page-group\":\r\n return [];\r\n case \"text\":\r\n return [...new Set([\r\n node.style?.fontAssetId,\r\n node.textStyleOverrides?.desktop?.fontAssetId,\r\n node.textStyleOverrides?.mobile?.fontAssetId,\r\n ].filter((assetId): assetId is string => assetId !== undefined))];\r\n case \"bitmap-text\":\r\n return [...new Set([node.assetId, node.bitmapTextOverrides?.desktop?.assetId, node.bitmapTextOverrides?.mobile?.assetId].filter((assetId): assetId is string => assetId !== undefined))];\r\n case \"input\": {\r\n const ids: string[] = [];\r\n if (node.backgroundAssetId !== undefined) ids.push(node.backgroundAssetId);\r\n if (node.textStyle.fontAssetId !== undefined) ids.push(node.textStyle.fontAssetId);\r\n return ids;\r\n }\r\n case \"slider\": {\r\n const ids = [node.backgroundAssetId, node.fillAssetId, node.handleAssetId];\r\n if (node.valueTextStyle?.fontAssetId !== undefined) ids.push(node.valueTextStyle.fontAssetId);\r\n return ids;\r\n }\r\n case \"progress-bar\":\r\n return [node.backgroundAssetId, node.fillAssetId];\r\n case \"pagination\":\r\n return [node.activeAssetId, node.inactiveAssetId, node.numberStyle?.fontAssetId, node.numberActiveBackgroundAssetId].filter((assetId): assetId is string => assetId !== undefined);\r\n case \"particle-emitter\":\r\n return [];\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"createNodeView.js","sourceRoot":"","sources":["../../src/views/createNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAwE,MAAM,wBAAwB,CAAC;AAGtJ,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACjL,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,M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W,EAAE,WAAW,EAAE,IAAI,CAAC,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;QACrL,KAAK,kBAAkB;YACrB,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { BUTTON_STATE_KEYS, CHECKBOX_STATE_KEYS, type ParticleEffectDefinition, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { Container, Texture, type Ticker } from \"pixi.js\";\r\nimport { ButtonNodeView } from \"./ButtonNodeView.js\";\r\nimport { CheckboxNodeView } from \"./CheckboxNodeView.js\";\r\nimport { BitmapTextNodeView, ContainerNodeView, ImageNodeView, LayoutGroupNodeView, MaskNodeView, OpacityGroupNodeView, PrefabInstanceNodeView, TextNodeView } from \"./basic.js\";\r\nimport { InputNodeView } from \"./InputNodeView.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\nimport type { SceneAudio } from \"../audio/bus.js\";\r\nimport { ItemTableNodeView } from \"./ItemTableNodeView.js\";\r\nimport { PageGroupNodeView } from \"./PageGroupNodeView.js\";\r\nimport { PaginationNodeView } from \"./PaginationNodeView.js\";\r\nimport { ScrollViewNodeView } from \"./ScrollViewNodeView.js\";\r\nimport { SpineNodeView } from \"./SpineNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./StagedButtonNodeView.js\";\r\nimport { ProgressBarNodeView, SliderNodeView } from \"./ValueControlNodeViews.js\";\r\nimport { ParticleEmitterNodeView } from \"./ParticleEmitterNodeView.js\";\r\n\r\n/**\r\n * `hasPrefab` только сообщает, существует ли определение пресета: содержимое инстанса приходит его\r\n * обычными детьми из общего резолвера иерархии, а не отдельной веткой сборки.\r\n */\r\nexport function createNodeView(node: UINode, interaction: SceneInteractionMode, textures?: ReadonlyMap<string, Texture>, spines?: ReadonlyMap<string, SkeletonData>, hasPrefab?: (prefabId: string) => boolean, fonts?: ReadonlyMap<string, string>, audio?: SceneAudio, effect?: ParticleEffectDefinition, spineReferenceFrame?: SpineReferenceFrame, ticker?: Ticker, bitmapFonts?: ReadonlyMap<string, string>): NodeView {\r\n switch (node.type) {\r\n case \"container\":\r\n return new ContainerNodeView();\r\n case \"mask\":\r\n return new MaskNodeView();\r\n case \"opacity-group\":\r\n return new OpacityGroupNodeView(interaction);\r\n case \"horizontal-layout\":\r\n case \"vertical-layout\":\r\n case \"grid-layout\":\r\n return new LayoutGroupNodeView(textures);\r\n case \"scroll-view\":\r\n return new ScrollViewNodeView(node, textures, interaction);\r\n case \"page-group\":\r\n return new PageGroupNodeView(node, textures);\r\n case \"item-table\":\r\n return new ItemTableNodeView();\r\n case \"image\":\r\n return new ImageNodeView(node.assetId, textures, node.nineSlice);\n case \"text\":\r\n return new TextNodeView(node.text, fonts);\r\n case \"bitmap-text\":\r\n return new BitmapTextNodeView(bitmapFonts);\r\n case \"spine\":\r\n return new SpineNodeView(spines?.get(node.assetId), node.animation, node.autoplay ?? true, node.loop ?? true, node.animationSpeed ?? 1, interaction === \"authoring\", spineReferenceFrame, ticker);\r\n case \"button\":\r\n return new ButtonNodeView(node, textures, interaction, audio);\r\n case \"staged-button\":\r\n return new StagedButtonNodeView(node, textures, interaction, audio);\r\n case \"checkbox\":\r\n return new CheckboxNodeView(node, textures, interaction, audio);\r\n case \"input\":\r\n return new InputNodeView(node, textures, interaction, fonts);\r\n case \"slider\":\r\n return new SliderNodeView(node, textures, interaction, fonts);\r\n case \"progress-bar\":\r\n return new ProgressBarNodeView(node, textures);\r\n case \"pagination\":\r\n return new PaginationNodeView(node, textures, interaction, fonts);\r\n case \"particle-emitter\":\r\n return effect === undefined ? new ContainerNodeView() : new ParticleEmitterNodeView(effect, textures);\r\n case \"prefab-instance\":\r\n return new PrefabInstanceNodeView(hasPrefab?.(node.prefabId) ?? false);\r\n }\r\n}\r\n\r\n/**\r\n * Every asset a node references: the image, the Spine data, or each of a button's state images.\r\n * Single source of truth for \"which assets does this node use\" — texture loading and the editor's\r\n * usage count both read it, so a new node type can never silently drop out of one of them.\r\n */\r\nexport function collectNodeAssetIds(node: UINode): string[] {\r\n switch (node.type) {\r\n case \"image\":\r\n return node.assetId === undefined ? [] : [node.assetId];\r\n case \"spine\":\r\n return [node.assetId];\r\n case \"button\":\r\n return [\r\n ...BUTTON_STATE_KEYS\r\n .map((state) => node.states[`${state}AssetId`])\r\n .filter((assetId): assetId is string => assetId !== undefined),\r\n ...[node.sounds?.pressAssetId, node.sounds?.hoverAssetId].filter((assetId): assetId is string => assetId !== undefined),\r\n ];\r\n case \"staged-button\":\r\n return [...new Set([\r\n ...node.stages.flatMap((stage) => BUTTON_STATE_KEYS.map((state) => stage.states[`${state}AssetId`])),\r\n node.sounds?.pressAssetId,\r\n node.sounds?.hoverAssetId,\r\n ].filter((assetId): assetId is string => assetId !== undefined))];\r\n case \"checkbox\":\r\n return [\r\n ...CHECKBOX_STATE_KEYS\r\n .map((state) => node.states[`${state}AssetId`])\r\n .filter((assetId): assetId is string => assetId !== undefined),\r\n ...[node.sounds?.checkAssetId, node.sounds?.uncheckAssetId].filter((assetId): assetId is string => assetId !== undefined),\r\n ];\r\n case \"container\":\r\n case \"mask\":\r\n case \"opacity-group\":\r\n case \"item-table\":\r\n case \"prefab-instance\":\r\n return [];\r\n case \"horizontal-layout\":\r\n case \"vertical-layout\":\r\n case \"grid-layout\": {\r\n const backgroundAssetId = node.backgroundAssetId;\r\n return backgroundAssetId === undefined ? [] : [backgroundAssetId];\r\n }\r\n case \"scroll-view\":\r\n case \"page-group\":\r\n return [];\r\n case \"text\":\r\n return [...new Set([\r\n node.style?.fontAssetId,\r\n node.textStyleOverrides?.desktop?.fontAssetId,\r\n node.textStyleOverrides?.mobile?.fontAssetId,\r\n ].filter((assetId): assetId is string => assetId !== undefined))];\r\n case \"bitmap-text\":\r\n return [...new Set([node.assetId, node.bitmapTextOverrides?.desktop?.assetId, node.bitmapTextOverrides?.mobile?.assetId].filter((assetId): assetId is string => assetId !== undefined))];\r\n case \"input\": {\r\n const ids: string[] = [];\r\n if (node.backgroundAssetId !== undefined) ids.push(node.backgroundAssetId);\r\n if (node.textStyle.fontAssetId !== undefined) ids.push(node.textStyle.fontAssetId);\r\n return ids;\r\n }\r\n case \"slider\": {\r\n const ids = [node.backgroundAssetId, node.fillAssetId, node.handleAssetId];\r\n if (node.valueTextStyle?.fontAssetId !== undefined) ids.push(node.valueTextStyle.fontAssetId);\r\n return ids;\r\n }\r\n case \"progress-bar\":\r\n return [node.backgroundAssetId, node.fillAssetId];\r\n case \"pagination\":\r\n return [node.activeAssetId, node.inactiveAssetId, node.numberStyle?.fontAssetId, node.numberActiveBackgroundAssetId].filter((assetId): assetId is string => assetId !== undefined);\r\n case \"particle-emitter\":\r\n return [];\r\n }\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.18.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.18.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^26.2.0"
|