@pixi-ui-editor/runtime-pixi 0.8.0 → 0.10.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.
Files changed (36) hide show
  1. package/dist/SceneViewport.js.map +1 -1
  2. package/dist/controls.d.ts +17 -1
  3. package/dist/controls.d.ts.map +1 -1
  4. package/dist/controls.js +30 -1
  5. package/dist/controls.js.map +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/layout.js.map +1 -1
  11. package/dist/layoutGroups.js.map +1 -1
  12. package/dist/particles.js.map +1 -1
  13. package/dist/scene.d.ts.map +1 -1
  14. package/dist/scene.js +36 -0
  15. package/dist/scene.js.map +1 -1
  16. package/dist/views/ItemTableNodeView.d.ts +57 -0
  17. package/dist/views/ItemTableNodeView.d.ts.map +1 -0
  18. package/dist/views/ItemTableNodeView.js +100 -0
  19. package/dist/views/ItemTableNodeView.js.map +1 -0
  20. package/dist/views/NodeView.d.ts +20 -0
  21. package/dist/views/NodeView.d.ts.map +1 -1
  22. package/dist/views/NodeView.js +25 -1
  23. package/dist/views/NodeView.js.map +1 -1
  24. package/dist/views/PaginationNodeView.d.ts +38 -2
  25. package/dist/views/PaginationNodeView.d.ts.map +1 -1
  26. package/dist/views/PaginationNodeView.js +85 -28
  27. package/dist/views/PaginationNodeView.js.map +1 -1
  28. package/dist/views/ParticleEmitterNodeView.js.map +1 -1
  29. package/dist/views/SpineNodeView.d.ts +9 -0
  30. package/dist/views/SpineNodeView.d.ts.map +1 -1
  31. package/dist/views/SpineNodeView.js +21 -1
  32. package/dist/views/SpineNodeView.js.map +1 -1
  33. package/dist/views/createNodeView.d.ts.map +1 -1
  34. package/dist/views/createNodeView.js +4 -0
  35. package/dist/views/createNodeView.js.map +1 -1
  36. package/package.json +2 -2
@@ -3,6 +3,17 @@ import { Texture } from "pixi.js";
3
3
  import { Signal } from "typed-signals";
4
4
  import { NodeView, type SceneInteractionMode } from "./NodeView.js";
5
5
  export type { PaginationNode };
6
+ /**
7
+ * Кнопка-стрелка пагинатора: ровно та часть `ButtonNodeView`/`StagedButtonNodeView`, которая нужна
8
+ * виджету, — нажатие и «доступна ли». Тип объявлен структурно, чтобы этот файл не зависел от обоих
9
+ * классов кнопок и не решал, какой из них «настоящий».
10
+ */
11
+ export type PaginationArrow = {
12
+ onPress: {
13
+ connect(handler: () => void): unknown;
14
+ };
15
+ enabled: boolean;
16
+ };
6
17
  /**
7
18
  * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same
8
19
  * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never
@@ -18,12 +29,22 @@ export type { PaginationNode };
18
29
  * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this
19
30
  * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself
20
31
  * is not structural: switching pages only recreates the (one) background view that needs to move.
32
+ *
33
+ * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active
34
+ * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real
35
+ * page range keeps its footprint and renders nothing, so the active page never shifts sideways.
36
+ *
37
+ * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the
38
+ * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution
39
+ * Spine connector targets use) and steps the page on press. It never draws an arrow itself.
21
40
  */
22
41
  export declare class PaginationNodeView extends NodeView {
23
42
  private readonly list;
24
43
  private readonly interaction;
25
44
  private readonly fonts;
26
45
  private items;
46
+ private visibleSlots;
47
+ private arrows?;
27
48
  private styleMode;
28
49
  private activeTexture;
29
50
  private inactiveTexture;
@@ -40,15 +61,30 @@ export declare class PaginationNodeView extends NodeView {
40
61
  readonly onPageChange: Signal<(page: number) => void>;
41
62
  constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined);
42
63
  private createBackgroundView;
64
+ /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */
65
+ private get slotCount();
66
+ /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */
67
+ private pageForSlot;
43
68
  private createItem;
44
- /** Recreates every item for the current `styleMode`/`pageCountState`/`dotWidth`/`dotHeight`. */
69
+ /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */
45
70
  private buildItems;
46
71
  /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */
47
72
  private wireItem;
48
73
  private applyCurrentPage;
74
+ /**
75
+ * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит
76
+ * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только
77
+ * подписывается на них и гасит ту, за которой страниц больше нет.
78
+ */
79
+ setArrows(arrows: {
80
+ previous?: PaginationArrow;
81
+ next?: PaginationArrow;
82
+ }): void;
83
+ /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */
84
+ private applyArrowState;
49
85
  protected syncContent(node: UINode): void;
50
86
  get pageCount(): number;
51
- /** Structural: rebuilds every item. Used both by document edits and `setPaginationViewPageCount`. */
87
+ /** Used by `setPaginationViewPageCount` once game code knows the real content length. */
52
88
  set pageCount(value: number);
53
89
  get page(): number;
54
90
  /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */
@@ -1 +1 @@
1
- {"version":3,"file":"PaginationNodeView.d.ts","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAA4B,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAExH,OAAO,EAA4C,OAAO,EAAyB,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpE,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container {
81
81
  * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this
82
82
  * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself
83
83
  * is not structural: switching pages only recreates the (one) background view that needs to move.
84
+ *
85
+ * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active
86
+ * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real
87
+ * page range keeps its footprint and renders nothing, so the active page never shifts sideways.
88
+ *
89
+ * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the
90
+ * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution
91
+ * Spine connector targets use) and steps the page on press. It never draws an arrow itself.
84
92
  */
85
93
  export class PaginationNodeView extends NodeView {
86
94
  list;
87
95
  interaction;
88
96
  fonts;
89
97
  items = [];
98
+ visibleSlots;
99
+ arrows;
90
100
  styleMode;
91
101
  activeTexture;
92
102
  inactiveTexture;
@@ -113,7 +123,8 @@ export class PaginationNodeView extends NodeView {
113
123
  this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);
114
124
  this.numberActiveNineSlice = node.numberActiveNineSlice;
115
125
  this.pageCountState = Math.max(1, Math.round(node.pageCount));
116
- this.currentPage = clampPage(node.defaultPage, this.pageCountState);
126
+ this.visibleSlots = node.visiblePageCount;
127
+ this.currentPage = clampPage(node.defaultPage, this.pageCount);
117
128
  this.dotWidth = node.dotSize.width;
118
129
  this.dotHeight = node.dotSize.height;
119
130
  this.clickableState = node.clickable;
@@ -126,57 +137,97 @@ export class PaginationNodeView extends NodeView {
126
137
  ? new Sprite(texture)
127
138
  : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });
128
139
  }
129
- createItem(index) {
140
+ /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */
141
+ get slotCount() {
142
+ return this.visibleSlots === undefined ? this.pageCount : Math.max(1, Math.round(this.visibleSlots));
143
+ }
144
+ /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */
145
+ pageForSlot(slot) {
146
+ return this.visibleSlots === undefined ? slot : this.currentPage - Math.floor(this.slotCount / 2) + slot;
147
+ }
148
+ createItem(slot) {
149
+ const page = this.pageForSlot(slot);
150
+ const exists = page >= 0 && page < this.pageCount;
151
+ const isActive = exists && page === this.currentPage;
130
152
  if (this.styleMode === "dots") {
131
- const dot = new Sprite(index === this.currentPage ? this.activeTexture : this.inactiveTexture);
153
+ const dot = new Sprite(isActive ? this.activeTexture : this.inactiveTexture);
132
154
  dot.setSize(this.dotWidth, this.dotHeight);
155
+ // An out-of-range slot renders nothing but keeps its size, so `List` still reserves its place.
156
+ dot.visible = exists;
133
157
  return dot;
134
158
  }
135
- const isActive = index === this.currentPage;
136
159
  const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;
137
160
  const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;
138
- const item = new NumberItem(new Text({ text: String(index + 1), style: numberTextStyle(this.numberStyle, fill, this.fonts) }));
161
+ const item = new NumberItem(new Text({ text: exists ? String(page + 1) : "", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));
139
162
  item.resize(this.dotWidth, this.dotHeight);
140
163
  if (isActive && this.numberActiveBackgroundTexture !== undefined)
141
164
  item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));
142
165
  return item;
143
166
  }
