@pixi-ui-editor/runtime-pixi 0.11.0 → 0.13.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/dist/layoutGroups.d.ts +17 -1
- package/dist/layoutGroups.d.ts.map +1 -1
- package/dist/layoutGroups.js +26 -11
- package/dist/layoutGroups.js.map +1 -1
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +13 -1
- package/dist/scene.js.map +1 -1
- package/dist/views/ButtonNodeView.d.ts +1 -0
- package/dist/views/ButtonNodeView.d.ts.map +1 -1
- package/dist/views/ButtonNodeView.js +6 -0
- package/dist/views/ButtonNodeView.js.map +1 -1
- package/dist/views/PageGroupNodeView.d.ts +14 -0
- package/dist/views/PageGroupNodeView.d.ts.map +1 -1
- package/dist/views/PageGroupNodeView.js +18 -0
- package/dist/views/PageGroupNodeView.js.map +1 -1
- package/dist/views/SpineNodeView.d.ts.map +1 -1
- package/dist/views/SpineNodeView.js +20 -9
- package/dist/views/SpineNodeView.js.map +1 -1
- package/dist/views/StagedButtonNodeView.d.ts +1 -0
- package/dist/views/StagedButtonNodeView.d.ts.map +1 -1
- package/dist/views/StagedButtonNodeView.js +6 -0
- package/dist/views/StagedButtonNodeView.js.map +1 -1
- package/dist/views/basic.d.ts +2 -0
- package/dist/views/basic.d.ts.map +1 -1
- package/dist/views/basic.js +10 -3
- package/dist/views/basic.js.map +1 -1
- package/package.json +2 -2
package/dist/layoutGroups.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import "@pixi/layout";
|
|
2
|
-
import { type LayoutGroupNode, type LayoutProfileId, type UINode } from "@pixi-ui-editor/schema";
|
|
2
|
+
import { type GridLayoutSettings, type LayoutGroupNode, type LayoutProfileId, type UINode } from "@pixi-ui-editor/schema";
|
|
3
3
|
import { Container } from "pixi.js";
|
|
4
4
|
import { type LayoutSize } from "./layout.js";
|
|
5
5
|
import { NodeView } from "./views/NodeView.js";
|
|
6
6
|
/** Importing @pixi/layout installs its renderer extension. Kept as a shared explicit contract for every host. */
|
|
7
7
|
export declare function initializePixiLayout(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Направление заполнения сетки, выведенное из startCorner/startAxis/constraint. Единственный
|
|
10
|
+
* источник правды: рантайм задаёт по нему Yoga-флексбокс, а редактор считает по нему же рамки
|
|
11
|
+
* выделения, поэтому расходиться этим двум расчётам негде.
|
|
12
|
+
*/
|
|
13
|
+
export type GridFlow = {
|
|
14
|
+
/** Строки являются линиями переноса (иначе линии — это колонки). */
|
|
15
|
+
readonly fillsByRow: boolean;
|
|
16
|
+
/** Главная ось (порядок внутри линии) идёт справа налево / снизу вверх. */
|
|
17
|
+
readonly mainReversed: boolean;
|
|
18
|
+
/** Поперечная ось (порядок линий) идёт снизу вверх / справа налево. */
|
|
19
|
+
readonly crossReversed: boolean;
|
|
20
|
+
/** Фиксированный constraint переносит линии явными разрывами, а не переполнением. */
|
|
21
|
+
readonly usesLineBreaks: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function resolveGridFlow(grid: GridLayoutSettings): GridFlow;
|
|
8
24
|
/** Applies one declarative document group to Pixi Layout; no computed Yoga data crosses the document boundary. */
|
|
9
25
|
export declare function applyLayoutGroup(view: Container, node: LayoutGroupNode, profile: LayoutProfileId, parentSize?: LayoutSize, managedSize?: LayoutSize): void;
|
|
10
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutGroups.d.ts","sourceRoot":"","sources":["../src/layoutGroups.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"layoutGroups.d.ts","sourceRoot":"","sources":["../src/layoutGroups.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAA6C,KAAK,kBAAkB,EAAwB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3L,OA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AAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CA+BhI;AAED,mIAAmI;AACnI,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,SAAS,GAAG,SAAS,CAS9I;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAEpF"}
|
package/dist/layoutGroups.js
CHANGED
|
@@ -12,6 +12,17 @@ function alignmentParts(alignment) {
|
|
|
12
12
|
vertical: vertical === "upper" ? "flex-start" : vertical === "lower" ? "flex-end" : "center",
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
export function resolveGridFlow(grid) {
|
|
16
|
+
const reverseX = grid.startCorner.endsWith("right");
|
|
17
|
+
const reverseY = grid.startCorner.startsWith("lower");
|
|
18
|
+
const fillsByRow = grid.constraint === "fixed-column-count" || (grid.constraint === "flexible" && grid.startAxis === "horizontal");
|
|
19
|
+
return {
|
|
20
|
+
fillsByRow,
|
|
21
|
+
mainReversed: fillsByRow ? reverseX : reverseY,
|
|
22
|
+
crossReversed: fillsByRow ? reverseY : reverseX,
|
|
23
|
+
usesLineBreaks: grid.constraint !== "flexible" && grid.constraintCount !== undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
15
26
|
function layoutSize(node, profile, parentSize) {
|
|
16
27
|
const transform = resolveAnchoredTransform(resolveProfileTransform(node, profile).transform, parentSize);
|
|
17
28
|
return { width: transform.width, height: transform.height };
|
|
@@ -36,19 +47,22 @@ export function applyLayoutGroup(view, node, profile, parentSize, managedSize) {
|
|
|
36
47
|
return;
|
|
37
48
|
}
|
|
38
49
|
const grid = settings;
|
|
39
|
-
const
|
|
40
|
-
const reverseY = grid.startCorner.startsWith("lower");
|
|
41
|
-
const fillsByRow = grid.constraint === "fixed-column-count" || (grid.constraint === "flexible" && grid.startAxis === "horizontal");
|
|
50
|
+
const flow = resolveGridFlow(grid);
|
|
42
51
|
const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;
|
|
43
52
|
const alignment = alignmentParts(grid.childAlignment);
|
|
53
|
+
// justify-content при flex-wrap выравнивает КАЖДУЮ линию отдельно, поэтому неполная последняя
|
|
54
|
+
// строка центрируется сама по себе. Это и есть per-row alignment, отдельного поля не нужно.
|
|
44
55
|
target.layout = {
|
|
45
56
|
...common,
|
|
46
|
-
justifyContent: fillsByRow ? alignment.horizontal : alignment.vertical,
|
|
47
|
-
alignItems: fillsByRow ? alignment.vertical : alignment.horizontal,
|
|
48
|
-
alignContent: fillsByRow ? alignment.vertical : alignment.horizontal,
|
|
49
|
-
flexDirection: fillsByRow ? (
|
|
50
|
-
flexWrap:
|
|
51
|
-
|
|
57
|
+
justifyContent: flow.fillsByRow ? alignment.horizontal : alignment.vertical,
|
|
58
|
+
alignItems: flow.fillsByRow ? alignment.vertical : alignment.horizontal,
|
|
59
|
+
alignContent: flow.fillsByRow ? alignment.vertical : alignment.horizontal,
|
|
60
|
+
flexDirection: flow.fillsByRow ? (flow.mainReversed ? "row-reverse" : "row") : (flow.mainReversed ? "column-reverse" : "column"),
|
|
61
|
+
flexWrap: flow.crossReversed ? "wrap-reverse" : "wrap",
|
|
62
|
+
// Разрыв строки занимает собственную линию, поэтому поперечный зазор пришёл бы дважды: до
|
|
63
|
+
// разрыва и после него. Зазор перенесён в размер самого разрыва, а gutter обнулён.
|
|
64
|
+
columnGap: flow.usesLineBreaks && !flow.fillsByRow ? 0 : grid.spacingX,
|
|
65
|
+
rowGap: flow.usesLineBreaks && flow.fillsByRow ? 0 : grid.spacingY,
|
|
52
66
|
paddingLeft: grid.padding.left, paddingRight: grid.padding.right, paddingTop: grid.padding.top, paddingBottom: grid.padding.bottom,
|
|
53
67
|
};
|
|
54
68
|
}
|
|
@@ -128,9 +142,10 @@ export function createGridLineBreak(parent, profile) {
|
|
|
128
142
|
if (grid.constraint === "flexible" || grid.constraintCount === undefined)
|
|
129
143
|
return undefined;
|
|
130
144
|
const lineBreak = new Container({ label: "__layout-grid-line-break__" });
|
|
145
|
+
// Поперечный зазор между линиями живёт здесь, а не в rowGap/columnGap группы: см. applyLayoutGroup.
|
|
131
146
|
lineBreak.layout = (grid.constraint === "fixed-column-count"
|
|
132
|
-
? { flexBasis: "100%", width: "100%", height: 0 }
|
|
133
|
-
: { flexBasis: "100%", height: "100%", width: 0 });
|
|
147
|
+
? { flexBasis: "100%", width: "100%", height: grid.spacingY, flexShrink: 0 }
|
|
148
|
+
: { flexBasis: "100%", height: "100%", width: grid.spacingX, flexShrink: 0 });
|
|
134
149
|
return lineBreak;
|
|
135
150
|
}
|
|
136
151
|
export function isLayoutManagedChild(node, nodes) {
|
package/dist/layoutGroups.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutGroups.js","sourceRoot":"","sources":["../src/layoutGroups.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAiF,MAAM,wBAAwB,CAAC;AAClK,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,iHAAiH;AACjH,MAAM,UAAU,oBAAoB,KAAyE,CAAC;AAE9G,SAAS,cAAc,CAAC,SAA0B;IAChD,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAgE,CAAC;IACnH,OAAO;QACL,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,U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AAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE;QACjD,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAU,CAAC;IAC9D,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,KAAwB;IACzE,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;AAC7M,CAAC","sourcesContent":["import \"@pixi/layout\";\r\nimport { isLayoutGroup, resolveLayoutGroupSettings, type LayoutAlignment, type LayoutGroupNode, type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport { resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\r\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\r\nimport { NodeView } from \"./views/NodeView.js\";\r\n\r\n/** Importing @pixi/layout installs its renderer extension. Kept as a shared explicit contract for every host. */\r\nexport function initializePixiLayout(): void { /* @pixi/layout is installed by this module's side effect. */ }\r\n\r\nfunction alignmentParts(alignment: LayoutAlignment) {\r\n const [vertical, horizontal] = alignment.split(\"-\") as [\"upper\" | \"middle\" | \"lower\", \"left\" | \"center\" | \"right\"];\r\n return {\r\n horizontal: horizontal === \"left\" ? \"flex-start\" : horizontal === \"right\" ? \"flex-end\" : \"center\",\r\n vertical: vertical === \"upper\" ? \"flex-start\" : vertical === \"lower\" ? \"flex-end\" : \"center\",\r\n };\r\n}\r\n\r\nfunction layoutSize(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): LayoutSize {\n const transform = resolveAnchoredTransform(resolveProfileTransform(node, profile).transform, parentSize);\n return { width: transform.width, height: transform.height };\n}\n\n/** Applies one declarative document group to Pixi Layout; no computed Yoga data crosses the document boundary. */\nexport function applyLayoutGroup(view: Container, node: LayoutGroupNode, profile: LayoutProfileId, parentSize?: LayoutSize, managedSize?: LayoutSize): void {\n const settings = resolveLayoutGroupSettings(node, profile) as LayoutGroupNode[\"layoutGroup\"][\"base\"];\n const size = managedSize ?? layoutSize(node, profile, parentSize);\n const common = { width: size.width, height: size.height, display: \"flex\" as const };\r\n if (node.type === \"horizontal-layout\" || node.type === \"vertical-layout\") {\r\n const linear = settings as Extract<LayoutGroupNode, { type: \"horizontal-layout\" | \"vertical-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;\r\n const alignment = alignmentParts(linear.childAlignment);\r\n target.layout = {\r\n ...common,\r\n justifyContent: node.type === \"horizontal-layout\" ? alignment.horizontal : alignment.vertical,\r\n alignItems: node.type === \"horizontal-layout\" ? alignment.vertical : alignment.horizontal,\r\n flexDirection: node.type === \"horizontal-layout\" ? (linear.reverseOrder ? \"row-reverse\" : \"row\") : (linear.reverseOrder ? \"column-reverse\" : \"column\"),\r\n gap: linear.spacing,\r\n paddingLeft: linear.padding.left, paddingRight: linear.padding.right, paddingTop: linear.padding.top, paddingBottom: linear.padding.bottom,\r\n } as never;\r\n return;\r\n }\r\n const grid = settings as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const reverseX = grid.startCorner.endsWith(\"right\");\r\n const reverseY = grid.startCorner.startsWith(\"lower\");\r\n const fillsByRow = grid.constraint === \"fixed-column-count\" || (grid.constraint === \"flexible\" && grid.startAxis === \"horizontal\");\r\n const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;\r\n const alignment = alignmentParts(grid.childAlignment);\r\n target.layout = {\r\n ...common,\r\n justifyContent: fillsByRow ? alignment.horizontal : alignment.vertical,\r\n alignItems: fillsByRow ? alignment.vertical : alignment.horizontal,\r\n alignContent: fillsByRow ? alignment.vertical : alignment.horizontal,\r\n flexDirection: fillsByRow ? (reverseX ? \"row-reverse\" : \"row\") : (reverseY ? \"column-reverse\" : \"column\"),\r\n flexWrap: reverseY && fillsByRow ? \"wrap-reverse\" : \"wrap\",\r\n columnGap: grid.spacingX, rowGap: grid.spacingY,\n paddingLeft: grid.padding.left, paddingRight: grid.padding.right, paddingTop: grid.padding.top, paddingBottom: grid.padding.bottom,\r\n } as never;\r\n}\r\n\r\n/**\r\n * Runtime-only Yoga owner for one direct child. The wrapper receives Yoga coordinates while the\r\n * serializable NodeView keeps the shared pivot/rotation/scale/content/hit-test contract.\r\n */\r\nexport class LayoutItemContainer extends Container {\r\n private node?: UINode;\r\n private profile: LayoutProfileId = \"desktop\";\r\n private fallbackSize: LayoutSize = { width: 0, height: 0 };\r\n\r\n constructor(readonly nodeView: NodeView, private readonly onLayoutChanged?: () => void) {\r\n super();\r\n super.addChild(nodeView);\r\n this.onLayout = () => this.applyComputedSize();\r\n }\r\n\r\n sync(node: UINode, profile: LayoutProfileId, fallbackSize: LayoutSize): void {\r\n this.node = node;\r\n this.profile = profile;\r\n this.fallbackSize = fallbackSize;\r\n this.visible = resolveProfileTransform(node, profile).visible;\r\n this.applyComputedSize();\r\n }\r\n\r\n private applyComputedSize(): void {\r\n if (this.node === undefined) return;\r\n const computed = this.layout?.computedLayout;\r\n const size = computed === undefined || computed.width <= 0 || computed.height <= 0\r\n ? this.fallbackSize\r\n : { width: computed.width, height: computed.height };\r\n if (isLayoutGroup(this.node)) applyLayoutGroup(this.nodeView, this.node, this.profile, undefined, size);\n this.nodeView.updateManaged(this.node, this.profile, size);\r\n this.onLayoutChanged?.();\r\n }\r\n}\r\n\r\n/** Marks a direct child's technical wrapper as layout-managed. */\r\nexport function applyLayoutItem(view: LayoutItemContainer, node: UINode, parent: LayoutGroupNode, profile: LayoutProfileId): void {\r\n // Anchors belong to authored positioning and are deliberately ignored while a parent layout owns\r\n // the rectangle. Width/height remain the child's logical intrinsic size, never Pixi content bounds.\r\n const transform = resolveProfileTransform(node, profile).transform;\r\n const own = { width: transform.width, height: transform.height };\r\n const item = node.layoutItem;\r\n const settings = resolveLayoutGroupSettings(parent, profile);\r\n const base = { position: \"relative\" as const, flexGrow: item?.flexGrow ?? 0, flexShrink: item?.flexShrink ?? 0, flexBasis: item?.flexBasis, alignSelf: item?.alignSelf };\r\n view.sync(node, profile, own);\r\n if (parent.type === \"grid-layout\") {\n const grid = settings as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\n view.layout = { ...base, width: grid.cellWidth, height: grid.cellHeight } as never;\n return;\n }\n const linear = settings as Extract<LayoutGroupNode, { type: \"horizontal-layout\" | \"vertical-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const horizontal = parent.type === \"horizontal-layout\";\r\n const expandsMain = horizontal\r\n ? linear.controlChildWidth && linear.forceExpandWidth\r\n : linear.controlChildHeight && linear.forceExpandHeight;\r\n const expandsCross = horizontal\r\n ? linear.controlChildHeight && linear.forceExpandHeight\r\n : linear.controlChildWidth && linear.forceExpandWidth;\r\n view.layout = {\r\n ...base,\r\n // The schema has no separate min/preferred size yet, so the logical authored rect is the safe\r\n // intrinsic fallback for both control modes. Force-expand may then replace the relevant axis.\r\n width: expandsCross && !horizontal ? undefined : own.width,\r\n height: expandsCross && horizontal ? undefined : own.height,\r\n ...(expandsMain ? { flexGrow: Math.max(1, item?.flexGrow ?? 0) } : {}),\r\n ...(expandsCross ? { alignSelf: item?.alignSelf ?? \"stretch\" } : {}),\r\n } as never;\r\n}\r\n\r\n/** A zero-visual Yoga flex item. Fixed Unity grid constraints need explicit line breaks; this is still solved entirely by Yoga. */\r\nexport function createGridLineBreak(parent: Extract<LayoutGroupNode, { type: \"grid-layout\" }>, profile: LayoutProfileId): Container | undefined {\r\n const grid = resolveLayoutGroupSettings(parent, profile) as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n if (grid.constraint === \"flexible\" || grid.constraintCount === undefined) return undefined;\r\n const lineBreak = new Container({ label: \"__layout-grid-line-break__\" });\r\n lineBreak.layout = (grid.constraint === \"fixed-column-count\"\r\n ? { flexBasis: \"100%\", width: \"100%\", height: 0 }\r\n : { flexBasis: \"100%\", height: \"100%\", width: 0 }) as never;\r\n return lineBreak;\r\n}\r\n\r\nexport function isLayoutManagedChild(node: UINode, nodes: readonly UINode[]): boolean {\r\n return node.parentId !== null && isLayoutGroup(nodes.find((candidate) => candidate.id === node.parentId) ?? node) && nodes.some((candidate) => candidate.id === node.parentId && isLayoutGroup(candidate));\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"layoutGroups.js","sourceRoot":"","sources":["../src/layoutGroups.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAA0G,MAAM,wBAAwB,CAAC;AAC3L,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,iHAAiH;AACjH,MAAM,UAAU,oBAAoB,KAAyE,CAAC;AAE9G,SAAS,cAAc,CAAC,SAA0B;IAChD,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAgE,CAAC;IACnH,OAAO;QACL,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ;QACjG,QAA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AAI,CAAC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;AAC7M,CAAC","sourcesContent":["import \"@pixi/layout\";\r\nimport { isLayoutGroup, resolveLayoutGroupSettings, type GridLayoutSettings, type LayoutAlignment, type LayoutGroupNode, type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport { resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\r\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\r\nimport { NodeView } from \"./views/NodeView.js\";\r\n\r\n/** Importing @pixi/layout installs its renderer extension. Kept as a shared explicit contract for every host. */\r\nexport function initializePixiLayout(): void { /* @pixi/layout is installed by this module's side effect. */ }\r\n\r\nfunction alignmentParts(alignment: LayoutAlignment) {\r\n const [vertical, horizontal] = alignment.split(\"-\") as [\"upper\" | \"middle\" | \"lower\", \"left\" | \"center\" | \"right\"];\r\n return {\r\n horizontal: horizontal === \"left\" ? \"flex-start\" : horizontal === \"right\" ? \"flex-end\" : \"center\",\r\n vertical: vertical === \"upper\" ? \"flex-start\" : vertical === \"lower\" ? \"flex-end\" : \"center\",\r\n };\r\n}\r\n\r\n/**\r\n * Направление заполнения сетки, выведенное из startCorner/startAxis/constraint. Единственный\r\n * источник правды: рантайм задаёт по нему Yoga-флексбокс, а редактор считает по нему же рамки\r\n * выделения, поэтому расходиться этим двум расчётам негде.\r\n */\r\nexport type GridFlow = {\r\n /** Строки являются линиями переноса (иначе линии — это колонки). */\r\n readonly fillsByRow: boolean;\r\n /** Главная ось (порядок внутри линии) идёт справа налево / снизу вверх. */\r\n readonly mainReversed: boolean;\r\n /** Поперечная ось (порядок линий) идёт снизу вверх / справа налево. */\r\n readonly crossReversed: boolean;\r\n /** Фиксированный constraint переносит линии явными разрывами, а не переполнением. */\r\n readonly usesLineBreaks: boolean;\r\n};\r\n\r\nexport function resolveGridFlow(grid: GridLayoutSettings): GridFlow {\r\n const reverseX = grid.startCorner.endsWith(\"right\");\r\n const reverseY = grid.startCorner.startsWith(\"lower\");\r\n const fillsByRow = grid.constraint === \"fixed-column-count\" || (grid.constraint === \"flexible\" && grid.startAxis === \"horizontal\");\r\n return {\r\n fillsByRow,\r\n mainReversed: fillsByRow ? reverseX : reverseY,\r\n crossReversed: fillsByRow ? reverseY : reverseX,\r\n usesLineBreaks: grid.constraint !== \"flexible\" && grid.constraintCount !== undefined,\r\n };\r\n}\r\n\r\nfunction layoutSize(node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize): LayoutSize {\r\n const transform = resolveAnchoredTransform(resolveProfileTransform(node, profile).transform, parentSize);\r\n return { width: transform.width, height: transform.height };\r\n}\r\n\r\n/** Applies one declarative document group to Pixi Layout; no computed Yoga data crosses the document boundary. */\r\nexport function applyLayoutGroup(view: Container, node: LayoutGroupNode, profile: LayoutProfileId, parentSize?: LayoutSize, managedSize?: LayoutSize): void {\r\n const settings = resolveLayoutGroupSettings(node, profile) as LayoutGroupNode[\"layoutGroup\"][\"base\"];\r\n const size = managedSize ?? layoutSize(node, profile, parentSize);\r\n const common = { width: size.width, height: size.height, display: \"flex\" as const };\r\n if (node.type === \"horizontal-layout\" || node.type === \"vertical-layout\") {\r\n const linear = settings as Extract<LayoutGroupNode, { type: \"horizontal-layout\" | \"vertical-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;\r\n const alignment = alignmentParts(linear.childAlignment);\r\n target.layout = {\r\n ...common,\r\n justifyContent: node.type === \"horizontal-layout\" ? alignment.horizontal : alignment.vertical,\r\n alignItems: node.type === \"horizontal-layout\" ? alignment.vertical : alignment.horizontal,\r\n flexDirection: node.type === \"horizontal-layout\" ? (linear.reverseOrder ? \"row-reverse\" : \"row\") : (linear.reverseOrder ? \"column-reverse\" : \"column\"),\r\n gap: linear.spacing,\r\n paddingLeft: linear.padding.left, paddingRight: linear.padding.right, paddingTop: linear.padding.top, paddingBottom: linear.padding.bottom,\r\n } as never;\r\n return;\r\n }\r\n const grid = settings as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const flow = resolveGridFlow(grid);\r\n const target = view instanceof LayoutGroupNodeView ? view.layoutTarget : view;\r\n const alignment = alignmentParts(grid.childAlignment);\r\n // justify-content при flex-wrap выравнивает КАЖДУЮ линию отдельно, поэтому неполная последняя\r\n // строка центрируется сама по себе. Это и есть per-row alignment, отдельного поля не нужно.\r\n target.layout = {\r\n ...common,\r\n justifyContent: flow.fillsByRow ? alignment.horizontal : alignment.vertical,\r\n alignItems: flow.fillsByRow ? alignment.vertical : alignment.horizontal,\r\n alignContent: flow.fillsByRow ? alignment.vertical : alignment.horizontal,\r\n flexDirection: flow.fillsByRow ? (flow.mainReversed ? \"row-reverse\" : \"row\") : (flow.mainReversed ? \"column-reverse\" : \"column\"),\r\n flexWrap: flow.crossReversed ? \"wrap-reverse\" : \"wrap\",\r\n // Разрыв строки занимает собственную линию, поэтому поперечный зазор пришёл бы дважды: до\r\n // разрыва и после него. Зазор перенесён в размер самого разрыва, а gutter обнулён.\r\n columnGap: flow.usesLineBreaks && !flow.fillsByRow ? 0 : grid.spacingX,\r\n rowGap: flow.usesLineBreaks && flow.fillsByRow ? 0 : grid.spacingY,\r\n paddingLeft: grid.padding.left, paddingRight: grid.padding.right, paddingTop: grid.padding.top, paddingBottom: grid.padding.bottom,\r\n } as never;\r\n}\r\n\r\n/**\r\n * Runtime-only Yoga owner for one direct child. The wrapper receives Yoga coordinates while the\r\n * serializable NodeView keeps the shared pivot/rotation/scale/content/hit-test contract.\r\n */\r\nexport class LayoutItemContainer extends Container {\r\n private node?: UINode;\r\n private profile: LayoutProfileId = \"desktop\";\r\n private fallbackSize: LayoutSize = { width: 0, height: 0 };\r\n\r\n constructor(readonly nodeView: NodeView, private readonly onLayoutChanged?: () => void) {\r\n super();\r\n super.addChild(nodeView);\r\n this.onLayout = () => this.applyComputedSize();\r\n }\r\n\r\n sync(node: UINode, profile: LayoutProfileId, fallbackSize: LayoutSize): void {\r\n this.node = node;\r\n this.profile = profile;\r\n this.fallbackSize = fallbackSize;\r\n this.visible = resolveProfileTransform(node, profile).visible;\r\n this.applyComputedSize();\r\n }\r\n\r\n private applyComputedSize(): void {\r\n if (this.node === undefined) return;\r\n const computed = this.layout?.computedLayout;\r\n const size = computed === undefined || computed.width <= 0 || computed.height <= 0\r\n ? this.fallbackSize\r\n : { width: computed.width, height: computed.height };\r\n if (isLayoutGroup(this.node)) applyLayoutGroup(this.nodeView, this.node, this.profile, undefined, size);\r\n this.nodeView.updateManaged(this.node, this.profile, size);\r\n this.onLayoutChanged?.();\r\n }\r\n}\r\n\r\n/** Marks a direct child's technical wrapper as layout-managed. */\r\nexport function applyLayoutItem(view: LayoutItemContainer, node: UINode, parent: LayoutGroupNode, profile: LayoutProfileId): void {\r\n // Anchors belong to authored positioning and are deliberately ignored while a parent layout owns\r\n // the rectangle. Width/height remain the child's logical intrinsic size, never Pixi content bounds.\r\n const transform = resolveProfileTransform(node, profile).transform;\r\n const own = { width: transform.width, height: transform.height };\r\n const item = node.layoutItem;\r\n const settings = resolveLayoutGroupSettings(parent, profile);\r\n const base = { position: \"relative\" as const, flexGrow: item?.flexGrow ?? 0, flexShrink: item?.flexShrink ?? 0, flexBasis: item?.flexBasis, alignSelf: item?.alignSelf };\r\n view.sync(node, profile, own);\r\n if (parent.type === \"grid-layout\") {\r\n const grid = settings as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n view.layout = { ...base, width: grid.cellWidth, height: grid.cellHeight } as never;\r\n return;\r\n }\r\n const linear = settings as Extract<LayoutGroupNode, { type: \"horizontal-layout\" | \"vertical-layout\" }> [\"layoutGroup\"][\"base\"];\r\n const horizontal = parent.type === \"horizontal-layout\";\r\n const expandsMain = horizontal\r\n ? linear.controlChildWidth && linear.forceExpandWidth\r\n : linear.controlChildHeight && linear.forceExpandHeight;\r\n const expandsCross = horizontal\r\n ? linear.controlChildHeight && linear.forceExpandHeight\r\n : linear.controlChildWidth && linear.forceExpandWidth;\r\n view.layout = {\r\n ...base,\r\n // The schema has no separate min/preferred size yet, so the logical authored rect is the safe\r\n // intrinsic fallback for both control modes. Force-expand may then replace the relevant axis.\r\n width: expandsCross && !horizontal ? undefined : own.width,\r\n height: expandsCross && horizontal ? undefined : own.height,\r\n ...(expandsMain ? { flexGrow: Math.max(1, item?.flexGrow ?? 0) } : {}),\r\n ...(expandsCross ? { alignSelf: item?.alignSelf ?? \"stretch\" } : {}),\r\n } as never;\r\n}\r\n\r\n/** A zero-visual Yoga flex item. Fixed Unity grid constraints need explicit line breaks; this is still solved entirely by Yoga. */\r\nexport function createGridLineBreak(parent: Extract<LayoutGroupNode, { type: \"grid-layout\" }>, profile: LayoutProfileId): Container | undefined {\r\n const grid = resolveLayoutGroupSettings(parent, profile) as Extract<LayoutGroupNode, { type: \"grid-layout\" }> [\"layoutGroup\"][\"base\"];\r\n if (grid.constraint === \"flexible\" || grid.constraintCount === undefined) return undefined;\r\n const lineBreak = new Container({ label: \"__layout-grid-line-break__\" });\r\n // Поперечный зазор между линиями живёт здесь, а не в rowGap/columnGap группы: см. applyLayoutGroup.\r\n lineBreak.layout = (grid.constraint === \"fixed-column-count\"\r\n ? { flexBasis: \"100%\", width: \"100%\", height: grid.spacingY, flexShrink: 0 }\r\n : { flexBasis: \"100%\", height: \"100%\", width: grid.spacingX, flexShrink: 0 }) as never;\r\n return lineBreak;\r\n}\r\n\r\nexport function isLayoutManagedChild(node: UINode, nodes: readonly UINode[]): boolean {\r\n return node.parentId !== null && isLayoutGroup(nodes.find((candidate) => candidate.id === node.parentId) ?? node) && nodes.some((candidate) => candidate.id === node.parentId && isLayoutGroup(candidate));\r\n}\r\n"]}
|
package/dist/scene.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AAAA,OAAO,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M,EACf,OAAO,EAAE,eAAe,EACxB,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE;IAAE,WAAW,EAAE,oBAAoB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,GAC/J,OAAO,CAAC,eAAe,CAAC,CAY1B"}
|
package/dist/scene.js
CHANGED
|
@@ -72,11 +72,20 @@ export function buildSceneView(document, sceneId, profile, options) {
|
|
|
72
72
|
// иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.
|
|
73
73
|
const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);
|
|
74
74
|
const gridCell = gridParent?.type === "grid-layout" ? resolveLayoutGroupSettings(gridParent, profile) : undefined;
|
|
75
|
+
// Та же логика для прямого ребёнка page-group (страницы): `PageItemContainer`/`updateManaged`
|
|
76
|
+
// растягивают её на весь resolved rectangle группы независимо от собственных anchors ноды
|
|
77
|
+
// (см. NodeView.applyResolvedTransform, managedByLayout). Здесь `node` — сама страница, поэтому
|
|
78
|
+
// это переопределённый размер, который она фактически получит, — `parentSize`, уже разрешённый
|
|
79
|
+
// как rectangle page-group. Без этой ветки дети страницы якорились бы относительно её
|
|
80
|
+
// anchor-resolved authored-размера, который может расходиться с фактическим rectangle группы,
|
|
81
|
+
// особенно в другом layout-профиле.
|
|
75
82
|
const childSize = node.parentId === null
|
|
76
83
|
? rootSize
|
|
77
84
|
: gridCell !== undefined
|
|
78
85
|
? { width: gridCell.cellWidth, height: gridCell.cellHeight }
|
|
79
|
-
:
|
|
86
|
+
: gridParent?.type === "page-group"
|
|
87
|
+
? parentSize
|
|
88
|
+
: { width: transform.width, height: transform.height };
|
|
80
89
|
for (const [childIndex, childId] of node.children.entries()) {
|
|
81
90
|
const childNode = nodesById.get(childId);
|
|
82
91
|
const childView = buildNode(childId, childSize);
|
|
@@ -167,6 +176,9 @@ function wireNodeReferences(nodes, nodeViews, interaction) {
|
|
|
167
176
|
else if (node.type === "pagination" && view instanceof PaginationNodeView && interaction === "runtime") {
|
|
168
177
|
view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });
|
|
169
178
|
}
|
|
179
|
+
else if (node.type === "page-group" && view instanceof PageGroupNodeView && interaction === "runtime") {
|
|
180
|
+
view.setArrows({ up: arrowView(node.pageUpButtonNodeId), down: arrowView(node.pageDownButtonNodeId) });
|
|
181
|
+
}
|
|
170
182
|
}
|
|
171
183
|
}
|
|
172
184
|
/**
|
package/dist/scene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,qBAAqB,EAAiJ,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,aAAa,CAAC;AACvI,OAAO,EAAE,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,C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,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC;QAClM,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC;QACjE,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,CAAC;QAC/D,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC;KAC5E,CAAC,CAAC;IACH,OAAO,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AACpO,CAAC","sourcesContent":["import { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\nimport { createStableId, isLayoutGroup, isParticleEffect, resolveLayoutGroupSettings, resolveOwnerNodeGraph, type EffectDefinition, type GridLayoutSettings, type LayoutProfileId, type ProjectDocument, type Scene, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\nimport { Container, Texture, type Ticker } from \"pixi.js\";\nimport { loadSceneSpines } from \"./assets/spine.js\";\nimport { loadSceneTextures, type FileUrlResolver } from \"./assets/textures.js\";\nimport { loadSceneFonts } from \"./assets/fonts.js\";\nimport { loadSceneBitmapFonts } from \"./assets/bitmapFonts.js\";\nimport type { SceneAssetCache } from \"./assets/cache.js\";\nimport { getCanvasLogicalSize, getCanvasScale, resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\nimport { NodeView, type SceneInteractionMode } from \"./views/NodeView.js\";\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\nimport { createNodeView } from \"./views/createNodeView.js\";\nimport { applyLayoutGroup, applyLayoutItem, createGridLineBreak, initializePixiLayout, LayoutItemContainer } from \"./layoutGroups.js\";\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\nimport { PageItemContainer } from \"./pageGroup.js\";\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\nimport { PaginationNodeView, type PaginationArrow } from \"./views/PaginationNodeView.js\";\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\nimport { ScrollItemContainer } from \"./scrollView.js\";\nimport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\nimport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\nimport { SceneLocalization, type SceneLocalizationOptions } from \"./localization.js\";\nimport { SceneViewport } from \"./SceneViewport.js\";\nimport type { Sound } from \"@pixi/sound\";\n\nexport type BuildSceneViewOptions = {\n /** Explicit: an editor canvas must pass \"authoring\", Preview and the consuming app \"runtime\". */\n interaction: SceneInteractionMode;\n textures?: ReadonlyMap<string, Texture>;\n spines?: ReadonlyMap<string, SkeletonData>;\n fonts?: ReadonlyMap<string, string>;\n bitmapFonts?: ReadonlyMap<string, string>;\n sounds?: ReadonlyMap<string, Sound>;\n /**\n * The host's own Application ticker, driving self-updating content such as Spine skeletons.\n * Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the\n * renderer that draws them — see the same rule as `updateParticleEmitters`.\n */\n ticker?: Ticker;\n /** Called after Yoga changes a managed rectangle; authoring hosts use it to refresh overlays. */\n onLayout?: () => void;\n /**\n * Начальное состояние локализации. Опция необязательна: при наличии `Text.textKey` base locale\n * каталога применяется и без неё, а документ без ключей выглядит ровно как раньше.\n */\n localization?: SceneLocalizationOptions;\n /** Internal host boundary override: prefab views are spawnable content, not screen viewports. */\n clipToViewport?: boolean;\n};\n\nexport type SceneViewResult = { root: SceneViewport; nodeViews: Map<string, Container>; localization: SceneLocalization };\nconst particleEmitterRegistry = new WeakMap<Container, readonly ParticleEmitterNodeView[]>();\n\nfunction spineReferenceFrameFor(document: ProjectDocument, node: UINode): SpineReferenceFrame | undefined {\n if (node.type !== \"spine\") return undefined;\n const asset = document.assets.find((candidate) => candidate.id === node.assetId);\n return asset?.type === \"spine\" ? asset.referenceFrame : undefined;\n}\n\n/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */\nexport function buildSceneView(\n document: ProjectDocument,\n sceneId: string,\n profile: LayoutProfileId,\n options: BuildSceneViewOptions,\n): SceneViewResult {\n initializePixiLayout();\n const { interaction, textures, spines, fonts, bitmapFonts, sounds, ticker, onLayout } = options;\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\n\n if (scene === undefined) {\n throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\n }\n\n const nodeViews = new Map<string, Container>();\n const particleEmitters: ParticleEmitterNodeView[] = [];\n\n // Materialized prefab children use instance-scoped IDs, so authoring and runtime can address\n // multiple instances independently without changing canonical definition IDs.\n const screenSize = scene.layout.referenceViewports[profile];\n const referenceResolution = scene.layout.preferredViewports[profile];\n const canvasScale = getCanvasScale(screenSize, referenceResolution);\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\n\n // Единый резолвер иерархии: тот же граф, что видит редактор, включая вложенные пресеты.\n const owner = resolveOwnerNodeGraph(document, scene);\n const prefabIds = new Set(document.prefabs.map((prefab) => prefab.id));\n\n const buildOwner = (rootSize: LayoutSize): Container => {\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\n\n const buildNode = (nodeId: string, parentSize: LayoutSize): NodeView => {\n const node = nodesById.get(nodeId);\n\n if (node === undefined) {\n throw new Error(`Scene '${sceneId}' references missing node '${nodeId}'.`);\n }\n\n const resolved = resolveProfileTransform(node, profile);\n const transform = resolveAnchoredTransform(resolved.transform, parentSize);\n const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sounds, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\n // Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.\n view.update(node, profile, parentSize);\n nodeViews.set(node.id, view);\n if (view instanceof ParticleEmitterNodeView) particleEmitters.push(view);\n\n // Прямые дети корня сцены разрешают якоря относительно логического Canvas, а не размера корня.\n // Прямой ребёнок grid-layout (сам `node` здесь) не владеет своим отрисованным размером: Unity-подобная\n // фиксированная ячейка полностью переопределяет authored transform (см. applyLayoutItem). Его\n // собственным потомкам нужен именно cellWidth/cellHeight, а не anchor-resolved authored-размер —\n // иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.\n const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);\n const gridCell = gridParent?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(gridParent, profile) : undefined;\n const childSize = node.parentId === null\n ? rootSize\n : gridCell !== undefined\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\n : { width: transform.width, height: transform.height };\n for (const [childIndex, childId] of node.children.entries()) {\n const childNode = nodesById.get(childId);\n const childView = buildNode(childId, childSize);\n if (isLayoutGroup(node) && childNode !== undefined && view instanceof LayoutGroupNodeView) {\n const layoutItem = new LayoutItemContainer(childView, onLayout);\n applyLayoutItem(layoutItem, childNode, node, profile);\n view.addLayoutChild(layoutItem);\n } else if (node.type === \"scroll-view\" && childNode !== undefined && view instanceof ScrollViewNodeView) {\n const scrollItem = new ScrollItemContainer(childView, onLayout);\n // Как и у layout-item: собственный (не растянутый якорями) размер ребёнка — List не\n // предоставляет per-item override размера, в отличие от Yoga flexGrow/cellSize.\n const own = resolveProfileTransform(childNode, profile).transform;\n scrollItem.sync(childNode, profile, { width: own.width, height: own.height });\n view.addScrollItem(scrollItem);\n } else if (node.type === \"page-group\" && childNode !== undefined && view instanceof PageGroupNodeView) {\n // Unlike a scroll-view item, a page fills the group's own resolved rect completely\n // (`childSize`, computed above): a page is a full sub-screen, not content sized to itself.\n const pageItem = new PageItemContainer(childView);\n pageItem.sync(childNode, profile, childSize);\n view.addPageItem(pageItem);\n } else {\n view.addChild(childView);\n }\n if (node.type === \"grid-layout\") {\n const settings = node.layoutGroup.overrides?.[profile] === undefined ? node.layoutGroup.base : { ...node.layoutGroup.base, ...node.layoutGroup.overrides[profile] };\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\n const lineBreak = createGridLineBreak(node, profile);\n if (lineBreak !== undefined && view instanceof LayoutGroupNodeView) view.addLayoutChild(lineBreak);\n }\n }\n }\n\n return view;\n };\n\n const ownerRoot = new Container();\n for (const rootNodeId of owner.rootNodeIds) {\n ownerRoot.addChild(buildNode(rootNodeId, rootSize));\n }\n\n return ownerRoot;\n };\n\n const canvasRoot = buildOwner(canvasSize);\n canvasRoot.scale.set(canvasScale);\n const hostRoot = new SceneViewport(canvasRoot, screenSize, options.clipToViewport ?? interaction === \"runtime\");\n particleEmitterRegistry.set(hostRoot, particleEmitters);\n // Контроллер применяет переводы сразу к уже созданным views, поэтому keyed Text показывает\n // базовую локаль без единого дополнительного вызова со стороны хоста.\n const localization = new SceneLocalization(document, scene, nodeViews, options.localization);\n wireCheckboxGroups(owner.nodes, nodeViews);\n wireSpineConnectors(owner.nodes, nodeViews);\n wireNodeReferences(owner.nodes, nodeViews, interaction);\n return { root: hostRoot, nodeViews, localization };\n}\n\nfunction wireSpineConnectors(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\n for (const node of nodes) {\n if (node.type !== \"spine\") continue;\n const view = nodeViews.get(node.id);\n if (!(view instanceof SpineNodeView)) continue;\n view.setConnectorBones((node.connectors ?? []).flatMap((connector) => {\n const target = nodeViews.get(connector.targetNodeId);\n return target === undefined ? [] : [{ ...connector, target }];\n }));\n }\n}\n\n/**\n * Разрешает все ссылки «нода → нода» в живые views: элементы item table и кнопки-стрелки пагинатора.\n * Та же форма, что у `wireSpineConnectors`: документ хранит id, а во что он превратился, знает только\n * собранная сцена, поэтому сами виды никогда не резолвят id. Один проход на все виды ссылок, чтобы\n * следующая не завела собственный обход с чуть другой областью видимости.\n *\n * Стрелки подключаются только в runtime-сцене: на authoring-канвасе контрол инертен, как и клик по\n * самой точке пагинатора. Вместимость таблицы, наоборот, видна и в редакторе — это не интерактивность.\n */\nfunction wireNodeReferences(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>, interaction: SceneInteractionMode): void {\n const arrowView = (nodeId: string | undefined): PaginationArrow | undefined => {\n const view = nodeId === undefined ? undefined : nodeViews.get(nodeId);\n return view instanceof ButtonNodeView || view instanceof StagedButtonNodeView ? view : undefined;\n };\n for (const node of nodes) {\n const view = nodeViews.get(node.id);\n if (node.type === \"item-table\" && view instanceof ItemTableNodeView) {\n view.setItems((node.items ?? []).map((itemId) => nodeViews.get(itemId)));\n } else if (node.type === \"pagination\" && view instanceof PaginationNodeView && interaction === \"runtime\") {\n view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });\n }\n }\n}\n\n/**\n * Authored `group` gives sibling checkboxes radio-button behavior: checking one force-unchecks its\n * live group-mates (same `parentId`, same `group`), without touching the document. Runs once per\n * scene build; `CheckboxNodeView.forceCheck` never re-emits `onCheck`, so this can't recurse.\n */\nfunction wireCheckboxGroups(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\n const byGroup = new Map<string, CheckboxNodeView[]>();\n for (const node of nodes) {\n if (node.type !== \"checkbox\" || node.group === undefined) continue;\n const view = nodeViews.get(node.id);\n if (!(view instanceof CheckboxNodeView)) continue;\n const key = `${node.parentId ?? \"\"}::${node.group}`;\n const group = byGroup.get(key) ?? [];\n group.push(view);\n byGroup.set(key, group);\n }\n for (const group of byGroup.values()) {\n if (group.length < 2) continue;\n for (const view of group) {\n view.onCheck.connect((checked) => {\n if (!checked) return;\n for (const other of group) if (other !== view) other.forceCheck(false);\n });\n }\n }\n}\n\n/**\n * Applies a node's resolved transform, visibility, and content to an existing display object,\n * so editors can update views in place without rebuilding the scene tree.\n */\nexport function updateNodeView(view: Container, node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize, parentNode?: UINode, effect?: EffectDefinition, spineReferenceFrame?: SpineReferenceFrame): void {\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\n if (!(view instanceof NodeView)) return;\n if (view instanceof SpineNodeView) view.setReferenceFrame(spineReferenceFrame);\n if (node.type === \"particle-emitter\" && effect !== undefined && isParticleEffect(effect) && \"syncEffect\" in view && typeof (view as { syncEffect?: unknown }).syncEffect === \"function\") (view as { syncEffect(effect: import(\"@pixi-ui-editor/schema\").ParticleEffectDefinition): void }).syncEffect(effect);\n if (parentNode !== undefined && isLayoutGroup(parentNode) && view.parent instanceof LayoutItemContainer) {\n applyLayoutItem(view.parent, node, parentNode, profile);\n } else if (parentNode !== undefined && parentNode.type === \"scroll-view\" && view.parent instanceof ScrollItemContainer) {\n const own = resolveProfileTransform(node, profile).transform;\n view.parent.sync(node, profile, { width: own.width, height: own.height });\n } else if (parentNode !== undefined && parentNode.type === \"page-group\" && view.parent instanceof PageItemContainer && parentSize !== undefined) {\n // A page is position-managed exactly like a layout/scroll item: it fills the group's own rectangle\n // (`parentSize`, the same value `buildSceneView` passes as `childSize`). Without this branch an\n // in-place update fell through to `view.update` and handed the page back its authored x/y and\n // anchors, so editing anything inside a page group knocked its pages out of place.\n view.parent.sync(node, profile, parentSize);\n } else {\n view.update(node, profile, parentSize);\n }\n}\n\n/** Previews a resolved editor rectangle without consulting content bounds or rebuilding the view. */\nexport function previewNodeView(view: Container, node: UINode, profile: LayoutProfileId, transform: UINode[\"transform\"]): void {\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, undefined, { width: transform.width, height: transform.height });\n if (view instanceof NodeView) view.preview(node, transform, resolveProfileTransform(node, profile).visible, profile);\n}\n\n/** Hosts call this from their own Application ticker; runtime never subscribes to Ticker.shared. */\nexport function updateParticleEmitters(root: Container, deltaSeconds: number): void {\n const registered = particleEmitterRegistry.get(root);\n if (registered !== undefined) {\n for (const emitter of registered) emitter.updateParticles(deltaSeconds);\n return;\n }\n // Backward-compatible fallback for hosts that assemble a display tree manually instead of using\n // buildSceneView. Built scenes always take the O(emitter count) registry path above.\n const visit = (view: Container): void => {\n if (view instanceof ParticleEmitterNodeView) view.updateParticles(deltaSeconds);\n for (const child of view.children) visit(child);\n };\n visit(root);\n}\n\n/** Lists the nodes a scene renders, including nodes of prefab definitions its prefab instances expand to. */\nexport function collectRenderedNodes(document: ProjectDocument, scene: Scene): UINode[] {\n return resolveOwnerNodeGraph(document, scene).nodes;\n}\n\nexport type PrefabViewConfiguration = Pick<Extract<UINode, { type: \"prefab-instance\" }>, \"propertyOverrides\" | \"locallyAddedNodes\"> & { instanceId?: string };\n\nfunction prefabScene(document: ProjectDocument, prefabId: string, configuration: PrefabViewConfiguration = {}): { document: ProjectDocument; sceneId: string; instanceId: string } {\n const prefab = document.prefabs.find((candidate) => candidate.id === prefabId);\n if (prefab === undefined) throw new Error(`Prefab '${prefabId}' does not exist in the project document.`);\n const width = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.x) + Math.max(0, node.transform.width)));\n const height = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.y) + Math.max(0, node.transform.height)));\n const instanceId = configuration.instanceId ?? createStableId();\n const instance: Extract<UINode, { type: \"prefab-instance\" }> = {\n id: instanceId, name: prefab.name, type: \"prefab-instance\", prefabId, parentId: null, children: [],\n visible: true, transform: { x: 0, y: 0, width, height, scaleX: 1, scaleY: 1, rotation: 0, anchorMinX: 0, anchorMaxX: 0, anchorMinY: 0, anchorMaxY: 0, pivotX: 0, pivotY: 0 },\n ...(configuration.propertyOverrides === undefined ? {} : { propertyOverrides: structuredClone(configuration.propertyOverrides) }),\n ...(configuration.locallyAddedNodes === undefined ? {} : { locallyAddedNodes: structuredClone(configuration.locallyAddedNodes) }),\n };\n const sceneId = createStableId();\n const viewport = { width, height };\n const scene: Scene = { id: sceneId, name: prefab.name, rootNodeIds: [instance.id], nodes: [instance], layout: { referenceViewports: { desktop: viewport, mobile: viewport }, preferredViewports: { desktop: viewport, mobile: viewport } } };\n return { document: { ...document, scenes: [...document.scenes, scene] }, sceneId, instanceId };\n}\n\n/** Builds a fresh runtime prefab instance without requiring it to already exist in a scene. */\nexport function buildPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, options: BuildSceneViewOptions, configuration: PrefabViewConfiguration = {}): SceneViewResult & { instanceId: string } {\n const synthetic = prefabScene(document, prefabId, configuration);\n return { ...buildSceneView(synthetic.document, synthetic.sceneId, profile, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\n}\n\n/** Loads a prefab's assets and returns a fresh display tree suitable for dynamic game-code spawning. */\nexport async function loadPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, resolveFileUrl: FileUrlResolver, options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; assetCache?: SceneAssetCache }, configuration: PrefabViewConfiguration = {}): Promise<SceneViewResult & { instanceId: string }> {\n const synthetic = prefabScene(document, prefabId, configuration);\n return { ...await loadSceneView(synthetic.document, synthetic.sceneId, profile, resolveFileUrl, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\n}\n\n/** Loads a scene's textures and Spine data, then builds its display tree in one call. */\nexport async function loadSceneView(\n document: ProjectDocument,\n sceneId: string,\n profile: LayoutProfileId,\n resolveFileUrl: FileUrlResolver,\n options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; clipToViewport?: boolean; assetCache?: SceneAssetCache },\n): Promise<SceneViewResult> {\n // Без assetCache каждый вызов начинает с пустых кэшей: для одиночной загрузки сцены это нормально, а вот\n // игровой код, который поднимает пресеты по одному, обязан передать собственный кэш — иначе один и тот же\n // скелет, атлас и текстура парсятся заново на каждую вьюху и дублируются в видеопамяти.\n const cache = options.assetCache;\n const [textures, spines, fonts, bitmapFonts] = await Promise.all([\n loadSceneTextures(document, sceneId, (asset) => (asset.type === \"image\" ? resolveFileUrl(asset.source.uri) : undefined), resolveFileUrl, cache?.textures, cache?.spritesheets, cache?.bitmapFonts),\n loadSceneSpines(document, sceneId, resolveFileUrl, cache?.spines),\n loadSceneFonts(document, sceneId, resolveFileUrl, cache?.fonts),\n loadSceneBitmapFonts(document, sceneId, resolveFileUrl, cache?.bitmapFonts),\n ]);\n return buildSceneView(document, sceneId, profile, { interaction: options.interaction, textures, spines, fonts, bitmapFonts, ticker: options.ticker, localization: options.localization, clipToViewport: options.clipToViewport });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,qBAAqB,EAAiJ,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,aAAa,CAAC;AACvI,OAAO,EAAE,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,eA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,KAAK,UAAU,aAAa,CACjC,QAAyB,EACzB,OAAe,EACf,OAAwB,EACxB,cAA+B,EAC/B,OAAgK;IAEhK,yGAAyG;IACzG,0GAA0G;IAC1G,wFAAwF;IACxF,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;IACjC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/D,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC;QAClM,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC;QACjE,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,CAAC;QAC/D,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC;KAC5E,CAAC,CAAC;IACH,OAAO,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AACpO,CAAC","sourcesContent":["import { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\nimport { createStableId, isLayoutGroup, isParticleEffect, resolveLayoutGroupSettings, resolveOwnerNodeGraph, type EffectDefinition, type GridLayoutSettings, type LayoutProfileId, type ProjectDocument, type Scene, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\nimport { Container, Texture, type Ticker } from \"pixi.js\";\nimport { loadSceneSpines } from \"./assets/spine.js\";\nimport { loadSceneTextures, type FileUrlResolver } from \"./assets/textures.js\";\nimport { loadSceneFonts } from \"./assets/fonts.js\";\nimport { loadSceneBitmapFonts } from \"./assets/bitmapFonts.js\";\nimport type { SceneAssetCache } from \"./assets/cache.js\";\nimport { getCanvasLogicalSize, getCanvasScale, resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\nimport { NodeView, type SceneInteractionMode } from \"./views/NodeView.js\";\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\nimport { createNodeView } from \"./views/createNodeView.js\";\nimport { applyLayoutGroup, applyLayoutItem, createGridLineBreak, initializePixiLayout, LayoutItemContainer } from \"./layoutGroups.js\";\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\nimport { PageItemContainer } from \"./pageGroup.js\";\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\nimport { PaginationNodeView, type PaginationArrow } from \"./views/PaginationNodeView.js\";\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\nimport { ScrollItemContainer } from \"./scrollView.js\";\nimport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\nimport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\nimport { SceneLocalization, type SceneLocalizationOptions } from \"./localization.js\";\nimport { SceneViewport } from \"./SceneViewport.js\";\nimport type { Sound } from \"@pixi/sound\";\n\nexport type BuildSceneViewOptions = {\n /** Explicit: an editor canvas must pass \"authoring\", Preview and the consuming app \"runtime\". */\n interaction: SceneInteractionMode;\n textures?: ReadonlyMap<string, Texture>;\n spines?: ReadonlyMap<string, SkeletonData>;\n fonts?: ReadonlyMap<string, string>;\n bitmapFonts?: ReadonlyMap<string, string>;\n sounds?: ReadonlyMap<string, Sound>;\n /**\n * The host's own Application ticker, driving self-updating content such as Spine skeletons.\n * Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the\n * renderer that draws them — see the same rule as `updateParticleEmitters`.\n */\n ticker?: Ticker;\n /** Called after Yoga changes a managed rectangle; authoring hosts use it to refresh overlays. */\n onLayout?: () => void;\n /**\n * Начальное состояние локализации. Опция необязательна: при наличии `Text.textKey` base locale\n * каталога применяется и без неё, а документ без ключей выглядит ровно как раньше.\n */\n localization?: SceneLocalizationOptions;\n /** Internal host boundary override: prefab views are spawnable content, not screen viewports. */\n clipToViewport?: boolean;\n};\n\nexport type SceneViewResult = { root: SceneViewport; nodeViews: Map<string, Container>; localization: SceneLocalization };\nconst particleEmitterRegistry = new WeakMap<Container, readonly ParticleEmitterNodeView[]>();\n\nfunction spineReferenceFrameFor(document: ProjectDocument, node: UINode): SpineReferenceFrame | undefined {\n if (node.type !== \"spine\") return undefined;\n const asset = document.assets.find((candidate) => candidate.id === node.assetId);\n return asset?.type === \"spine\" ? asset.referenceFrame : undefined;\n}\n\n/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */\nexport function buildSceneView(\n document: ProjectDocument,\n sceneId: string,\n profile: LayoutProfileId,\n options: BuildSceneViewOptions,\n): SceneViewResult {\n initializePixiLayout();\n const { interaction, textures, spines, fonts, bitmapFonts, sounds, ticker, onLayout } = options;\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\n\n if (scene === undefined) {\n throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\n }\n\n const nodeViews = new Map<string, Container>();\n const particleEmitters: ParticleEmitterNodeView[] = [];\n\n // Materialized prefab children use instance-scoped IDs, so authoring and runtime can address\n // multiple instances independently without changing canonical definition IDs.\n const screenSize = scene.layout.referenceViewports[profile];\n const referenceResolution = scene.layout.preferredViewports[profile];\n const canvasScale = getCanvasScale(screenSize, referenceResolution);\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\n\n // Единый резолвер иерархии: тот же граф, что видит редактор, включая вложенные пресеты.\n const owner = resolveOwnerNodeGraph(document, scene);\n const prefabIds = new Set(document.prefabs.map((prefab) => prefab.id));\n\n const buildOwner = (rootSize: LayoutSize): Container => {\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\n\n const buildNode = (nodeId: string, parentSize: LayoutSize): NodeView => {\n const node = nodesById.get(nodeId);\n\n if (node === undefined) {\n throw new Error(`Scene '${sceneId}' references missing node '${nodeId}'.`);\n }\n\n const resolved = resolveProfileTransform(node, profile);\n const transform = resolveAnchoredTransform(resolved.transform, parentSize);\n const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sounds, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\n // Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.\n view.update(node, profile, parentSize);\n nodeViews.set(node.id, view);\n if (view instanceof ParticleEmitterNodeView) particleEmitters.push(view);\n\n // Прямые дети корня сцены разрешают якоря относительно логического Canvas, а не размера корня.\n // Прямой ребёнок grid-layout (сам `node` здесь) не владеет своим отрисованным размером: Unity-подобная\n // фиксированная ячейка полностью переопределяет authored transform (см. applyLayoutItem). Его\n // собственным потомкам нужен именно cellWidth/cellHeight, а не anchor-resolved authored-размер —\n // иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.\n const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);\n const gridCell = gridParent?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(gridParent, profile) : undefined;\n // Та же логика для прямого ребёнка page-group (страницы): `PageItemContainer`/`updateManaged`\n // растягивают её на весь resolved rectangle группы независимо от собственных anchors ноды\n // (см. NodeView.applyResolvedTransform, managedByLayout). Здесь `node` — сама страница, поэтому\n // это переопределённый размер, который она фактически получит, — `parentSize`, уже разрешённый\n // как rectangle page-group. Без этой ветки дети страницы якорились бы относительно её\n // anchor-resolved authored-размера, который может расходиться с фактическим rectangle группы,\n // особенно в другом layout-профиле.\n const childSize = node.parentId === null\n ? rootSize\n : gridCell !== undefined\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\n : gridParent?.type === \"page-group\"\n ? parentSize\n : { width: transform.width, height: transform.height };\n for (const [childIndex, childId] of node.children.entries()) {\n const childNode = nodesById.get(childId);\n const childView = buildNode(childId, childSize);\n if (isLayoutGroup(node) && childNode !== undefined && view instanceof LayoutGroupNodeView) {\n const layoutItem = new LayoutItemContainer(childView, onLayout);\n applyLayoutItem(layoutItem, childNode, node, profile);\n view.addLayoutChild(layoutItem);\n } else if (node.type === \"scroll-view\" && childNode !== undefined && view instanceof ScrollViewNodeView) {\n const scrollItem = new ScrollItemContainer(childView, onLayout);\n // Как и у layout-item: собственный (не растянутый якорями) размер ребёнка — List не\n // предоставляет per-item override размера, в отличие от Yoga flexGrow/cellSize.\n const own = resolveProfileTransform(childNode, profile).transform;\n scrollItem.sync(childNode, profile, { width: own.width, height: own.height });\n view.addScrollItem(scrollItem);\n } else if (node.type === \"page-group\" && childNode !== undefined && view instanceof PageGroupNodeView) {\n // Unlike a scroll-view item, a page fills the group's own resolved rect completely\n // (`childSize`, computed above): a page is a full sub-screen, not content sized to itself.\n const pageItem = new PageItemContainer(childView);\n pageItem.sync(childNode, profile, childSize);\n view.addPageItem(pageItem);\n } else {\n view.addChild(childView);\n }\n if (node.type === \"grid-layout\") {\n const settings = node.layoutGroup.overrides?.[profile] === undefined ? node.layoutGroup.base : { ...node.layoutGroup.base, ...node.layoutGroup.overrides[profile] };\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\n const lineBreak = createGridLineBreak(node, profile);\n if (lineBreak !== undefined && view instanceof LayoutGroupNodeView) view.addLayoutChild(lineBreak);\n }\n }\n }\n\n return view;\n };\n\n const ownerRoot = new Container();\n for (const rootNodeId of owner.rootNodeIds) {\n ownerRoot.addChild(buildNode(rootNodeId, rootSize));\n }\n\n return ownerRoot;\n };\n\n const canvasRoot = buildOwner(canvasSize);\n canvasRoot.scale.set(canvasScale);\n const hostRoot = new SceneViewport(canvasRoot, screenSize, options.clipToViewport ?? interaction === \"runtime\");\n particleEmitterRegistry.set(hostRoot, particleEmitters);\n // Контроллер применяет переводы сразу к уже созданным views, поэтому keyed Text показывает\n // базовую локаль без единого дополнительного вызова со стороны хоста.\n const localization = new SceneLocalization(document, scene, nodeViews, options.localization);\n wireCheckboxGroups(owner.nodes, nodeViews);\n wireSpineConnectors(owner.nodes, nodeViews);\n wireNodeReferences(owner.nodes, nodeViews, interaction);\n return { root: hostRoot, nodeViews, localization };\n}\n\nfunction wireSpineConnectors(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\n for (const node of nodes) {\n if (node.type !== \"spine\") continue;\n const view = nodeViews.get(node.id);\n if (!(view instanceof SpineNodeView)) continue;\n view.setConnectorBones((node.connectors ?? []).flatMap((connector) => {\n const target = nodeViews.get(connector.targetNodeId);\n return target === undefined ? [] : [{ ...connector, target }];\n }));\n }\n}\n\n/**\n * Разрешает все ссылки «нода → нода» в живые views: элементы item table и кнопки-стрелки пагинатора.\n * Та же форма, что у `wireSpineConnectors`: документ хранит id, а во что он превратился, знает только\n * собранная сцена, поэтому сами виды никогда не резолвят id. Один проход на все виды ссылок, чтобы\n * следующая не завела собственный обход с чуть другой областью видимости.\n *\n * Стрелки подключаются только в runtime-сцене: на authoring-канвасе контрол инертен, как и клик по\n * самой точке пагинатора. Вместимость таблицы, наоборот, видна и в редакторе — это не интерактивность.\n */\nfunction wireNodeReferences(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>, interaction: SceneInteractionMode): void {\n const arrowView = (nodeId: string | undefined): PaginationArrow | undefined => {\n const view = nodeId === undefined ? undefined : nodeViews.get(nodeId);\n return view instanceof ButtonNodeView || view instanceof StagedButtonNodeView ? view : undefined;\n };\n for (const node of nodes) {\n const view = nodeViews.get(node.id);\n if (node.type === \"item-table\" && view instanceof ItemTableNodeView) {\n view.setItems((node.items ?? []).map((itemId) => nodeViews.get(itemId)));\n } else if (node.type === \"pagination\" && view instanceof PaginationNodeView && interaction === \"runtime\") {\n view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });\n } else if (node.type === \"page-group\" && view instanceof PageGroupNodeView && interaction === \"runtime\") {\n view.setArrows({ up: arrowView(node.pageUpButtonNodeId), down: arrowView(node.pageDownButtonNodeId) });\n }\n }\n}\n\n/**\n * Authored `group` gives sibling checkboxes radio-button behavior: checking one force-unchecks its\n * live group-mates (same `parentId`, same `group`), without touching the document. Runs once per\n * scene build; `CheckboxNodeView.forceCheck` never re-emits `onCheck`, so this can't recurse.\n */\nfunction wireCheckboxGroups(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\n const byGroup = new Map<string, CheckboxNodeView[]>();\n for (const node of nodes) {\n if (node.type !== \"checkbox\" || node.group === undefined) continue;\n const view = nodeViews.get(node.id);\n if (!(view instanceof CheckboxNodeView)) continue;\n const key = `${node.parentId ?? \"\"}::${node.group}`;\n const group = byGroup.get(key) ?? [];\n group.push(view);\n byGroup.set(key, group);\n }\n for (const group of byGroup.values()) {\n if (group.length < 2) continue;\n for (const view of group) {\n view.onCheck.connect((checked) => {\n if (!checked) return;\n for (const other of group) if (other !== view) other.forceCheck(false);\n });\n }\n }\n}\n\n/**\n * Applies a node's resolved transform, visibility, and content to an existing display object,\n * so editors can update views in place without rebuilding the scene tree.\n */\nexport function updateNodeView(view: Container, node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize, parentNode?: UINode, effect?: EffectDefinition, spineReferenceFrame?: SpineReferenceFrame): void {\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\n if (!(view instanceof NodeView)) return;\n if (view instanceof SpineNodeView) view.setReferenceFrame(spineReferenceFrame);\n if (node.type === \"particle-emitter\" && effect !== undefined && isParticleEffect(effect) && \"syncEffect\" in view && typeof (view as { syncEffect?: unknown }).syncEffect === \"function\") (view as { syncEffect(effect: import(\"@pixi-ui-editor/schema\").ParticleEffectDefinition): void }).syncEffect(effect);\n if (parentNode !== undefined && isLayoutGroup(parentNode) && view.parent instanceof LayoutItemContainer) {\n applyLayoutItem(view.parent, node, parentNode, profile);\n } else if (parentNode !== undefined && parentNode.type === \"scroll-view\" && view.parent instanceof ScrollItemContainer) {\n const own = resolveProfileTransform(node, profile).transform;\n view.parent.sync(node, profile, { width: own.width, height: own.height });\n } else if (parentNode !== undefined && parentNode.type === \"page-group\" && view.parent instanceof PageItemContainer && parentSize !== undefined) {\n // A page is position-managed exactly like a layout/scroll item: it fills the group's own rectangle\n // (`parentSize`, the same value `buildSceneView` passes as `childSize`). Without this branch an\n // in-place update fell through to `view.update` and handed the page back its authored x/y and\n // anchors, so editing anything inside a page group knocked its pages out of place.\n view.parent.sync(node, profile, parentSize);\n } else {\n view.update(node, profile, parentSize);\n }\n}\n\n/** Previews a resolved editor rectangle without consulting content bounds or rebuilding the view. */\nexport function previewNodeView(view: Container, node: UINode, profile: LayoutProfileId, transform: UINode[\"transform\"]): void {\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, undefined, { width: transform.width, height: transform.height });\n if (view instanceof NodeView) view.preview(node, transform, resolveProfileTransform(node, profile).visible, profile);\n}\n\n/** Hosts call this from their own Application ticker; runtime never subscribes to Ticker.shared. */\nexport function updateParticleEmitters(root: Container, deltaSeconds: number): void {\n const registered = particleEmitterRegistry.get(root);\n if (registered !== undefined) {\n for (const emitter of registered) emitter.updateParticles(deltaSeconds);\n return;\n }\n // Backward-compatible fallback for hosts that assemble a display tree manually instead of using\n // buildSceneView. Built scenes always take the O(emitter count) registry path above.\n const visit = (view: Container): void => {\n if (view instanceof ParticleEmitterNodeView) view.updateParticles(deltaSeconds);\n for (const child of view.children) visit(child);\n };\n visit(root);\n}\n\n/** Lists the nodes a scene renders, including nodes of prefab definitions its prefab instances expand to. */\nexport function collectRenderedNodes(document: ProjectDocument, scene: Scene): UINode[] {\n return resolveOwnerNodeGraph(document, scene).nodes;\n}\n\nexport type PrefabViewConfiguration = Pick<Extract<UINode, { type: \"prefab-instance\" }>, \"propertyOverrides\" | \"locallyAddedNodes\"> & { instanceId?: string };\n\nfunction prefabScene(document: ProjectDocument, prefabId: string, configuration: PrefabViewConfiguration = {}): { document: ProjectDocument; sceneId: string; instanceId: string } {\n const prefab = document.prefabs.find((candidate) => candidate.id === prefabId);\n if (prefab === undefined) throw new Error(`Prefab '${prefabId}' does not exist in the project document.`);\n const width = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.x) + Math.max(0, node.transform.width)));\n const height = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.y) + Math.max(0, node.transform.height)));\n const instanceId = configuration.instanceId ?? createStableId();\n const instance: Extract<UINode, { type: \"prefab-instance\" }> = {\n id: instanceId, name: prefab.name, type: \"prefab-instance\", prefabId, parentId: null, children: [],\n visible: true, transform: { x: 0, y: 0, width, height, scaleX: 1, scaleY: 1, rotation: 0, anchorMinX: 0, anchorMaxX: 0, anchorMinY: 0, anchorMaxY: 0, pivotX: 0, pivotY: 0 },\n ...(configuration.propertyOverrides === undefined ? {} : { propertyOverrides: structuredClone(configuration.propertyOverrides) }),\n ...(configuration.locallyAddedNodes === undefined ? {} : { locallyAddedNodes: structuredClone(configuration.locallyAddedNodes) }),\n };\n const sceneId = createStableId();\n const viewport = { width, height };\n const scene: Scene = { id: sceneId, name: prefab.name, rootNodeIds: [instance.id], nodes: [instance], layout: { referenceViewports: { desktop: viewport, mobile: viewport }, preferredViewports: { desktop: viewport, mobile: viewport } } };\n return { document: { ...document, scenes: [...document.scenes, scene] }, sceneId, instanceId };\n}\n\n/** Builds a fresh runtime prefab instance without requiring it to already exist in a scene. */\nexport function buildPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, options: BuildSceneViewOptions, configuration: PrefabViewConfiguration = {}): SceneViewResult & { instanceId: string } {\n const synthetic = prefabScene(document, prefabId, configuration);\n return { ...buildSceneView(synthetic.document, synthetic.sceneId, profile, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\n}\n\n/** Loads a prefab's assets and returns a fresh display tree suitable for dynamic game-code spawning. */\nexport async function loadPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, resolveFileUrl: FileUrlResolver, options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; assetCache?: SceneAssetCache }, configuration: PrefabViewConfiguration = {}): Promise<SceneViewResult & { instanceId: string }> {\n const synthetic = prefabScene(document, prefabId, configuration);\n return { ...await loadSceneView(synthetic.document, synthetic.sceneId, profile, resolveFileUrl, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\n}\n\n/** Loads a scene's textures and Spine data, then builds its display tree in one call. */\nexport async function loadSceneView(\n document: ProjectDocument,\n sceneId: string,\n profile: LayoutProfileId,\n resolveFileUrl: FileUrlResolver,\n options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; clipToViewport?: boolean; assetCache?: SceneAssetCache },\n): Promise<SceneViewResult> {\n // Без assetCache каждый вызов начинает с пустых кэшей: для одиночной загрузки сцены это нормально, а вот\n // игровой код, который поднимает пресеты по одному, обязан передать собственный кэш — иначе один и тот же\n // скелет, атлас и текстура парсятся заново на каждую вьюху и дублируются в видеопамяти.\n const cache = options.assetCache;\n const [textures, spines, fonts, bitmapFonts] = await Promise.all([\n loadSceneTextures(document, sceneId, (asset) => (asset.type === \"image\" ? resolveFileUrl(asset.source.uri) : undefined), resolveFileUrl, cache?.textures, cache?.spritesheets, cache?.bitmapFonts),\n loadSceneSpines(document, sceneId, resolveFileUrl, cache?.spines),\n loadSceneFonts(document, sceneId, resolveFileUrl, cache?.fonts),\n loadSceneBitmapFonts(document, sceneId, resolveFileUrl, cache?.bitmapFonts),\n ]);\n return buildSceneView(document, sceneId, profile, { interaction: options.interaction, textures, spines, fonts, bitmapFonts, ticker: options.ticker, localization: options.localization, clipToViewport: options.clipToViewport });\n}\n"]}
|
|
@@ -32,6 +32,7 @@ export declare class ButtonNodeView extends NodeView {
|
|
|
32
32
|
*/
|
|
33
33
|
private static paintPlaceholder;
|
|
34
34
|
private static createStateView;
|
|
35
|
+
private static applyStateAppearance;
|
|
35
36
|
/**
|
|
36
37
|
* (Re)builds `FancyButton` and its four state views. `FancyButton` has no API to replace a view
|
|
37
38
|
* after construction, so any change to a view's *type* — nine-slice toggled, or an asset
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonNodeView.d.ts","sourceRoot":"","sources":["../../src/views/ButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAgD,OAAO,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAK7D;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA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AW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAQvJ;IAED;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B,OAAO,CAAC,MAAM,CAAC,eAAe;IAW9B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAKnC;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;IA+BnB,uGAAuG;IACvG,OAAO,CAAC,YAAY;IAMpB,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAmDxE;IAED,2FAA2F;IAC3F,gBAAgB,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAS/C;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;IAED,IAAI,KAAK,IAAI,cAAc,CAE1B;IAED,mGAAmG;IACnG,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAEpC;IAED,IAAI,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,CAAgC;IACrE,IAAI,MAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,CAA+B;IAClE,IAAI,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,CAA6B;IAC5D,IAAI,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,CAAgC;IACrE,IAAI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,CAA8B;CAChE"}
|
|
@@ -49,6 +49,10 @@ export class ButtonNodeView extends NodeView {
|
|
|
49
49
|
? new Sprite(texture)
|
|
50
50
|
: new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });
|
|
51
51
|
}
|
|
52
|
+
static applyStateAppearance(view, node, state) {
|
|
53
|
+
view.tint = node.states[`${state}Tint`] ?? "#ffffff";
|
|
54
|
+
view.alpha = node.states[`${state}Opacity`] ?? 1;
|
|
55
|
+
}
|
|
52
56
|
/**
|
|
53
57
|
* (Re)builds `FancyButton` and its four state views. `FancyButton` has no API to replace a view
|
|
54
58
|
* after construction, so any change to a view's *type* — nine-slice toggled, or an asset
|
|
@@ -66,6 +70,7 @@ export class ButtonNodeView extends NodeView {
|
|
|
66
70
|
const viewFor = (state, assetId) => {
|
|
67
71
|
const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;
|
|
68
72
|
const view = ButtonNodeView.createStateView(texture, nineSlice, resolvedSize);
|
|
73
|
+
ButtonNodeView.applyStateAppearance(view, node, state);
|
|
69
74
|
stateViews[state] = view;
|
|
70
75
|
return view;
|
|
71
76
|
};
|
|
@@ -149,6 +154,7 @@ export class ButtonNodeView extends NodeView {
|
|
|
149
154
|
else if (view instanceof Graphics) {
|
|
150
155
|
ButtonNodeView.paintPlaceholder(view, transform.width, transform.height);
|
|
151
156
|
}
|
|
157
|
+
ButtonNodeView.applyStateAppearance(view, node, state);
|
|
152
158
|
}
|
|
153
159
|
}
|
|
154
160
|
// Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonNodeView.js","sourceRoot":"","sources":["../../src/views/ButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwD,MAAM,wBAAwB,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAW,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAIpE,MAAM,kBAAkB,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,E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AAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO,CAAC,KAAc;QACxB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,mGAAmG;IACnG,QAAQ,CAAC,KAAqB;QAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,MAAM,KAA4B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,IAAI,IAAI,KAA0B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,KAA2B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAChE","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { FancyButton } from \"@pixi/ui\";\r\nimport type { Sound } from \"@pixi/sound\";\r\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type ButtonNode = Extract<UINode, { type: \"button\" }>;\r\n\r\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\nconst KEY_BY_FANCY_STATE = { default: \"normal\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\n\r\n/**\r\n * Adapts a button node to `@pixi/ui`'s `FancyButton`, which owns the pointer state machine —\r\n * this class never reimplements it. Optional states fall back to the normal image, and runtime\r\n * changes to `enabled` or the current state stay in the view: they never touch the document.\r\n *\r\n * `nineSlice`, when set, applies the same borders to all four state views (`NineSliceSprite`\r\n * instead of `Sprite`) — the button's frame shape is normally the same regardless of which state\r\n * image is currently shown.\r\n */\r\nexport class ButtonNodeView extends NodeView {\r\n private button!: FancyButton;\r\n private stateViews!: Record<ButtonStateKey, Container>;\r\n private readonly interaction: SceneInteractionMode;\r\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\r\n private soundAssetIds: ButtonNode[\"sounds\"];\r\n private enabledState: boolean;\r\n\r\n constructor(node: ButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\r\n super(textures);\r\n this.interaction = interaction;\r\n this.sounds = sounds;\r\n this.soundAssetIds = node.sounds;\r\n this.enabledState = node.enabled;\r\n this.buildButton(node);\r\n this.applyEnabled(node.enabled);\r\n }\r\n\r\n /**\r\n * Invisible (alpha 0) but still hit-testable: Pixi's `containsPoint` hit-tests the fill's geometry\r\n * regardless of its alpha. Painted with a real size *before* the view ever reaches `FancyButton`:\r\n * `FancyButton` reads `defaultView`'s bounds exactly once, synchronously during construction, to\r\n * freeze its own `hitArea` — it never re-reads them afterwards. A `Graphics` still at its default\r\n * (0, 0) size at that moment would freeze a zero-size, permanently unclickable hit area.\r\n */\r\n private static paintPlaceholder(graphics: Graphics, width: number, height: number): void {\r\n graphics.clear().rect(0, 0, width, height).fill({ color: 0x000000, alpha: 0 });\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined, size: { width: number; height: number }): Container {\r\n if (texture === undefined) {\r\n const graphics = new Graphics();\r\n ButtonNodeView.paintPlaceholder(graphics, size.width, size.height);\r\n return graphics;\r\n }\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 /**\r\n * (Re)builds `FancyButton` and its four state views. `FancyButton` has no API to replace a view\r\n * after construction, so any change to a view's *type* — nine-slice toggled, or an asset\r\n * finishing an async load — goes through here instead of `syncContent`'s cheap in-place path.\r\n *\r\n * `size` is the best size known *right now*: the resolved layout rectangle when called from\r\n * `syncContent`, or the authored transform when called from the constructor (before any layout\r\n * pass has run). Only feeds the initial placeholder paint above — see its doc comment for why.\r\n */\r\n private buildButton(node: ButtonNode, size?: { width: number; height: number }): void {\r\n const nineSlice = node.nineSlice;\r\n const resolvedSize = size ?? { width: node.transform.width, height: node.transform.height };\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n const stateViews = {} as Record<ButtonStateKey, Container>;\r\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n const view = ButtonNodeView.createStateView(texture, nineSlice, resolvedSize);\r\n stateViews[state] = view;\r\n return view;\r\n };\r\n\r\n const button = new FancyButton({\r\n defaultView: viewFor(\"normal\", node.states.normalAssetId),\r\n hoverView: viewFor(\"hover\", node.states.hoverAssetId),\r\n pressedView: viewFor(\"pressed\", node.states.pressedAssetId),\r\n disabledView: viewFor(\"disabled\", node.states.disabledAssetId),\r\n });\r\n // Authoring-сцена инертна: FancyButton уже включил себе eventMode \"static\", снимаем его до applyEnabled.\r\n // Выделение и drag при этом не страдают: попадание ловит hitArea базового NodeView, а не это поддерево.\r\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\r\n else if (this.sounds !== undefined) {\r\n button.onPress.connect(() => { const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n button.onHover.connect(() => { const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n }\r\n this.button = button;\r\n this.stateViews = stateViews;\r\n this.setContent(button);\r\n }\r\n\r\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\r\n private applyEnabled(enabled: boolean): void {\r\n this.enabledState = enabled;\r\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\r\n else this.button.setState(enabled ? \"default\" : \"disabled\");\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"button\") return;\r\n this.soundAssetIds = node.sounds;\r\n const nineSlice = node.nineSlice;\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n\r\n // A state view's required *type* (Graphics/Sprite/NineSliceSprite) may no longer match what's\r\n // needed — nine-slice toggled, or a texture finished loading after this view had to fall back\r\n // to Graphics. FancyButton can't swap a view after construction, so that goes through a full\r\n // rebuild; everything else (texture identity, border values, size) updates the live views in\r\n // place, which is the path a nine-slice gizmo drag runs every frame.\r\n let needsRebuild = false;\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n const view = this.stateViews[state];\r\n const wantsNineSlice = texture !== undefined && nineSlice !== undefined;\r\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite && !(view instanceof NineSliceSprite);\r\n if (!matches) { needsRebuild = true; break; }\r\n }\r\n\r\n if (needsRebuild) {\r\n this.buildButton(node, transform);\r\n } else {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\r\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\r\n if (view instanceof NineSliceSprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n if (nineSlice !== undefined) {\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Sprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Graphics) {\r\n ButtonNodeView.paintPlaceholder(view, transform.width, transform.height);\r\n }\r\n }\r\n }\r\n\r\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\r\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\r\n }\r\n\r\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n if (!(view instanceof NineSliceSprite)) continue;\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n }\r\n\r\n get enabled(): boolean {\r\n return this.enabledState;\r\n }\r\n\r\n set enabled(value: boolean) {\r\n this.applyEnabled(value);\r\n }\r\n\r\n get state(): ButtonStateKey {\r\n return KEY_BY_FANCY_STATE[this.button.state];\r\n }\r\n\r\n /** Forces a visual state without changing `enabled`, so a disabled button still emits no press. */\r\n setState(state: ButtonStateKey): void {\r\n this.button.setState(FANCY_STATE_BY_KEY[state]);\r\n }\r\n\r\n get onPress(): FancyButton[\"onPress\"] { return this.button.onPress; }\r\n get onDown(): FancyButton[\"onDown\"] { return this.button.onDown; }\r\n get onUp(): FancyButton[\"onUp\"] { return this.button.onUp; }\r\n get onHover(): FancyButton[\"onHover\"] { return this.button.onHover; }\r\n get onOut(): FancyButton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C,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,MAAM,KAA4B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,IAAI,IAAI,KAA0B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,KAA2B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAChE","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { FancyButton } from \"@pixi/ui\";\r\nimport type { Sound } from \"@pixi/sound\";\r\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type ButtonNode = Extract<UINode, { type: \"button\" }>;\r\n\r\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\nconst KEY_BY_FANCY_STATE = { default: \"normal\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\n\r\n/**\r\n * Adapts a button node to `@pixi/ui`'s `FancyButton`, which owns the pointer state machine —\r\n * this class never reimplements it. Optional states fall back to the normal image, and runtime\r\n * changes to `enabled` or the current state stay in the view: they never touch the document.\r\n *\r\n * `nineSlice`, when set, applies the same borders to all four state views (`NineSliceSprite`\r\n * instead of `Sprite`) — the button's frame shape is normally the same regardless of which state\r\n * image is currently shown.\r\n */\r\nexport class ButtonNodeView extends NodeView {\r\n private button!: FancyButton;\r\n private stateViews!: Record<ButtonStateKey, Container>;\r\n private readonly interaction: SceneInteractionMode;\r\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\r\n private soundAssetIds: ButtonNode[\"sounds\"];\r\n private enabledState: boolean;\r\n\r\n constructor(node: ButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\r\n super(textures);\r\n this.interaction = interaction;\r\n this.sounds = sounds;\r\n this.soundAssetIds = node.sounds;\r\n this.enabledState = node.enabled;\r\n this.buildButton(node);\r\n this.applyEnabled(node.enabled);\r\n }\r\n\r\n /**\r\n * Invisible (alpha 0) but still hit-testable: Pixi's `containsPoint` hit-tests the fill's geometry\r\n * regardless of its alpha. Painted with a real size *before* the view ever reaches `FancyButton`:\r\n * `FancyButton` reads `defaultView`'s bounds exactly once, synchronously during construction, to\r\n * freeze its own `hitArea` — it never re-reads them afterwards. A `Graphics` still at its default\r\n * (0, 0) size at that moment would freeze a zero-size, permanently unclickable hit area.\r\n */\r\n private static paintPlaceholder(graphics: Graphics, width: number, height: number): void {\r\n graphics.clear().rect(0, 0, width, height).fill({ color: 0x000000, alpha: 0 });\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined, size: { width: number; height: number }): Container {\n if (texture === undefined) {\r\n const graphics = new Graphics();\r\n ButtonNodeView.paintPlaceholder(graphics, size.width, size.height);\r\n return graphics;\r\n }\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 }\n\n private static applyStateAppearance(view: Container, node: ButtonNode, state: ButtonStateKey): void {\n view.tint = node.states[`${state}Tint`] ?? \"#ffffff\";\n view.alpha = node.states[`${state}Opacity`] ?? 1;\n }\n\r\n /**\r\n * (Re)builds `FancyButton` and its four state views. `FancyButton` has no API to replace a view\r\n * after construction, so any change to a view's *type* — nine-slice toggled, or an asset\r\n * finishing an async load — goes through here instead of `syncContent`'s cheap in-place path.\r\n *\r\n * `size` is the best size known *right now*: the resolved layout rectangle when called from\r\n * `syncContent`, or the authored transform when called from the constructor (before any layout\r\n * pass has run). Only feeds the initial placeholder paint above — see its doc comment for why.\r\n */\r\n private buildButton(node: ButtonNode, size?: { width: number; height: number }): void {\r\n const nineSlice = node.nineSlice;\r\n const resolvedSize = size ?? { width: node.transform.width, height: node.transform.height };\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n const stateViews = {} as Record<ButtonStateKey, Container>;\r\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = ButtonNodeView.createStateView(texture, nineSlice, resolvedSize);\n ButtonNodeView.applyStateAppearance(view, node, state);\n stateViews[state] = view;\r\n return view;\r\n };\r\n\r\n const button = new FancyButton({\r\n defaultView: viewFor(\"normal\", node.states.normalAssetId),\r\n hoverView: viewFor(\"hover\", node.states.hoverAssetId),\r\n pressedView: viewFor(\"pressed\", node.states.pressedAssetId),\r\n disabledView: viewFor(\"disabled\", node.states.disabledAssetId),\r\n });\r\n // Authoring-сцена инертна: FancyButton уже включил себе eventMode \"static\", снимаем его до applyEnabled.\r\n // Выделение и drag при этом не страдают: попадание ловит hitArea базового NodeView, а не это поддерево.\r\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\r\n else if (this.sounds !== undefined) {\r\n button.onPress.connect(() => { const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n button.onHover.connect(() => { const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n }\r\n this.button = button;\r\n this.stateViews = stateViews;\r\n this.setContent(button);\r\n }\r\n\r\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\r\n private applyEnabled(enabled: boolean): void {\r\n this.enabledState = enabled;\r\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\r\n else this.button.setState(enabled ? \"default\" : \"disabled\");\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"button\") return;\r\n this.soundAssetIds = node.sounds;\r\n const nineSlice = node.nineSlice;\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n\r\n // A state view's required *type* (Graphics/Sprite/NineSliceSprite) may no longer match what's\r\n // needed — nine-slice toggled, or a texture finished loading after this view had to fall back\r\n // to Graphics. FancyButton can't swap a view after construction, so that goes through a full\r\n // rebuild; everything else (texture identity, border values, size) updates the live views in\r\n // place, which is the path a nine-slice gizmo drag runs every frame.\r\n let needsRebuild = false;\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n const view = this.stateViews[state];\r\n const wantsNineSlice = texture !== undefined && nineSlice !== undefined;\r\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite && !(view instanceof NineSliceSprite);\r\n if (!matches) { needsRebuild = true; break; }\r\n }\r\n\r\n if (needsRebuild) {\r\n this.buildButton(node, transform);\r\n } else {\r\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\r\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\r\n if (view instanceof NineSliceSprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n if (nineSlice !== undefined) {\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Sprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Graphics) {\n ButtonNodeView.paintPlaceholder(view, transform.width, transform.height);\n }\n ButtonNodeView.applyStateAppearance(view, node, state);\n }\n }\r\n\r\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\r\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\r\n }\r\n\r\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n if (!(view instanceof NineSliceSprite)) continue;\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n }\r\n\r\n get enabled(): boolean {\r\n return this.enabledState;\r\n }\r\n\r\n set enabled(value: boolean) {\r\n this.applyEnabled(value);\r\n }\r\n\r\n get state(): ButtonStateKey {\r\n return KEY_BY_FANCY_STATE[this.button.state];\r\n }\r\n\r\n /** Forces a visual state without changing `enabled`, so a disabled button still emits no press. */\r\n setState(state: ButtonStateKey): void {\r\n this.button.setState(FANCY_STATE_BY_KEY[state]);\r\n }\r\n\r\n get onPress(): FancyButton[\"onPress\"] { return this.button.onPress; }\r\n get onDown(): FancyButton[\"onDown\"] { return this.button.onDown; }\r\n get onUp(): FancyButton[\"onUp\"] { return this.button.onUp; }\r\n get onHover(): FancyButton[\"onHover\"] { return this.button.onHover; }\r\n get onOut(): FancyButton[\"onOut\"] { return this.button.onOut; }\r\n}\r\n"]}
|