144
- /** Recreates every item for the current `styleMode`/`pageCountState`/`dotWidth`/`dotHeight`. */
167
+ /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */
145
168
  buildItems() {
146
169
  this.list.removeChildren();
147
170
  this.items = [];
148
- for (let index = 0; index < this.pageCountState; index++) {
149
- const item = this.createItem(index);
150
- this.wireItem(item, index);
171
+ for (let slot = 0; slot < this.slotCount; slot++) {
172
+ const item = this.createItem(slot);
173
+ this.wireItem(item, slot);
151
174
  this.items.push(item);
152
175
  this.list.addChild(item);
153
176
  }
177
+ this.applyArrowState();
154
178
  }
155
179
  /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */
156
- wireItem(item, index) {
180
+ wireItem(item, slot) {
157
181
  if (this.interaction === "authoring" || !this.clickableState) {
158
182
  item.eventMode = "none";
159
183
  return;
160
184
  }
161
185
  item.eventMode = "static";
162
186
  item.cursor = "pointer";
163
- item.on("pointertap", () => this.setPage(index));
187
+ // Resolved on click, not captured: a windowed slot points at a different page after every move.
188
+ item.on("pointertap", () => {
189
+ const page = this.pageForSlot(slot);
190
+ if (page >= 0 && page < this.pageCount)
191
+ this.setPage(page);
192
+ });
164
193
  }
165
194
  applyCurrentPage() {
166
- if (this.styleMode === "dots") {
167
- this.items.forEach((item, index) => { if (item instanceof Sprite)
168
- item.texture = index === this.currentPage ? this.activeTexture : this.inactiveTexture; });
169
- return;
170
- }
171
195
  const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;
172
- this.items.forEach((item, index) => {
173
- if (!(item instanceof NumberItem))
196
+ this.items.forEach((item, slot) => {
197
+ const page = this.pageForSlot(slot);
198
+ const exists = page >= 0 && page < this.pageCount;
199
+ const isActive = exists && page === this.currentPage;
200
+ if (item instanceof NumberItem) {
201
+ item.numberText.text = exists ? String(page + 1) : "";
202
+ item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);
203
+ item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);
174
204
  return;
175
- const isActive = index === this.currentPage;
176
- const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;
177
- item.numberText.style = numberTextStyle(this.numberStyle, fill, this.fonts);
178
- item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);
205
+ }
206
+ item.texture = isActive ? this.activeTexture : this.inactiveTexture;
207
+ item.setSize(this.dotWidth, this.dotHeight);
208
+ item.visible = exists;
179
209
  });
210
+ this.applyArrowState();
211
+ }
212
+ /**
213
+ * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит
214
+ * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только
215
+ * подписывается на них и гасит ту, за которой страниц больше нет.
216
+ */
217
+ setArrows(arrows) {
218
+ this.arrows = arrows;
219
+ arrows.previous?.onPress.connect(() => this.setPage(this.currentPage - 1));
220
+ arrows.next?.onPress.connect(() => this.setPage(this.currentPage + 1));
221
+ this.applyArrowState();
222
+ }
223
+ /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */
224
+ applyArrowState() {
225
+ if (this.arrows === undefined)
226
+ return;
227
+ if (this.arrows.previous !== undefined)
228
+ this.arrows.previous.enabled = this.currentPage > 0;
229
+ if (this.arrows.next !== undefined)
230
+ this.arrows.next.enabled = this.currentPage < this.pageCount - 1;
180
231
  }
181
232
  syncContent(node) {
182
233
  if (node.type !== "pagination")
@@ -185,7 +236,10 @@ export class PaginationNodeView extends NodeView {
185
236
  const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;
186
237
  const pageCount = Math.max(1, Math.round(node.pageCount));
187
238
  this.clickableState = node.clickable;
188
- const structureChanged = node.style !== this.styleMode || pageCount !== this.pageCountState || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;
239
+ const previousSlotCount = this.slotCount;
240
+ this.visibleSlots = node.visiblePageCount;
241
+ this.pageCountState = pageCount;
242
+ const structureChanged = node.style !== this.styleMode || this.slotCount !== previousSlotCount || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;
189
243
  this.styleMode = node.style;
190
244
  this.activeTexture = active;
191
245
  this.inactiveTexture = inactive;
@@ -193,10 +247,9 @@ export class PaginationNodeView extends NodeView {
193
247
  this.numberActiveColor = node.numberActiveColor;
194
248
  this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);
195
249
  this.numberActiveNineSlice = node.numberActiveNineSlice;
196
- this.pageCountState = pageCount;
197
250
  this.dotWidth = node.dotSize.width;
198
251
  this.dotHeight = node.dotSize.height;
199
- this.currentPage = clampPage(this.currentPage, pageCount);
252
+ this.currentPage = clampPage(this.currentPage, this.pageCount);
200
253
  if (this.list.type !== node.direction)
201
254
  this.list.type = node.direction;
202
255
  if (this.list.elementsMargin !== node.spacing)
@@ -207,14 +260,18 @@ export class PaginationNodeView extends NodeView {
207
260
  this.applyCurrentPage();
208
261
  }
209
262
  get pageCount() { return this.pageCountState; }
210
- /** Structural: rebuilds every item. Used both by document edits and `setPaginationViewPageCount`. */
263
+ /** Used by `setPaginationViewPageCount` once game code knows the real content length. */
211
264
  set pageCount(value) {
212
265
  const next = Math.max(1, Math.round(value));
213
266
  if (next === this.pageCountState)
214
267
  return;
268
+ const previousSlotCount = this.slotCount;
215
269
  this.pageCountState = next;
216
- this.currentPage = clampPage(this.currentPage, next);
217
- this.buildItems();
270
+ this.currentPage = clampPage(this.currentPage, this.pageCount);
271
+ if (this.slotCount === previousSlotCount)
272
+ this.applyCurrentPage();
273
+ else
274
+ this.buildItems();
218
275
  }
219
276
  get page() { return this.currentPage; }
220
277
  /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */
@@ -1 +1 @@
1
- {"version":3,"file":"PaginationNodeView.js","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAyB,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC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C,WAAW;YAAE,OAAO;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,iHAAiH;IACzG,OAAO,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { type LayoutPadding, type PaginationNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { List } from \"@pixi/ui\";\r\nimport { Container, NineSliceSprite, Sprite, Text, Texture, type TextStyleOptions } from \"pixi.js\";\r\nimport { Signal } from \"typed-signals\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type { PaginationNode };\r\n\r\nconst DEFAULT_NUMBER_STYLE: TextStyleDefinition = { fontFamily: \"Arial\", fontSize: 18, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\", align: \"center\", verticalAlign: \"middle\", wordWrap: false, breakWords: false, letterSpacing: 0 };\r\n\r\n/** Same shape `ValueControlNodeViews.ts`'s own `textStyle` resolves — kept as its own small copy rather\r\n * than shared, the same call ADR 0029 makes for two similar-but-separately-evolving style resolvers. */\r\nfunction numberTextStyle(style: TextStyleDefinition | undefined, fill: string, fonts: ReadonlyMap<string, string> | undefined): Partial<TextStyleOptions> {\r\n const resolved = style ?? DEFAULT_NUMBER_STYLE;\r\n return {\r\n fontFamily: resolved.fontAssetId === undefined ? resolved.fontFamily : fonts?.get(resolved.fontAssetId) ?? resolved.fontFamily,\r\n fontSize: resolved.fontSize,\r\n fontWeight: resolved.fontWeight,\r\n fontStyle: resolved.fontStyle,\r\n fill,\r\n align: resolved.align,\r\n wordWrap: resolved.wordWrap,\r\n breakWords: resolved.breakWords,\r\n lineHeight: resolved.lineHeight,\r\n letterSpacing: resolved.letterSpacing,\r\n stroke: resolved.stroke === undefined ? undefined : { color: resolved.stroke.color, width: resolved.stroke.width },\r\n };\r\n}\r\n\r\n/** Clamps a page index into the valid `[0, pageCount)` range; an empty widget still shows dot 0. */\r\nfunction clampPage(page: number, pageCount: number): number {\r\n return Math.min(Math.max(0, Math.round(page)), Math.max(0, pageCount - 1));\r\n}\r\n\r\n/**\r\n * One `numbers`-style item: a centered page-number label, plus an optional \"pill\" background shown\r\n * only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the\r\n * same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly\r\n * whether or not its (rarely-present) background happens to be attached right now.\r\n */\r\nclass NumberItem extends Container {\r\n private itemWidth = 0;\r\n private itemHeight = 0;\r\n private background?: Sprite | NineSliceSprite;\r\n\r\n // Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.\r\n constructor(readonly numberText: Text) {\r\n super();\r\n numberText.anchor.set(0.5);\r\n super.addChild(numberText);\r\n }\r\n\r\n override get width(): number { return this.itemWidth; }\r\n override set width(value: number) { this.itemWidth = value; }\r\n override get height(): number { return this.itemHeight; }\r\n override set height(value: number) { this.itemHeight = value; }\r\n\r\n resize(width: number, height: number): void {\r\n this.itemWidth = width;\r\n this.itemHeight = height;\r\n this.numberText.position.set(width / 2, height / 2);\r\n this.background?.setSize(width, height);\r\n }\r\n\r\n /** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */\r\n setBackground(view: Sprite | NineSliceSprite | undefined): void {\r\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); }\r\n this.background = view;\r\n if (view === undefined) return;\r\n view.setSize(this.itemWidth, this.itemHeight);\r\n super.addChildAt(view, 0);\r\n }\r\n}\r\n\r\n/**\r\n * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same\r\n * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never\r\n * reimplements arrangement. Deliberately not wired to any scroll-view: game code owns the actual page\r\n * transition and drives the widget one-way through `setPaginationViewPage`/`setPaginationViewPageCount`,\r\n * the same relationship a slider or progress bar has to whatever value it displays.\r\n *\r\n * `style` picks between two mutually exclusive, differently-rendered item kinds — image dots\r\n * (`Sprite`, two states) or rendered page-number text (`NumberItem`: a label, base style + an optional\r\n * highlight color, plus an optional pill background behind only the current page) — never both.\r\n * Switching `style` rebuilds every item, the same \"view's required *type* changed\" rule\r\n * `StagedButtonNodeView` follows for its state views; `pageCount`/`dotSize` changes do too, since the\r\n * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this\r\n * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself\r\n * is not structural: switching pages only recreates the (one) background view that needs to move.\r\n */\r\nexport class PaginationNodeView extends NodeView {\r\n private readonly list: List;\r\n private readonly interaction: SceneInteractionMode;\r\n private readonly fonts: ReadonlyMap<string, string> | undefined;\r\n private items: (Sprite | NumberItem)[] = [];\r\n private styleMode: PaginationNode[\"style\"];\r\n private activeTexture: Texture;\r\n private inactiveTexture: Texture;\r\n private numberStyle: TextStyleDefinition | undefined;\r\n private numberActiveColor: string | undefined;\r\n private numberActiveBackgroundTexture: Texture | undefined;\r\n private numberActiveNineSlice: LayoutPadding | undefined;\r\n private pageCountState: number;\r\n private currentPage: number;\r\n private dotWidth: number;\r\n private dotHeight: number;\r\n private clickableState: boolean;\r\n\r\n /** Fires only from a click on an item (when `clickable`); setting `page` programmatically never emits. */\r\n readonly onPageChange = new Signal<(page: number) => void>();\r\n\r\n constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined) {\r\n super(textures);\r\n this.interaction = interaction;\r\n this.fonts = fonts;\r\n this.styleMode = node.style;\r\n this.activeTexture = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\r\n this.inactiveTexture = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\r\n this.numberStyle = node.numberStyle;\r\n this.numberActiveColor = node.numberActiveColor;\r\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\r\n this.numberActiveNineSlice = node.numberActiveNineSlice;\r\n this.pageCountState = Math.max(1, Math.round(node.pageCount));\r\n this.currentPage = clampPage(node.defaultPage, this.pageCountState);\r\n this.dotWidth = node.dotSize.width;\r\n this.dotHeight = node.dotSize.height;\r\n this.clickableState = node.clickable;\r\n this.list = new List({ type: node.direction, elementsMargin: node.spacing });\r\n this.buildItems();\r\n this.setContent(this.list);\r\n }\r\n\r\n private createBackgroundView(texture: Texture): Sprite | NineSliceSprite {\r\n return this.numberActiveNineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });\r\n }\r\n\r\n private createItem(index: number): Sprite | NumberItem {\r\n if (this.styleMode === \"dots\") {\r\n const dot = new Sprite(index === this.currentPage ? this.activeTexture : this.inactiveTexture);\r\n dot.setSize(this.dotWidth, this.dotHeight);\r\n return dot;\r\n }\r\n const isActive = index === this.currentPage;\r\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\r\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\r\n const item = new NumberItem(new Text({ text: String(index + 1), style: numberTextStyle(this.numberStyle, fill, this.fonts) }));\r\n item.resize(this.dotWidth, this.dotHeight);\r\n if (isActive && this.numberActiveBackgroundTexture !== undefined) item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));\r\n return item;\r\n }\r\n\r\n /** Recreates every item for the current `styleMode`/`pageCountState`/`dotWidth`/`dotHeight`. */\r\n private buildItems(): void {\r\n this.list.removeChildren();\r\n this.items = [];\r\n for (let index = 0; index < this.pageCountState; index++) {\r\n const item = this.createItem(index);\r\n this.wireItem(item, index);\r\n this.items.push(item);\r\n this.list.addChild(item);\r\n }\r\n }\r\n\r\n /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */\r\n private wireItem(item: Sprite | NumberItem, index: number): void {\r\n if (this.interaction === \"authoring\" || !this.clickableState) { item.eventMode = \"none\"; return; }\r\n item.eventMode = \"static\";\r\n item.cursor = \"pointer\";\r\n item.on(\"pointertap\", () => this.setPage(index));\r\n }\r\n\r\n private applyCurrentPage(): void {\r\n if (this.styleMode === \"dots\") {\r\n this.items.forEach((item, index) => { if (item instanceof Sprite) item.texture = index === this.currentPage ? this.activeTexture : this.inactiveTexture; });\r\n return;\r\n }\r\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\r\n this.items.forEach((item, index) => {\r\n if (!(item instanceof NumberItem)) return;\r\n const isActive = index === this.currentPage;\r\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\r\n item.numberText.style = numberTextStyle(this.numberStyle, fill, this.fonts);\r\n item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);\r\n });\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"pagination\") return;\r\n const active = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\r\n const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\r\n const pageCount = Math.max(1, Math.round(node.pageCount));\r\n this.clickableState = node.clickable;\r\n\r\n const structureChanged = node.style !== this.styleMode || pageCount !== this.pageCountState || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;\r\n this.styleMode = node.style;\r\n this.activeTexture = active;\r\n this.inactiveTexture = inactive;\r\n this.numberStyle = node.numberStyle;\r\n this.numberActiveColor = node.numberActiveColor;\r\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\r\n this.numberActiveNineSlice = node.numberActiveNineSlice;\r\n this.pageCountState = pageCount;\r\n this.dotWidth = node.dotSize.width;\r\n this.dotHeight = node.dotSize.height;\r\n this.currentPage = clampPage(this.currentPage, pageCount);\r\n\r\n if (this.list.type !== node.direction) this.list.type = node.direction;\r\n if (this.list.elementsMargin !== node.spacing) this.list.elementsMargin = node.spacing;\r\n\r\n if (structureChanged) this.buildItems();\r\n else this.applyCurrentPage();\r\n }\r\n\r\n get pageCount(): number { return this.pageCountState; }\r\n\r\n /** Structural: rebuilds every item. Used both by document edits and `setPaginationViewPageCount`. */\r\n set pageCount(value: number) {\r\n const next = Math.max(1, Math.round(value));\r\n if (next === this.pageCountState) return;\r\n this.pageCountState = next;\r\n this.currentPage = clampPage(this.currentPage, next);\r\n this.buildItems();\r\n }\r\n\r\n get page(): number { return this.currentPage; }\r\n\r\n /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */\r\n set page(value: number) {\r\n const next = clampPage(value, this.pageCountState);\r\n if (next === this.currentPage) return;\r\n this.currentPage = next;\r\n this.applyCurrentPage();\r\n }\r\n\r\n /** An item click: highlights immediately, then notifies game code — the same order a checkbox/slider follows. */\r\n private setPage(index: number): void {\r\n const next = clampPage(index, this.pageCountState);\r\n if (next !== this.currentPage) { this.currentPage = next; this.applyCurrentPage(); }\r\n this.onPageChange.emit(next);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PaginationNodeView.js","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI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W;YAAE,OAAO;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,iHAAiH;IACzG,OAAO,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { type LayoutPadding, type PaginationNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\nimport { List } from \"@pixi/ui\";\nimport { Container, NineSliceSprite, Sprite, Text, Texture, type TextStyleOptions } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { PaginationNode };\n\nconst DEFAULT_NUMBER_STYLE: TextStyleDefinition = { fontFamily: \"Arial\", fontSize: 18, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\", align: \"center\", verticalAlign: \"middle\", wordWrap: false, breakWords: false, letterSpacing: 0 };\n\n/** Same shape `ValueControlNodeViews.ts`'s own `textStyle` resolves — kept as its own small copy rather\n * than shared, the same call ADR 0029 makes for two similar-but-separately-evolving style resolvers. */\nfunction numberTextStyle(style: TextStyleDefinition | undefined, fill: string, fonts: ReadonlyMap<string, string> | undefined): Partial<TextStyleOptions> {\n const resolved = style ?? DEFAULT_NUMBER_STYLE;\n return {\n fontFamily: resolved.fontAssetId === undefined ? resolved.fontFamily : fonts?.get(resolved.fontAssetId) ?? resolved.fontFamily,\n fontSize: resolved.fontSize,\n fontWeight: resolved.fontWeight,\n fontStyle: resolved.fontStyle,\n fill,\n align: resolved.align,\n wordWrap: resolved.wordWrap,\n breakWords: resolved.breakWords,\n lineHeight: resolved.lineHeight,\n letterSpacing: resolved.letterSpacing,\n stroke: resolved.stroke === undefined ? undefined : { color: resolved.stroke.color, width: resolved.stroke.width },\n };\n}\n\n/**\n * Кнопка-стрелка пагинатора: ровно та часть `ButtonNodeView`/`StagedButtonNodeView`, которая нужна\n * виджету, — нажатие и «доступна ли». Тип объявлен структурно, чтобы этот файл не зависел от обоих\n * классов кнопок и не решал, какой из них «настоящий».\n */\nexport type PaginationArrow = { onPress: { connect(handler: () => void): unknown }; enabled: boolean };\n\n/** Clamps a page index into the valid `[0, pageCount)` range; an empty widget still shows dot 0. */\nfunction clampPage(page: number, pageCount: number): number {\n return Math.min(Math.max(0, Math.round(page)), Math.max(0, pageCount - 1));\n}\n\n/**\n * One `numbers`-style item: a centered page-number label, plus an optional \"pill\" background shown\n * only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the\n * same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly\n * whether or not its (rarely-present) background happens to be attached right now.\n */\nclass NumberItem extends Container {\n private itemWidth = 0;\n private itemHeight = 0;\n private background?: Sprite | NineSliceSprite;\n\n // Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.\n constructor(readonly numberText: Text) {\n super();\n numberText.anchor.set(0.5);\n super.addChild(numberText);\n }\n\n override get width(): number { return this.itemWidth; }\n override set width(value: number) { this.itemWidth = value; }\n override get height(): number { return this.itemHeight; }\n override set height(value: number) { this.itemHeight = value; }\n\n resize(width: number, height: number): void {\n this.itemWidth = width;\n this.itemHeight = height;\n this.numberText.position.set(width / 2, height / 2);\n this.background?.setSize(width, height);\n }\n\n /** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */\n setBackground(view: Sprite | NineSliceSprite | undefined): void {\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); }\n this.background = view;\n if (view === undefined) return;\n view.setSize(this.itemWidth, this.itemHeight);\n super.addChildAt(view, 0);\n }\n}\n\n/**\n * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same\n * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never\n * reimplements arrangement. Deliberately not wired to any scroll-view: game code owns the actual page\n * transition and drives the widget one-way through `setPaginationViewPage`/`setPaginationViewPageCount`,\n * the same relationship a slider or progress bar has to whatever value it displays.\n *\n * `style` picks between two mutually exclusive, differently-rendered item kinds — image dots\n * (`Sprite`, two states) or rendered page-number text (`NumberItem`: a label, base style + an optional\n * highlight color, plus an optional pill background behind only the current page) — never both.\n * Switching `style` rebuilds every item, the same \"view's required *type* changed\" rule\n * `StagedButtonNodeView` follows for its state views; `pageCount`/`dotSize` changes do too, since the\n * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this\n * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself\n * is not structural: switching pages only recreates the (one) background view that needs to move.\n *\n * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active\n * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real\n * page range keeps its footprint and renders nothing, so the active page never shifts sideways.\n *\n * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the\n * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution\n * Spine connector targets use) and steps the page on press. It never draws an arrow itself.\n */\nexport class PaginationNodeView extends NodeView {\n private readonly list: List;\n private readonly interaction: SceneInteractionMode;\n private readonly fonts: ReadonlyMap<string, string> | undefined;\n private items: (Sprite | NumberItem)[] = [];\n private visibleSlots: number | undefined;\n private arrows?: { previous?: PaginationArrow; next?: PaginationArrow };\n private styleMode: PaginationNode[\"style\"];\n private activeTexture: Texture;\n private inactiveTexture: Texture;\n private numberStyle: TextStyleDefinition | undefined;\n private numberActiveColor: string | undefined;\n private numberActiveBackgroundTexture: Texture | undefined;\n private numberActiveNineSlice: LayoutPadding | undefined;\n private pageCountState: number;\n private currentPage: number;\n private dotWidth: number;\n private dotHeight: number;\n private clickableState: boolean;\n\n /** Fires only from a click on an item (when `clickable`); setting `page` programmatically never emits. */\n readonly onPageChange = new Signal<(page: number) => void>();\n\n constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined) {\n super(textures);\n this.interaction = interaction;\n this.fonts = fonts;\n this.styleMode = node.style;\n this.activeTexture = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n this.inactiveTexture = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.pageCountState = Math.max(1, Math.round(node.pageCount));\n this.visibleSlots = node.visiblePageCount;\n this.currentPage = clampPage(node.defaultPage, this.pageCount);\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.clickableState = node.clickable;\n this.list = new List({ type: node.direction, elementsMargin: node.spacing });\n this.buildItems();\n this.setContent(this.list);\n }\n\n private createBackgroundView(texture: Texture): Sprite | NineSliceSprite {\n return this.numberActiveNineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });\n }\n\n /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */\n private get slotCount(): number {\n return this.visibleSlots === undefined ? this.pageCount : Math.max(1, Math.round(this.visibleSlots));\n }\n\n /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */\n private pageForSlot(slot: number): number {\n return this.visibleSlots === undefined ? slot : this.currentPage - Math.floor(this.slotCount / 2) + slot;\n }\n\n private createItem(slot: number): Sprite | NumberItem {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (this.styleMode === \"dots\") {\n const dot = new Sprite(isActive ? this.activeTexture : this.inactiveTexture);\n dot.setSize(this.dotWidth, this.dotHeight);\n // An out-of-range slot renders nothing but keeps its size, so `List` still reserves its place.\n dot.visible = exists;\n return dot;\n }\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\n const item = new NumberItem(new Text({ text: exists ? String(page + 1) : \"\", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));\n item.resize(this.dotWidth, this.dotHeight);\n if (isActive && this.numberActiveBackgroundTexture !== undefined) item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));\n return item;\n }\n\n /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */\n private buildItems(): void {\n this.list.removeChildren();\n this.items = [];\n for (let slot = 0; slot < this.slotCount; slot++) {\n const item = this.createItem(slot);\n this.wireItem(item, slot);\n this.items.push(item);\n this.list.addChild(item);\n }\n this.applyArrowState();\n }\n\n /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */\n private wireItem(item: Sprite | NumberItem, slot: number): void {\n if (this.interaction === \"authoring\" || !this.clickableState) { item.eventMode = \"none\"; return; }\n item.eventMode = \"static\";\n item.cursor = \"pointer\";\n // Resolved on click, not captured: a windowed slot points at a different page after every move.\n item.on(\"pointertap\", () => {\n const page = this.pageForSlot(slot);\n if (page >= 0 && page < this.pageCount) this.setPage(page);\n });\n }\n\n private applyCurrentPage(): void {\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n this.items.forEach((item, slot) => {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (item instanceof NumberItem) {\n item.numberText.text = exists ? String(page + 1) : \"\";\n item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);\n item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);\n return;\n }\n item.texture = isActive ? this.activeTexture : this.inactiveTexture;\n item.setSize(this.dotWidth, this.dotHeight);\n item.visible = exists;\n });\n this.applyArrowState();\n }\n\n /**\n * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит\n * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только\n * подписывается на них и гасит ту, за которой страниц больше нет.\n */\n setArrows(arrows: { previous?: PaginationArrow; next?: PaginationArrow }): void {\n this.arrows = arrows;\n arrows.previous?.onPress.connect(() => this.setPage(this.currentPage - 1));\n arrows.next?.onPress.connect(() => this.setPage(this.currentPage + 1));\n this.applyArrowState();\n }\n\n /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */\n private applyArrowState(): void {\n if (this.arrows === undefined) return;\n if (this.arrows.previous !== undefined) this.arrows.previous.enabled = this.currentPage > 0;\n if (this.arrows.next !== undefined) this.arrows.next.enabled = this.currentPage < this.pageCount - 1;\n }\n\n protected syncContent(node: UINode): void {\n if (node.type !== \"pagination\") return;\n const active = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n const pageCount = Math.max(1, Math.round(node.pageCount));\n this.clickableState = node.clickable;\n\n const previousSlotCount = this.slotCount;\n this.visibleSlots = node.visiblePageCount;\n this.pageCountState = pageCount;\n const structureChanged = node.style !== this.styleMode || this.slotCount !== previousSlotCount || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;\n this.styleMode = node.style;\n this.activeTexture = active;\n this.inactiveTexture = inactive;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n\n if (this.list.type !== node.direction) this.list.type = node.direction;\n if (this.list.elementsMargin !== node.spacing) this.list.elementsMargin = node.spacing;\n\n if (structureChanged) this.buildItems();\n else this.applyCurrentPage();\n }\n\n get pageCount(): number { return this.pageCountState; }\n\n /** Used by `setPaginationViewPageCount` once game code knows the real content length. */\n set pageCount(value: number) {\n const next = Math.max(1, Math.round(value));\n if (next === this.pageCountState) return;\n const previousSlotCount = this.slotCount;\n this.pageCountState = next;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n if (this.slotCount === previousSlotCount) this.applyCurrentPage();\n else this.buildItems();\n }\n\n get page(): number { return this.currentPage; }\n\n /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */\n set page(value: number) {\n const next = clampPage(value, this.pageCountState);\n if (next === this.currentPage) return;\n this.currentPage = next;\n this.applyCurrentPage();\n }\n\n /** An item click: highlights immediately, then notifies game code — the same order a checkbox/slider follows. */\n private setPage(index: number): void {\n const next = clampPage(index, this.pageCountState);\n if (next !== this.currentPage) { this.currentPage = next; this.applyCurrentPage(); }\n this.onPageChange.emit(next);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ParticleEmitterNodeView.js","sourceRoot":"","sources":["../../src/views/ParticleEmitterNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAuB,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAgD,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,IAA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i-ui-editor/schema\";\r\nimport { Container, Particle, ParticleContainer, Texture, type DestroyOptions } from \"pixi.js\";\r\nimport { lerp, ParticleSimulator, type ParticleSlot, type ParticleSpawnContext } from \"../particles.js\";\r\nimport { NodeView } from \"./NodeView.js\";\r\n\r\nconst DEG_TO_RAD = Math.PI / 180;\r\n\r\n/** Thin Pixi adapter: NodeView continues to own transforms, layout and hit testing. */\r\nexport class ParticleEmitterNodeView extends NodeView {\r\n private readonly contentRoot = new Container();\r\n private readonly simulator: ParticleSimulator<Particle>;\r\n private readonly renderGroups = new Map<Texture[\"source\"], ParticleRenderGroup>();\r\n private simulationSpace: \"local\" | \"world\" = \"local\";\r\n private autoplayHandled = false;\r\n private renderDirty = true;\r\n private tintStart = 0xffffff;\r\n private tintEnd = 0xffffff;\r\n private staticColor = 0xffffffff;\r\n private dynamicProperties: DynamicParticleProperties = { position: true, rotation: false, vertex: false, uvs: false, color: false };\r\n private readonly spawnContext: ParticleSpawnContext = { width: 0, height: 0, space: \"local\" };\r\n private renderSignature = \"\";\r\n private sourceSignature = \"\";\r\n private sourceTextures: readonly (Texture | undefined)[] = [];\r\n\r\n constructor(effect: ParticleEffectDefinition, textures?: ReadonlyMap<string, Texture>) {\r\n super(textures);\r\n this.setContent(this.contentRoot);\r\n this.cacheEffect(effect);\r\n this.simulator = new ParticleSimulator<Particle>(effect, {\r\n createRender: () => {\r\n return new Particle({ texture: Texture.EMPTY, anchorX: 0.5, anchorY: 0.5 });\r\n },\r\n hideRender: () => undefined,\r\n destroyRender: () => undefined,\r\n getWorldTransform: () => this.worldTransform,\r\n });\r\n }\r\n\r\n updateParticles(deltaSeconds: number): void {\r\n this.spawnContext.width = this.layoutWidth;\r\n this.spawnContext.height = this.layoutHeight;\r\n this.spawnContext.space = this.simulationSpace;\r\n const advanced = this.simulator.update(deltaSeconds, this.spawnContext);\r\n // World-space particles must also be reprojected when an ancestor moves between simulation\r\n // steps. Local particles need no work: Pixi applies their container transform itself.\r\n if (advanced || this.renderDirty || (this.simulationSpace === \"world\" && this.simulator.activeSlots.size > 0)) this.syncRender();\r\n }\r\n\r\n play(): void { this.simulator.play(); }\r\n pause(): void { this.simulator.pause(); }\r\n restart(): void { this.simulator.restart(); }\r\n stop(): void { this.simulator.stop(); }\r\n /** Advances exactly one fixed step even while paused, preserving the current playing/paused state. */\r\n step(): void {\r\n this.spawnContext.width = this.layoutWidth;\r\n this.spawnContext.height = this.layoutHeight;\r\n this.spawnContext.space = this.simulationSpace;\r\n this.simulator.step(this.spawnContext);\r\n this.syncRender();\r\n }\r\n dispose(): void {\r\n this.simulator.dispose();\r\n this.destroyRenderGroups();\r\n }\r\n setEmissionMultiplier(value: number): void { this.simulator.setEmissionMultiplier(value); }\r\n getDiagnostics() { return this.simulator.getDiagnostics(); }\r\n\r\n syncEffect(effect: ParticleEffectDefinition): void {\r\n this.simulator.syncEffect(effect);\r\n this.renderDirty ||= this.cacheEffect(effect);\r\n }\r\n\r\n override destroy(options?: DestroyOptions): void {\r\n this.dispose();\r\n super.destroy(options);\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"particle-emitter\") return;\r\n if (this.simulationSpace !== node.simulationSpace) this.renderDirty = true;\r\n this.simulationSpace = node.simulationSpace;\r\n // Autoplay only fires once, right after construction: syncContent also runs on every unrelated\r\n // document edit (via the shared node-sync pass), and re-arming play() there would silently\r\n // override an explicit pause()/stop() the moment the author touches anything else in the project.\r\n if (!this.autoplayHandled) {\r\n this.autoplayHandled = true;\r\n if (node.autoplay) this.simulator.play();\r\n }\r\n }\r\n\r\n private syncRender(): void {\r\n const p = this.simulator.definition.particle;\r\n const source = p.visual.source;\r\n const space = this.simulationSpace;\r\n const inverse = space === \"world\" ? this.worldTransform : undefined;\r\n const determinant = inverse === undefined ? 0 : inverse.a * inverse.d - inverse.b * inverse.c;\r\n const inverseDeterminant = determinant === 0 ? 0 : 1 / determinant;\r\n for (const group of this.renderGroups.values()) {\r\n group.nextCount = 0;\r\n group.dirty ||= this.renderDirty;\r\n }\r\n for (const slot of this.simulator.activeSlots) {\r\n const particle = slot.render;\r\n const t = slot.lifetime > 0 ? Math.min(1, slot.age / slot.lifetime) : 1;\r\n const sourceIndex = source.type === \"single\" ? 0 : source.type === \"random\" ? slot.sourceIndex : sequenceFrame(source, slot);\r\n const texture = this.sourceTextures[sourceIndex] ?? Texture.EMPTY;\r\n const textureChanged = particle.texture !== texture;\r\n if (textureChanged) particle.texture = texture;\r\n const initializeStatic = slot.renderDirty || this.renderDirty;\r\n if (this.dynamicProperties.vertex || initializeStatic) {\r\n const scale = lerp(slot.scaleStart, slot.scaleEnd, t);\r\n particle.scaleX = scale;\r\n particle.scaleY = scale;\r\n }\r\n if (this.dynamicProperties.rotation || initializeStatic) particle.rotation = slot.rotationDegrees * DEG_TO_RAD;\r\n if (this.dynamicProperties.color) particle.color = packParticleColor(lerpRgb(this.tintStart, this.tintEnd, t), lerp(p.visual.alpha.start, p.visual.alpha.end, t));\r\n else if (initializeStatic) particle.color = this.staticColor;\r\n if (space === \"world\" && inverse !== undefined) {\r\n const dx = slot.x - slot.spawnX, dy = slot.y - slot.spawnY;\r\n const worldX = slot.worldSpawnX + slot.spawnMatrixA * dx + slot.spawnMatrixC * dy;\r\n const worldY = slot.worldSpawnY + slot.spawnMatrixB * dx + slot.spawnMatrixD * dy;\r\n // Inline Matrix.applyInverse to avoid allocating one point per particle per rendered frame.\r\n const translatedX = worldX - inverse.tx;\r\n const translatedY = worldY - inverse.ty;\r\n particle.x = (inverse.d * translatedX - inverse.c * translatedY) * inverseDeterminant;\r\n particle.y = (-inverse.b * translatedX + inverse.a * translatedY) * inverseDeterminant;\r\n } else {\r\n particle.x = slot.x;\r\n particle.y = slot.y;\r\n }\r\n const group = this.groupFor(texture, p.visual.blendMode);\r\n group.dirty ||= slot.renderDirty || textureChanged || group.container.particleChildren[group.nextCount] !== particle;\r\n group.container.particleChildren[group.nextCount++] = particle;\r\n slot.renderDirty = false;\r\n }\r\n for (const group of this.renderGroups.values()) {\r\n const children = group.container.particleChildren;\r\n if (children.length !== group.nextCount) {\r\n children.length = group.nextCount;\r\n group.dirty = true;\r\n }\r\n if (group.dirty) group.container.update();\r\n group.dirty = false;\r\n }\r\n this.renderDirty = false;\r\n }\r\n\r\n private cacheEffect(effect: ParticleEffectDefinition): boolean {\r\n const visual = effect.particle.visual;\r\n const sourceIds = visual.source.type === \"single\" ? [visual.source.assetId] : visual.source.assetIds;\r\n const sourceTextures = sourceIds.map((id) => this.textureFor(id));\r\n const signature = JSON.stringify(visual);\r\n const sourceSignature = JSON.stringify(visual.source);\r\n const sourceChanged = sourceSignature !== this.sourceSignature\r\n || sourceTextures.length !== this.sourceTextures.length\r\n || sourceTextures.some((texture, index) => texture !== this.sourceTextures[index]);\r\n const changed = signature !== this.renderSignature\r\n || sourceChanged;\r\n if (!changed) return false;\r\n this.renderSignature = signature;\r\n this.sourceSignature = sourceSignature;\r\n this.sourceTextures = sourceTextures;\r\n // Source edits and late texture loads invalidate the source-keyed groups. Rebuild containers,\r\n // but keep every pooled Particle and live simulation slot intact.\r\n if (sourceChanged) this.destroyRenderGroups();\r\n const dynamicProperties = particleDynamicProperties(effect);\r\n if (!sameDynamicProperties(this.dynamicProperties, dynamicProperties)) {\r\n this.destroyRenderGroups();\r\n this.dynamicProperties = dynamicProperties;\r\n }\r\n this.tintStart = parseRgb(effect.particle.visual.tint.start);\r\n this.tintEnd = parseRgb(effect.particle.visual.tint.end);\r\n this.staticColor = packParticleColor(this.tintStart, effect.particle.visual.alpha.start);\r\n for (const group of this.renderGroups.values()) group.container.blendMode = effect.particle.visual.blendMode;\r\n return true;\r\n }\r\n\r\n private groupFor(texture: Texture, blendMode: ParticleEffectDefinition[\"particle\"][\"visual\"][\"blendMode\"]): ParticleRenderGroup {\r\n let group = this.renderGroups.get(texture.source);\r\n if (group !== undefined) return group;\r\n const container = new ParticleContainer<Particle>({\r\n texture,\r\n dynamicProperties: this.dynamicProperties,\r\n });\r\n container.blendMode = blendMode;\r\n this.contentRoot.addChild(container);\r\n group = { container, nextCount: 0, dirty: true };\r\n this.renderGroups.set(texture.source, group);\r\n return group;\r\n }\r\n\r\n private destroyRenderGroups(): void {\r\n for (const group of this.renderGroups.values()) {\r\n this.contentRoot.removeChild(group.container);\r\n group.container.destroy();\r\n }\r\n this.renderGroups.clear();\r\n }\r\n}\r\n\r\ntype SequenceSource = Extract<ParticleEffectDefinition[\"particle\"][\"visual\"][\"source\"], { type: \"sequence\" }>;\r\ntype ParticleRenderGroup = { container: ParticleContainer<Particle>; nextCount: number; dirty: boolean };\r\ntype DynamicParticleProperties = { position: true; rotation: boolean; vertex: boolean; uvs: boolean; color: boolean };\r\n\r\nfunction sequenceFrame(source: SequenceSource, slot: ParticleSlot<Particle>): number {\r\n const length = source.assetIds.length;\r\n const raw = slot.sequenceStart + Math.floor(slot.age * source.fps);\r\n return source.loop ? ((raw % length) + length) % length : Math.min(raw, length - 1);\r\n}\r\n\r\nfunction parseRgb(hex: string): number { return Number.parseInt(hex.slice(1, 7), 16); }\r\nfunction lerpRgb(start: number, end: number, t: number): number {\r\n const r = Math.round(lerp((start >>> 16) & 0xff, (end >>> 16) & 0xff, t));\r\n const g = Math.round(lerp((start >>> 8) & 0xff, (end >>> 8) & 0xff, t));\r\n const b = Math.round(lerp(start & 0xff, end & 0xff, t));\r\n return (r << 16) | (g << 8) | b;\r\n}\r\n/** Pixi Particle buffers store packed ABGR, unlike the public RGB tint number. */\r\nfunction packParticleColor(rgb: number, alpha: number): number {\r\n const bgr = ((rgb & 0xff) << 16) | (rgb & 0xff00) | ((rgb >>> 16) & 0xff);\r\n return (bgr | (Math.round(Math.max(0, Math.min(1, alpha)) * 255) << 24)) >>> 0;\r\n}\r\n\r\nfunction particleDynamicProperties(effect: ParticleEffectDefinition): DynamicParticleProperties {\r\n const visual = effect.particle.visual;\r\n const angular = visual.rotation.angularVelocityDegrees;\r\n const scale = visual.scale;\r\n return {\r\n position: true,\r\n rotation: angular.min !== 0 || angular.max !== 0,\r\n vertex: !(scale.start.min === scale.start.max && scale.start.min === scale.end.min && scale.start.min === scale.end.max),\r\n uvs: visual.source.type === \"sequence\",\r\n color: visual.tint.start !== visual.tint.end || visual.alpha.start !== visual.alpha.end,\r\n };\r\n}\r\n\r\nfunction sameDynamicProperties(a: DynamicParticleProperties, b: DynamicParticleProperties): boolean {\r\n return a.rotation === b.rotation && a.vertex === b.vertex && a.uvs === b.uvs && a.color === b.color;\r\n}\r\n"]}
1
+ {"version":3,"file":"ParticleEmitterNodeView.js","sourceRoot":"","sources":["../../src/views/ParticleEmitterNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAuB,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAgD,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC,uFAAuF;AACvF,MAAM,OAAO,uBAAwB,SAAQ,QAAQ;IAClC,WAAW,GAAG,IAAI,SAAS,EAAE,CAAC;IAC9B,SAAS,CAA8B;IACvC,YAAY,GAAG,IAAI,GAAG,EAA0C,CAAC;IAC1E,eAAe,GAAsB,OAAO,CAAC;IAC7C,eAAe,GAAG,KAAK,CAAC;IACxB,WAAW,GAAG,IAAI,CAAC;IACnB,SAAS,GAAG,QAAQ,CAAC;IACrB,OAAO,GAAG,QAAQ,CAAC;IACnB,WAAW,GAAG,UAAU,CAAC;IACzB,iBAAiB,GAA8B,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACnH,YAAY,GAAyB,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAA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CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;QACxH,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU;QACtC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG;KACxF,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,CAA4B,EAAE,CAA4B;IACvF,OAAO,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AACtG,CAAC","sourcesContent":["import type { ParticleEffectDefinition, UINode } from \"@pixi-ui-editor/schema\";\nimport { Container, Particle, ParticleContainer, Texture, type DestroyOptions } from \"pixi.js\";\nimport { lerp, ParticleSimulator, type ParticleSlot, type ParticleSpawnContext } from \"../particles.js\";\nimport { NodeView } from \"./NodeView.js\";\n\r\nconst DEG_TO_RAD = Math.PI / 180;\r\n\r\n/** Thin Pixi adapter: NodeView continues to own transforms, layout and hit testing. */\r\nexport class ParticleEmitterNodeView extends NodeView {\n private readonly contentRoot = new Container();\n private readonly simulator: ParticleSimulator<Particle>;\n private readonly renderGroups = new Map<Texture[\"source\"], ParticleRenderGroup>();\n private simulationSpace: \"local\" | \"world\" = \"local\";\n private autoplayHandled = false;\n private renderDirty = true;\n private tintStart = 0xffffff;\n private tintEnd = 0xffffff;\n private staticColor = 0xffffffff;\n private dynamicProperties: DynamicParticleProperties = { position: true, rotation: false, vertex: false, uvs: false, color: false };\n private readonly spawnContext: ParticleSpawnContext = { width: 0, height: 0, space: \"local\" };\n private renderSignature = \"\";\n private sourceSignature = \"\";\n private sourceTextures: readonly (Texture | undefined)[] = [];\n\r\n constructor(effect: ParticleEffectDefinition, textures?: ReadonlyMap<string, Texture>) {\r\n super(textures);\n this.setContent(this.contentRoot);\n this.cacheEffect(effect);\n this.simulator = new ParticleSimulator<Particle>(effect, {\n createRender: () => {\n return new Particle({ texture: Texture.EMPTY, anchorX: 0.5, anchorY: 0.5 });\n },\n hideRender: () => undefined,\n destroyRender: () => undefined,\n getWorldTransform: () => this.worldTransform,\n });\n }\n\n updateParticles(deltaSeconds: number): void {\n this.spawnContext.width = this.layoutWidth;\n this.spawnContext.height = this.layoutHeight;\n this.spawnContext.space = this.simulationSpace;\n const advanced = this.simulator.update(deltaSeconds, this.spawnContext);\n // World-space particles must also be reprojected when an ancestor moves between simulation\n // steps. Local particles need no work: Pixi applies their container transform itself.\n if (advanced || this.renderDirty || (this.simulationSpace === \"world\" && this.simulator.activeSlots.size > 0)) this.syncRender();\n }\r\n\r\n play(): void { this.simulator.play(); }\r\n pause(): void { this.simulator.pause(); }\r\n restart(): void { this.simulator.restart(); }\r\n stop(): void { this.simulator.stop(); }\r\n /** Advances exactly one fixed step even while paused, preserving the current playing/paused state. */\r\n step(): void {\n this.spawnContext.width = this.layoutWidth;\n this.spawnContext.height = this.layoutHeight;\n this.spawnContext.space = this.simulationSpace;\n this.simulator.step(this.spawnContext);\n this.syncRender();\r\n }\r\n dispose(): void {\n this.simulator.dispose();\n this.destroyRenderGroups();\n }\n setEmissionMultiplier(value: number): void { this.simulator.setEmissionMultiplier(value); }\r\n getDiagnostics() { return this.simulator.getDiagnostics(); }\r\n\r\n syncEffect(effect: ParticleEffectDefinition): void {\n this.simulator.syncEffect(effect);\n this.renderDirty ||= this.cacheEffect(effect);\n }\n\r\n override destroy(options?: DestroyOptions): void {\r\n this.dispose();\r\n super.destroy(options);\r\n }\r\n\r\n protected syncContent(node: UINode): void {\n if (node.type !== \"particle-emitter\") return;\n if (this.simulationSpace !== node.simulationSpace) this.renderDirty = true;\n this.simulationSpace = node.simulationSpace;\n // Autoplay only fires once, right after construction: syncContent also runs on every unrelated\r\n // document edit (via the shared node-sync pass), and re-arming play() there would silently\r\n // override an explicit pause()/stop() the moment the author touches anything else in the project.\r\n if (!this.autoplayHandled) {\r\n this.autoplayHandled = true;\r\n if (node.autoplay) this.simulator.play();\r\n }\r\n }\r\n\r\n private syncRender(): void {\n const p = this.simulator.definition.particle;\r\n const source = p.visual.source;\r\n const space = this.simulationSpace;\r\n const inverse = space === \"world\" ? this.worldTransform : undefined;\n const determinant = inverse === undefined ? 0 : inverse.a * inverse.d - inverse.b * inverse.c;\n const inverseDeterminant = determinant === 0 ? 0 : 1 / determinant;\n for (const group of this.renderGroups.values()) {\n group.nextCount = 0;\n group.dirty ||= this.renderDirty;\n }\n for (const slot of this.simulator.activeSlots) {\n const particle = slot.render;\n const t = slot.lifetime > 0 ? Math.min(1, slot.age / slot.lifetime) : 1;\n const sourceIndex = source.type === \"single\" ? 0 : source.type === \"random\" ? slot.sourceIndex : sequenceFrame(source, slot);\n const texture = this.sourceTextures[sourceIndex] ?? Texture.EMPTY;\n const textureChanged = particle.texture !== texture;\n if (textureChanged) particle.texture = texture;\n const initializeStatic = slot.renderDirty || this.renderDirty;\n if (this.dynamicProperties.vertex || initializeStatic) {\n const scale = lerp(slot.scaleStart, slot.scaleEnd, t);\n particle.scaleX = scale;\n particle.scaleY = scale;\n }\n if (this.dynamicProperties.rotation || initializeStatic) particle.rotation = slot.rotationDegrees * DEG_TO_RAD;\n if (this.dynamicProperties.color) particle.color = packParticleColor(lerpRgb(this.tintStart, this.tintEnd, t), lerp(p.visual.alpha.start, p.visual.alpha.end, t));\n else if (initializeStatic) particle.color = this.staticColor;\n if (space === \"world\" && inverse !== undefined) {\n const dx = slot.x - slot.spawnX, dy = slot.y - slot.spawnY;\n const worldX = slot.worldSpawnX + slot.spawnMatrixA * dx + slot.spawnMatrixC * dy;\n const worldY = slot.worldSpawnY + slot.spawnMatrixB * dx + slot.spawnMatrixD * dy;\n // Inline Matrix.applyInverse to avoid allocating one point per particle per rendered frame.\n const translatedX = worldX - inverse.tx;\n const translatedY = worldY - inverse.ty;\n particle.x = (inverse.d * translatedX - inverse.c * translatedY) * inverseDeterminant;\n particle.y = (-inverse.b * translatedX + inverse.a * translatedY) * inverseDeterminant;\n } else {\n particle.x = slot.x;\n particle.y = slot.y;\n }\n const group = this.groupFor(texture, p.visual.blendMode);\n group.dirty ||= slot.renderDirty || textureChanged || group.container.particleChildren[group.nextCount] !== particle;\n group.container.particleChildren[group.nextCount++] = particle;\n slot.renderDirty = false;\n }\n for (const group of this.renderGroups.values()) {\n const children = group.container.particleChildren;\n if (children.length !== group.nextCount) {\n children.length = group.nextCount;\n group.dirty = true;\n }\n if (group.dirty) group.container.update();\n group.dirty = false;\n }\n this.renderDirty = false;\n }\n\n private cacheEffect(effect: ParticleEffectDefinition): boolean {\n const visual = effect.particle.visual;\n const sourceIds = visual.source.type === \"single\" ? [visual.source.assetId] : visual.source.assetIds;\n const sourceTextures = sourceIds.map((id) => this.textureFor(id));\n const signature = JSON.stringify(visual);\n const sourceSignature = JSON.stringify(visual.source);\n const sourceChanged = sourceSignature !== this.sourceSignature\n || sourceTextures.length !== this.sourceTextures.length\n || sourceTextures.some((texture, index) => texture !== this.sourceTextures[index]);\n const changed = signature !== this.renderSignature\n || sourceChanged;\n if (!changed) return false;\n this.renderSignature = signature;\n this.sourceSignature = sourceSignature;\n this.sourceTextures = sourceTextures;\n // Source edits and late texture loads invalidate the source-keyed groups. Rebuild containers,\n // but keep every pooled Particle and live simulation slot intact.\n if (sourceChanged) this.destroyRenderGroups();\n const dynamicProperties = particleDynamicProperties(effect);\n if (!sameDynamicProperties(this.dynamicProperties, dynamicProperties)) {\n this.destroyRenderGroups();\n this.dynamicProperties = dynamicProperties;\n }\n this.tintStart = parseRgb(effect.particle.visual.tint.start);\n this.tintEnd = parseRgb(effect.particle.visual.tint.end);\n this.staticColor = packParticleColor(this.tintStart, effect.particle.visual.alpha.start);\n for (const group of this.renderGroups.values()) group.container.blendMode = effect.particle.visual.blendMode;\n return true;\n }\n\n private groupFor(texture: Texture, blendMode: ParticleEffectDefinition[\"particle\"][\"visual\"][\"blendMode\"]): ParticleRenderGroup {\n let group = this.renderGroups.get(texture.source);\n if (group !== undefined) return group;\n const container = new ParticleContainer<Particle>({\n texture,\n dynamicProperties: this.dynamicProperties,\n });\n container.blendMode = blendMode;\n this.contentRoot.addChild(container);\n group = { container, nextCount: 0, dirty: true };\n this.renderGroups.set(texture.source, group);\n return group;\n }\n\n private destroyRenderGroups(): void {\n for (const group of this.renderGroups.values()) {\n this.contentRoot.removeChild(group.container);\n group.container.destroy();\n }\n this.renderGroups.clear();\n }\n}\n\ntype SequenceSource = Extract<ParticleEffectDefinition[\"particle\"][\"visual\"][\"source\"], { type: \"sequence\" }>;\ntype ParticleRenderGroup = { container: ParticleContainer<Particle>; nextCount: number; dirty: boolean };\ntype DynamicParticleProperties = { position: true; rotation: boolean; vertex: boolean; uvs: boolean; color: boolean };\n\nfunction sequenceFrame(source: SequenceSource, slot: ParticleSlot<Particle>): number {\n const length = source.assetIds.length;\r\n const raw = slot.sequenceStart + Math.floor(slot.age * source.fps);\r\n return source.loop ? ((raw % length) + length) % length : Math.min(raw, length - 1);\r\n}\n\nfunction parseRgb(hex: string): number { return Number.parseInt(hex.slice(1, 7), 16); }\nfunction lerpRgb(start: number, end: number, t: number): number {\n const r = Math.round(lerp((start >>> 16) & 0xff, (end >>> 16) & 0xff, t));\n const g = Math.round(lerp((start >>> 8) & 0xff, (end >>> 8) & 0xff, t));\n const b = Math.round(lerp(start & 0xff, end & 0xff, t));\n return (r << 16) | (g << 8) | b;\n}\n/** Pixi Particle buffers store packed ABGR, unlike the public RGB tint number. */\nfunction packParticleColor(rgb: number, alpha: number): number {\n const bgr = ((rgb & 0xff) << 16) | (rgb & 0xff00) | ((rgb >>> 16) & 0xff);\n return (bgr | (Math.round(Math.max(0, Math.min(1, alpha)) * 255) << 24)) >>> 0;\n}\n\nfunction particleDynamicProperties(effect: ParticleEffectDefinition): DynamicParticleProperties {\n const visual = effect.particle.visual;\n const angular = visual.rotation.angularVelocityDegrees;\n const scale = visual.scale;\n return {\n position: true,\n rotation: angular.min !== 0 || angular.max !== 0,\n vertex: !(scale.start.min === scale.start.max && scale.start.min === scale.end.min && scale.start.min === scale.end.max),\n uvs: visual.source.type === \"sequence\",\n color: visual.tint.start !== visual.tint.end || visual.alpha.start !== visual.alpha.end,\n };\n}\n\nfunction sameDynamicProperties(a: DynamicParticleProperties, b: DynamicParticleProperties): boolean {\n return a.rotation === b.rotation && a.vertex === b.vertex && a.uvs === b.uvs && a.color === b.color;\n}\n"]}
@@ -16,6 +16,8 @@ export declare class SpineNodeView extends NodeView {
16
16
  private connectorBindings;
17
17
  private activeConnectors;
18
18
  private connectorBonesActive;
19
+ /** Layout profile the view was last synced with; connector multipliers resolve against it. */
20
+ private activeProfile;
19
21
  constructor(skeletonData: SkeletonData | undefined, animation: string | undefined, autoplay: boolean, loop: boolean, animationSpeed: number, initializeForAuthoring: boolean, referenceFrame?: SpineReferenceFrame, ticker?: Ticker);
20
22
  /** Runtime switch used by game code; authored connector definitions are inactive by default. */
21
23
  get activeConnectorBones(): boolean;
@@ -27,6 +29,13 @@ export declare class SpineNodeView extends NodeView {
27
29
  refreshConnectorBones(): void;
28
30
  private restoreConnectorTargets;
29
31
  setReferenceFrame(referenceFrame: SpineReferenceFrame | undefined): void;
32
+ /**
33
+ * Every transform application (editor gesture previews, document commits, layout updates, anchor
34
+ * resizes) recomputes active connector hosts immediately. The host's local matrix depends on the
35
+ * spine's world transform — including the fitted width/height scale — so a resize of the spine
36
+ * node must move its targets in the same pass, not on the next ticker frame or document commit.
37
+ */
38
+ protected onLayoutTransformApplied(): void;
30
39
  protected syncContent(node: UINode, transform: UINode["transform"], profile: LayoutProfileId): void;
31
40
  }
32
41
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"SpineNodeView.d.ts","sourceRoot":"","sources":["../../src/views/S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AC9F,OAAO,CAAC,aAAa,CAA8B;IAEnD,YAAY,YAAY,EAAE,YAAY,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,EAsBlO;IAED,gGAAgG;IAChG,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAED,IAAI,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAEvC;IAED,0FAA0F;IAC1F,iBAAiB,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,GAAG,IAAI,CAKpE;IAED,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAwC7C;IAED,8EAA8E;IAC9E,qBAAqB,IAAI,IAAI,CAkD5B;IAED,OAAO,CAAC,uBAAuB;IAiB/B,iBAAiB,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI,CAEvE;IAED;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI,CAEzC;IAED,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CA2BlG;CACF"}
@@ -1,4 +1,5 @@
1
1
  import { PointAttachment, RegionAttachment, Spine, Vector2 } from "@esotericsoftware/spine-pixi-v8";
2
+ import { resolveSpineConnectorPositionMultiplier } from "@pixi-ui-editor/schema";
2
3
  import { Container, Graphics, Matrix } from "pixi.js";
3
4
  import { fitSpineToTransform, resolveSpineSettings } from "../layout.js";
4
5
  import { NodeView } from "./NodeView.js";
@@ -15,6 +16,8 @@ export class SpineNodeView extends NodeView {
15
16
  connectorBindings = [];
16
17
  activeConnectors = [];
17
18
  connectorBonesActive = false;
19
+ /** Layout profile the view was last synced with; connector multipliers resolve against it. */
20
+ activeProfile = "desktop";
18
21
  constructor(skeletonData, animation, autoplay, loop, animationSpeed, initializeForAuthoring, referenceFrame, ticker) {
19
22
  super();
20
23
  this.referenceFrame = referenceFrame;
@@ -79,6 +82,8 @@ export class SpineNodeView extends NodeView {
79
82
  const snapshot = {
80
83
  partType: part.partType,
81
84
  partName: part.partName,
85
+ positionMultiplier: binding.positionMultiplier,
86
+ positionMultiplierOverrides: binding.positionMultiplierOverrides,
82
87
  target: binding.target,
83
88
  parent,
84
89
  index: parent.getChildIndex(binding.target),
@@ -128,6 +133,10 @@ export class SpineNodeView extends NodeView {
128
133
  const determinant = spineWorld.a * spineWorld.d - spineWorld.b * spineWorld.c;
129
134
  if (!Number.isFinite(determinant) || Math.abs(determinant) < 1e-8)
130
135
  continue;
136
+ // Authored per-axis position multiplier (default 1): scales the projected part position from
137
+ // the Spine node's origin before the parent transform compensation, so the target keeps its
138
+ // own size/orientation and only its offset is multiplied.
139
+ const multiplier = resolveSpineConnectorPositionMultiplier(connector, this.activeProfile);
131
140
  // The attachment position remains in original Spine source units and therefore inherits the
132
141
  // fitted Spine scale. For example, y=-650 at a 1/3 fit becomes roughly -217 on the UI scene.
133
142
  // Only the host's linear transform is compensated, so the target itself does not shrink.
@@ -135,7 +144,7 @@ export class SpineNodeView extends NodeView {
135
144
  const hostB = (-spineWorld.b * parentWorld.a + spineWorld.a * parentWorld.b) / determinant;
136
145
  const hostC = (spineWorld.d * parentWorld.c - spineWorld.c * parentWorld.d) / determinant;
137
146
  const hostD = (-spineWorld.b * parentWorld.c + spineWorld.a * parentWorld.d) / determinant;
138
- connector.host.setFromMatrix(new Matrix(hostA, hostB, hostC, hostD, spineX, spineY));
147
+ connector.host.setFromMatrix(new Matrix(hostA, hostB, hostC, hostD, spineX * multiplier.x, spineY * multiplier.y));
139
148
  connector.host.visible = slot === null
140
149
  || (spine.skeleton.drawOrder.includes(slot) && slot.attachment !== null && spine.alpha > 0 && spine.skeleton.color.a * slot.color.a > 0);
141
150
  connector.target.position.set(0, 0);
@@ -160,7 +169,18 @@ export class SpineNodeView extends NodeView {
160
169
  setReferenceFrame(referenceFrame) {
161
170
  this.referenceFrame = referenceFrame;
162
171
  }
172
+ /**
173
+ * Every transform application (editor gesture previews, document commits, layout updates, anchor
174
+ * resizes) recomputes active connector hosts immediately. The host's local matrix depends on the
175
+ * spine's world transform — including the fitted width/height scale — so a resize of the spine
176
+ * node must move its targets in the same pass, not on the next ticker frame or document commit.
177
+ */
178
+ onLayoutTransformApplied() {
179
+ if (this.connectorBonesActive)
180
+ this.refreshConnectorBones();
181
+ }
163
182
  syncContent(node, transform, profile) {
183
+ this.activeProfile = profile;
164
184
  if (this.content instanceof Spine) {
165
185
  if (node.type === "spine") {
166
186
  const settings = resolveSpineSettings(node, profile);