@pixi-ui-editor/runtime-pixi 0.6.1 → 0.7.1
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/SceneViewport.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/layoutGroups.js.map +1 -1
- package/dist/particles.js.map +1 -1
- package/dist/scene.js.map +1 -1
- package/dist/views/NodeView.js.map +1 -1
- package/dist/views/ParticleEmitterNodeView.js.map +1 -1
- package/dist/views/SpineNodeView.js.map +1 -1
- package/dist/views/StagedButtonNodeView.d.ts +7 -0
- package/dist/views/StagedButtonNodeView.d.ts.map +1 -1
- package/dist/views/StagedButtonNodeView.js +13 -2
- package/dist/views/StagedButtonNodeView.js.map +1 -1
- package/dist/views/basic.d.ts +5 -0
- package/dist/views/basic.d.ts.map +1 -1
- package/dist/views/basic.js +10 -0
- package/dist/views/basic.js.map +1 -1
- package/package.json +2 -2
|
@@ -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,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,GAAs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MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,KAAK,CAAC;QAChD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,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"]}
|
|
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,S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,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,yBAAyB,CAAC,MAAgC;IACjE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACtC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,KAAK,CAAC;QAChD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,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\";\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpineNodeView.js","sourceRoot":"","sources":["../../src/views/SpineNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAqB,MAAM,iCAAiC,CAAC;AAEvH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgBzC,SAAS,oBAAoB,CAAC,OAAgC;IAC5D,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxI,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IACpE,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,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AAQ,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;CACF","sourcesContent":["import { PointAttachment, RegionAttachment, Spine, Vector2, type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\nimport { type LayoutProfileId, type SpineConnector, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\nimport { Container, Graphics, Matrix, type Ticker } from \"pixi.js\";\nimport { fitSpineToTransform, resolveSpineSettings } from \"../layout.js\";\nimport { NodeView } from \"./NodeView.js\";\n\ntype ConnectorBinding = SpineConnector & { target: Container };\ntype RuntimeConnectorBinding = ConnectorBinding | ({ boneName: string; targetNodeId: string; target: Container } & Partial<ConnectorBinding>);\ntype ConnectorSnapshot = {\n target: Container;\n parent: Container;\n index: number;\n position: { x: number; y: number };\n scale: { x: number; y: number };\n skew: { x: number; y: number };\n pivot: { x: number; y: number };\n rotation: number;\n};\ntype ActiveConnector = ConnectorSnapshot & Pick<SpineConnector, \"partType\" | \"partName\"> & { host: Container };\n\nfunction resolveConnectorPart(binding: RuntimeConnectorBinding): Pick<SpineConnector, \"partType\" | \"partName\"> | undefined {\n if ((binding.partType === \"bone\" || binding.partType === \"slot\") && typeof binding.partName === \"string\" && binding.partName.length > 0) {\n return { partType: binding.partType, partName: binding.partName };\n }\n const boneName = \"boneName\" in binding ? binding.boneName : undefined;\n return typeof boneName === \"string\" && boneName.length > 0 ? { partType: \"bone\", partName: boneName } : undefined;\n}\n\nexport class SpineNodeView extends NodeView {\n private referenceFrame: SpineReferenceFrame | undefined;\n private readonly initializeForAuthoring: boolean;\n private connectorBindings: RuntimeConnectorBinding[] = [];\n private activeConnectors: ActiveConnector[] = [];\n private connectorBonesActive = false;\n\r\n constructor(skeletonData: SkeletonData | undefined, animation: string | undefined, autoplay: boolean, loop: boolean, animationSpeed: number, initializeForAuthoring: boolean, referenceFrame?: SpineReferenceFrame, ticker?: Ticker) {\r\n super();\n this.referenceFrame = referenceFrame;\n this.initializeForAuthoring = initializeForAuthoring;\n if (skeletonData === undefined) {\r\n this.setContent(new Graphics());\r\n return;\r\n }\r\n // The host's own Application ticker, when it passed one: a Spine left on the default\r\n // `Ticker.shared` advances its skeleton in a second rAF loop, out of band with the renderer\r\n // that actually draws it.\r\n //\r\n // An authoring view starts at the node's own autoplay setting, so a scene full of paused\r\n // skeletons subscribes to no ticker at all — the editor toggles `autoUpdate` from there.\r\n // A runtime view always keeps it on: it carries no track until game code starts an animation,\r\n // and that animation must then advance without the game touching `autoUpdate` itself.\r\n const spine = new Spine({ skeletonData, autoUpdate: initializeForAuthoring ? autoplay : true, ...(ticker === undefined ? {} : { ticker }) });\n spine.afterUpdateWorldTransforms = () => this.refreshConnectorBones();\n // Runtime leaves a disabled animation without a track, ready for game code to start on an event.\r\n // Authoring still creates the track so its frame scrubber can inspect either initial state.\r\n if ((autoplay || initializeForAuthoring) && animation !== undefined && skeletonData.findAnimation(animation) !== null) spine.state.setAnimation(0, animation, loop).timeScale = animationSpeed;\r\n this.setContent(spine);\n }\n\n /** Runtime switch used by game code; authored connector definitions are inactive by default. */\n get activeConnectorBones(): boolean {\n return this.connectorBonesActive;\n }\n\n set activeConnectorBones(active: boolean) {\n this.setConnectorBonesActive(active);\n }\n\n /** Replaces the scene-resolved connector targets, preserving the current active state. */\n setConnectorBones(bindings: readonly RuntimeConnectorBinding[]): void {\n const wasActive = this.connectorBonesActive;\n if (wasActive) this.setConnectorBonesActive(false);\n this.connectorBindings = [...bindings];\n if (wasActive) this.setConnectorBonesActive(true);\n }\n\n setConnectorBonesActive(active: boolean): void {\n if (active === this.connectorBonesActive) return;\n this.connectorBonesActive = active;\n if (!active) {\n this.restoreConnectorTargets();\n return;\n }\n\n const spine = this.getSpine();\n if (spine === undefined) return;\n for (const binding of this.connectorBindings) {\n const part = resolveConnectorPart(binding);\n if (part === undefined) continue;\n if (part.partType === \"bone\" ? spine.skeleton.findBone(part.partName) === null : spine.skeleton.findSlot(part.partName) === null) continue;\n const parent = binding.target.parent;\n if (parent === null || parent.destroyed) continue;\n const host = new Container();\n const snapshot: ActiveConnector = {\n partType: part.partType,\n partName: part.partName,\n target: binding.target,\n parent,\n index: parent.getChildIndex(binding.target),\n position: { x: binding.target.position.x, y: binding.target.position.y },\n scale: { x: binding.target.scale.x, y: binding.target.scale.y },\n skew: { x: binding.target.skew.x, y: binding.target.skew.y },\n pivot: { x: binding.target.pivot.x, y: binding.target.pivot.y },\n rotation: binding.target.rotation,\n host,\n };\n // The host genuinely belongs to the Spine view, so the authored skeleton offset inherits the\n // visual Spine fit. refreshConnectorBones compensates the host's linear transform only, so the\n // target keeps its original UI size/orientation.\n spine.addChild(host);\n host.addChild(binding.target);\n this.activeConnectors.push(snapshot);\n }\n this.refreshConnectorBones();\n }\n\n /** Reapplies bone matrices and the target's required zero local transform. */\n refreshConnectorBones(): void {\n const spine = this.getSpine();\n if (spine === undefined) return;\n for (const connector of this.activeConnectors) {\n const slot = connector.partType === \"slot\" ? spine.skeleton.findSlot(connector.partName) : null;\n const bone = connector.partType === \"bone\" ? spine.skeleton.findBone(connector.partName) : slot?.bone;\n if (bone === null || bone === undefined || connector.parent.destroyed) continue;\n // A slot itself has no transform beyond its bone, but a region attachment does: Spine stores\n // its authored Point offset in attachment.x/y. Project that attachment origin, otherwise\n // changing Point from e.g. -650 to -850 moves the visual attachment but not the UI connector.\n const attachment = slot?.attachment;\n let spineX = bone.worldX;\n let spineY = bone.worldY;\n if (attachment instanceof PointAttachment) {\n const point = attachment.computeWorldPosition(bone, new Vector2());\n spineX = point.x;\n spineY = point.y;\n } else if (attachment instanceof RegionAttachment) {\n spineX += attachment.x * bone.a + attachment.y * bone.b;\n spineY += attachment.x * bone.c + attachment.y * bone.d;\n }\n const spineWorld = spine.getGlobalTransform();\n const parentWorld = connector.parent.getGlobalTransform();\n const determinant = spineWorld.a * spineWorld.d - spineWorld.b * spineWorld.c;\n if (!Number.isFinite(determinant) || Math.abs(determinant) < 1e-8) continue;\n\n // The attachment position remains in original Spine source units and therefore inherits the\n // fitted Spine scale. For example, y=-650 at a 1/3 fit becomes roughly -217 on the UI scene.\n // Only the host's linear transform is compensated, so the target itself does not shrink.\n const hostA = (spineWorld.d * parentWorld.a - spineWorld.c * parentWorld.b) / determinant;\n const hostB = (-spineWorld.b * parentWorld.a + spineWorld.a * parentWorld.b) / determinant;\n const hostC = (spineWorld.d * parentWorld.c - spineWorld.c * parentWorld.d) / determinant;\n const hostD = (-spineWorld.b * parentWorld.c + spineWorld.a * parentWorld.d) / determinant;\n connector.host.setFromMatrix(new Matrix(\n hostA,\n hostB,\n hostC,\n hostD,\n spineX,\n spineY,\n ));\n connector.host.visible = slot === null\n || (spine.skeleton.drawOrder.includes(slot) && slot.attachment !== null && spine.alpha > 0 && spine.skeleton.color.a * slot.color.a > 0);\n connector.target.position.set(0, 0);\n }\n }\n\n private restoreConnectorTargets(): void {\n for (const connector of this.activeConnectors) {\n const { target, parent } = connector;\n if (!target.destroyed && !parent.destroyed) {\n const index = Math.min(connector.index, parent.children.length);\n parent.addChildAt(target, index);\n target.position.set(connector.position.x, connector.position.y);\n target.scale.set(connector.scale.x, connector.scale.y);\n target.skew.set(connector.skew.x, connector.skew.y);\n target.pivot.set(connector.pivot.x, connector.pivot.y);\n target.rotation = connector.rotation;\n }\n connector.host.destroy({ children: false });\n }\n this.activeConnectors = [];\n }\n\r\n setReferenceFrame(referenceFrame: SpineReferenceFrame | undefined): void {\r\n this.referenceFrame = referenceFrame;\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\n if (this.content instanceof Spine) {\n if (node.type === \"spine\") {\n const settings = resolveSpineSettings(node, profile);\n const track = this.content.state.tracks[0];\n const animationChanged = track?.animation?.name !== settings.animation;\n const loopChanged = track !== null && track !== undefined && track.loop !== settings.loop;\n if (settings.animation === undefined || (!settings.autoplay && !this.initializeForAuthoring)) {\n if (track !== null && track !== undefined) this.content.state.clearTrack(0);\n } else if ((animationChanged || loopChanged) && this.content.skeleton.data.findAnimation(settings.animation) !== null) {\n this.content.state.setAnimation(0, settings.animation, settings.loop).timeScale = settings.animationSpeed;\n } else if (track !== null && track !== undefined) {\n track.timeScale = settings.animationSpeed;\n }\n }\n const fit = fitSpineToTransform(this.content.skeleton.data, transform, this.referenceFrame);\r\n if (fit !== undefined) {\r\n this.content.scale.set(fit.scaleX, fit.scaleY);\r\n this.content.position.set(fit.x, fit.y);\r\n }\r\n // A paused Spine does not receive a ticker update. Refresh its world transforms after a\r\n // layout/viewport change so its displayed pose immediately matches the new fitted bounds.\r\n this.content.update(0);\r\n } else if (this.content instanceof Graphics) {\r\n this.content.clear().rect(0, 0, transform.width, transform.height).fill(0xff00ff);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SpineNodeView.js","sourceRoot":"","sources":["../../src/views/SpineNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAqB,MAAM,iCAAiC,CAAC;AAEvH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgBzC,SAAS,oBAAoB,CAAC,OAAgC;IAC5D,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxI,OAAO,EAAE,QAAQ,EAAE,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,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAC/C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;YAC1C,CAAC;YACD,wFAAwF;YACxF,0FAA0F;YAC1F,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,YAAY,QAAQ,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;CACF","sourcesContent":["import { PointAttachment, RegionAttachment, Spine, Vector2, type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\r\nimport { type LayoutProfileId, type SpineConnector, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container, Graphics, Matrix, type Ticker } from \"pixi.js\";\r\nimport { fitSpineToTransform, resolveSpineSettings } from \"../layout.js\";\r\nimport { NodeView } from \"./NodeView.js\";\r\n\r\ntype ConnectorBinding = SpineConnector & { target: Container };\r\ntype RuntimeConnectorBinding = ConnectorBinding | ({ boneName: string; targetNodeId: string; target: Container } & Partial<ConnectorBinding>);\r\ntype ConnectorSnapshot = {\r\n target: Container;\r\n parent: Container;\r\n index: number;\r\n position: { x: number; y: number };\r\n scale: { x: number; y: number };\r\n skew: { x: number; y: number };\r\n pivot: { x: number; y: number };\r\n rotation: number;\r\n};\r\ntype ActiveConnector = ConnectorSnapshot & Pick<SpineConnector, \"partType\" | \"partName\"> & { host: Container };\r\n\r\nfunction resolveConnectorPart(binding: RuntimeConnectorBinding): Pick<SpineConnector, \"partType\" | \"partName\"> | undefined {\r\n if ((binding.partType === \"bone\" || binding.partType === \"slot\") && typeof binding.partName === \"string\" && binding.partName.length > 0) {\r\n return { partType: binding.partType, partName: binding.partName };\r\n }\r\n const boneName = \"boneName\" in binding ? binding.boneName : undefined;\r\n return typeof boneName === \"string\" && boneName.length > 0 ? { partType: \"bone\", partName: boneName } : undefined;\r\n}\r\n\r\nexport class SpineNodeView extends NodeView {\r\n private referenceFrame: SpineReferenceFrame | undefined;\r\n private readonly initializeForAuthoring: boolean;\r\n private connectorBindings: RuntimeConnectorBinding[] = [];\r\n private activeConnectors: ActiveConnector[] = [];\r\n private connectorBonesActive = false;\r\n\r\n constructor(skeletonData: SkeletonData | undefined, animation: string | undefined, autoplay: boolean, loop: boolean, animationSpeed: number, initializeForAuthoring: boolean, referenceFrame?: SpineReferenceFrame, ticker?: Ticker) {\r\n super();\r\n this.referenceFrame = referenceFrame;\r\n this.initializeForAuthoring = initializeForAuthoring;\r\n if (skeletonData === undefined) {\r\n this.setContent(new Graphics());\r\n return;\r\n }\r\n // The host's own Application ticker, when it passed one: a Spine left on the default\r\n // `Ticker.shared` advances its skeleton in a second rAF loop, out of band with the renderer\r\n // that actually draws it.\r\n //\r\n // An authoring view starts at the node's own autoplay setting, so a scene full of paused\r\n // skeletons subscribes to no ticker at all — the editor toggles `autoUpdate` from there.\r\n // A runtime view always keeps it on: it carries no track until game code starts an animation,\r\n // and that animation must then advance without the game touching `autoUpdate` itself.\r\n const spine = new Spine({ skeletonData, autoUpdate: initializeForAuthoring ? autoplay : true, ...(ticker === undefined ? {} : { ticker }) });\r\n spine.afterUpdateWorldTransforms = () => this.refreshConnectorBones();\r\n // Runtime leaves a disabled animation without a track, ready for game code to start on an event.\r\n // Authoring still creates the track so its frame scrubber can inspect either initial state.\r\n if ((autoplay || initializeForAuthoring) && animation !== undefined && skeletonData.findAnimation(animation) !== null) spine.state.setAnimation(0, animation, loop).timeScale = animationSpeed;\r\n this.setContent(spine);\r\n }\r\n\r\n /** Runtime switch used by game code; authored connector definitions are inactive by default. */\r\n get activeConnectorBones(): boolean {\r\n return this.connectorBonesActive;\r\n }\r\n\r\n set activeConnectorBones(active: boolean) {\r\n this.setConnectorBonesActive(active);\r\n }\r\n\r\n /** Replaces the scene-resolved connector targets, preserving the current active state. */\r\n setConnectorBones(bindings: readonly RuntimeConnectorBinding[]): void {\r\n const wasActive = this.connectorBonesActive;\r\n if (wasActive) this.setConnectorBonesActive(false);\r\n this.connectorBindings = [...bindings];\r\n if (wasActive) this.setConnectorBonesActive(true);\r\n }\r\n\r\n setConnectorBonesActive(active: boolean): void {\r\n if (active === this.connectorBonesActive) return;\r\n this.connectorBonesActive = active;\r\n if (!active) {\r\n this.restoreConnectorTargets();\r\n return;\r\n }\r\n\r\n const spine = this.getSpine();\r\n if (spine === undefined) return;\r\n for (const binding of this.connectorBindings) {\r\n const part = resolveConnectorPart(binding);\r\n if (part === undefined) continue;\r\n if (part.partType === \"bone\" ? spine.skeleton.findBone(part.partName) === null : spine.skeleton.findSlot(part.partName) === null) continue;\r\n const parent = binding.target.parent;\r\n if (parent === null || parent.destroyed) continue;\r\n const host = new Container();\r\n const snapshot: ActiveConnector = {\r\n partType: part.partType,\r\n partName: part.partName,\r\n target: binding.target,\r\n parent,\r\n index: parent.getChildIndex(binding.target),\r\n position: { x: binding.target.position.x, y: binding.target.position.y },\r\n scale: { x: binding.target.scale.x, y: binding.target.scale.y },\r\n skew: { x: binding.target.skew.x, y: binding.target.skew.y },\r\n pivot: { x: binding.target.pivot.x, y: binding.target.pivot.y },\r\n rotation: binding.target.rotation,\r\n host,\r\n };\r\n // The host genuinely belongs to the Spine view, so the authored skeleton offset inherits the\r\n // visual Spine fit. refreshConnectorBones compensates the host's linear transform only, so the\r\n // target keeps its original UI size/orientation.\r\n spine.addChild(host);\r\n host.addChild(binding.target);\r\n this.activeConnectors.push(snapshot);\r\n }\r\n this.refreshConnectorBones();\r\n }\r\n\r\n /** Reapplies bone matrices and the target's required zero local transform. */\r\n refreshConnectorBones(): void {\r\n const spine = this.getSpine();\r\n if (spine === undefined) return;\r\n for (const connector of this.activeConnectors) {\r\n const slot = connector.partType === \"slot\" ? spine.skeleton.findSlot(connector.partName) : null;\r\n const bone = connector.partType === \"bone\" ? spine.skeleton.findBone(connector.partName) : slot?.bone;\r\n if (bone === null || bone === undefined || connector.parent.destroyed) continue;\r\n // A slot itself has no transform beyond its bone, but a region attachment does: Spine stores\r\n // its authored Point offset in attachment.x/y. Project that attachment origin, otherwise\r\n // changing Point from e.g. -650 to -850 moves the visual attachment but not the UI connector.\r\n const attachment = slot?.attachment;\r\n let spineX = bone.worldX;\r\n let spineY = bone.worldY;\r\n if (attachment instanceof PointAttachment) {\r\n const point = attachment.computeWorldPosition(bone, new Vector2());\r\n spineX = point.x;\r\n spineY = point.y;\r\n } else if (attachment instanceof RegionAttachment) {\r\n spineX += attachment.x * bone.a + attachment.y * bone.b;\r\n spineY += attachment.x * bone.c + attachment.y * bone.d;\r\n }\r\n const spineWorld = spine.getGlobalTransform();\r\n const parentWorld = connector.parent.getGlobalTransform();\r\n const determinant = spineWorld.a * spineWorld.d - spineWorld.b * spineWorld.c;\r\n if (!Number.isFinite(determinant) || Math.abs(determinant) < 1e-8) continue;\r\n\r\n // The attachment position remains in original Spine source units and therefore inherits the\r\n // fitted Spine scale. For example, y=-650 at a 1/3 fit becomes roughly -217 on the UI scene.\r\n // Only the host's linear transform is compensated, so the target itself does not shrink.\r\n const hostA = (spineWorld.d * parentWorld.a - spineWorld.c * parentWorld.b) / determinant;\r\n const hostB = (-spineWorld.b * parentWorld.a + spineWorld.a * parentWorld.b) / determinant;\r\n const hostC = (spineWorld.d * parentWorld.c - spineWorld.c * parentWorld.d) / determinant;\r\n const hostD = (-spineWorld.b * parentWorld.c + spineWorld.a * parentWorld.d) / determinant;\r\n connector.host.setFromMatrix(new Matrix(\r\n hostA,\r\n hostB,\r\n hostC,\r\n hostD,\r\n spineX,\r\n spineY,\r\n ));\r\n connector.host.visible = slot === null\r\n || (spine.skeleton.drawOrder.includes(slot) && slot.attachment !== null && spine.alpha > 0 && spine.skeleton.color.a * slot.color.a > 0);\r\n connector.target.position.set(0, 0);\r\n }\r\n }\r\n\r\n private restoreConnectorTargets(): void {\r\n for (const connector of this.activeConnectors) {\r\n const { target, parent } = connector;\r\n if (!target.destroyed && !parent.destroyed) {\r\n const index = Math.min(connector.index, parent.children.length);\r\n parent.addChildAt(target, index);\r\n target.position.set(connector.position.x, connector.position.y);\r\n target.scale.set(connector.scale.x, connector.scale.y);\r\n target.skew.set(connector.skew.x, connector.skew.y);\r\n target.pivot.set(connector.pivot.x, connector.pivot.y);\r\n target.rotation = connector.rotation;\r\n }\r\n connector.host.destroy({ children: false });\r\n }\r\n this.activeConnectors = [];\r\n }\r\n\r\n setReferenceFrame(referenceFrame: SpineReferenceFrame | undefined): void {\r\n this.referenceFrame = referenceFrame;\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (this.content instanceof Spine) {\r\n if (node.type === \"spine\") {\r\n const settings = resolveSpineSettings(node, profile);\r\n const track = this.content.state.tracks[0];\r\n const animationChanged = track?.animation?.name !== settings.animation;\r\n const loopChanged = track !== null && track !== undefined && track.loop !== settings.loop;\r\n if (settings.animation === undefined || (!settings.autoplay && !this.initializeForAuthoring)) {\r\n if (track !== null && track !== undefined) this.content.state.clearTrack(0);\r\n } else if ((animationChanged || loopChanged) && this.content.skeleton.data.findAnimation(settings.animation) !== null) {\r\n this.content.state.setAnimation(0, settings.animation, settings.loop).timeScale = settings.animationSpeed;\r\n } else if (track !== null && track !== undefined) {\r\n track.timeScale = settings.animationSpeed;\r\n }\r\n }\r\n const fit = fitSpineToTransform(this.content.skeleton.data, transform, this.referenceFrame);\r\n if (fit !== undefined) {\r\n this.content.scale.set(fit.scaleX, fit.scaleY);\r\n this.content.position.set(fit.x, fit.y);\r\n }\r\n // A paused Spine does not receive a ticker update. Refresh its world transforms after a\r\n // layout/viewport change so its displayed pose immediately matches the new fitted bounds.\r\n this.content.update(0);\r\n } else if (this.content instanceof Graphics) {\r\n this.content.clear().rect(0, 0, transform.width, transform.height).fill(0xff00ff);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ButtonStateKey, type LayoutPadding, type StagedButtonNode, type UINode } from "@pixi-ui-editor/schema";
|
|
2
|
+
import { FancyButton } from "@pixi/ui";
|
|
2
3
|
import type { Sound } from "@pixi/sound";
|
|
3
4
|
import { Texture } from "pixi.js";
|
|
4
5
|
import { Signal } from "typed-signals";
|
|
@@ -29,6 +30,12 @@ export declare class StagedButtonNodeView extends NodeView {
|
|
|
29
30
|
private enabledState;
|
|
30
31
|
/** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */
|
|
31
32
|
private forcedState;
|
|
33
|
+
/** Stable public signals: subscriptions survive an internal `FancyButton` rebuild. */
|
|
34
|
+
readonly onPress: FancyButton["onPress"];
|
|
35
|
+
readonly onDown: FancyButton["onDown"];
|
|
36
|
+
readonly onUp: FancyButton["onUp"];
|
|
37
|
+
readonly onHover: FancyButton["onHover"];
|
|
38
|
+
readonly onOut: FancyButton["onOut"];
|
|
32
39
|
readonly onStageChange: Signal<(stage: {
|
|
33
40
|
index: number;
|
|
34
41
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StagedButtonNodeView.d.ts","sourceRoot":"","sources":["../../src/views/StagedButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"StagedButtonNodeView.d.ts","sourceRoot":"","sources":["../../src/views/StagedButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,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export class StagedButtonNodeView extends NodeView {
|
|
|
29
29
|
enabledState;
|
|
30
30
|
/** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */
|
|
31
31
|
forcedState;
|
|
32
|
+
/** Stable public signals: subscriptions survive an internal `FancyButton` rebuild. */
|
|
33
|
+
onPress = new Signal();
|
|
34
|
+
onDown = new Signal();
|
|
35
|
+
onUp = new Signal();
|
|
36
|
+
onHover = new Signal();
|
|
37
|
+
onOut = new Signal();
|
|
32
38
|
onStageChange = new Signal();
|
|
33
39
|
constructor(node, textures, interaction, sounds) {
|
|
34
40
|
super(textures);
|
|
@@ -79,17 +85,22 @@ export class StagedButtonNodeView extends NodeView {
|
|
|
79
85
|
if (this.interaction === "authoring")
|
|
80
86
|
button.eventMode = "none";
|
|
81
87
|
else {
|
|
82
|
-
button.onPress.connect(() => {
|
|
88
|
+
button.onPress.connect((source, event) => {
|
|
83
89
|
this.next();
|
|
84
90
|
const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play();
|
|
85
91
|
if (result instanceof Promise)
|
|
86
92
|
void result.catch(() => undefined);
|
|
93
|
+
this.onPress.emit(source, event);
|
|
87
94
|
});
|
|
88
|
-
button.
|
|
95
|
+
button.onDown.connect((source, event) => this.onDown.emit(source, event));
|
|
96
|
+
button.onUp.connect((source, event) => this.onUp.emit(source, event));
|
|
97
|
+
button.onHover.connect((source, event) => {
|
|
89
98
|
const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play();
|
|
90
99
|
if (result instanceof Promise)
|
|
91
100
|
void result.catch(() => undefined);
|
|
101
|
+
this.onHover.emit(source, event);
|
|
92
102
|
});
|
|
103
|
+
button.onOut.connect((source, event) => this.onOut.emit(source, event));
|
|
93
104
|
}
|
|
94
105
|
this.button = button;
|
|
95
106
|
this.stateViews = stateViews;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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;QACzB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,8EAA8E;IAC9E,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACjC,IAAI,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO;YAC5B,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,6DAA6D;IAC7D,KAAK;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;QACrF,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,0GAA0G;IAC1G,QAAQ,CAAC,KAAqB;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type StagedButtonNode, type UINode } from \"@pixi-ui-editor/schema\";\nimport { FancyButton } from \"@pixi/ui\";\nimport type { Sound } from \"@pixi/sound\";\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { StagedButtonNode };\ntype StagedButtonStage = StagedButtonNode[\"stages\"][number];\n\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\n\n/**\n * Adapts a staged-button node to `@pixi/ui`'s `FancyButton`, exactly like `ButtonNodeView` does for a\n * plain button — this class never reimplements its pointer state machine either. It is a deliberately\n * separate component (see TASK-057): it does not extend or share behavior with `ButtonNodeView`.\n *\n * A click at runtime advances the current stage (`next()`), which respects `wrap`. Four state views\n * are created once and reused across stages: changing stage only reassigns their textures/size, never\n * replacing the view type — a full `FancyButton` rebuild only happens when a view's required *type*\n * changes (nine-slice toggled, or a texture just finished loading), because `FancyButton` gives no way\n * to swap a view after construction.\n */\nexport class StagedButtonNodeView extends NodeView {\n private button!: FancyButton;\n private stateViews!: Record<ButtonStateKey, Container>;\n private readonly interaction: SceneInteractionMode;\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\n private soundAssetIds: StagedButtonNode[\"sounds\"];\n private nineSlice: LayoutPadding | undefined;\n private stagesData: StagedButtonStage[];\n private currentStageId: string;\n private defaultStageId: string;\n private wrapState: boolean;\n private enabledState: boolean;\n /** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */\n private forcedState: ButtonStateKey | undefined;\n\n readonly onStageChange = new Signal<(stage: { index: number; value: string }) => void>();\n\n constructor(node: StagedButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\n super(textures);\n this.interaction = interaction;\n this.sounds = sounds;\n this.soundAssetIds = node.sounds;\n this.nineSlice = node.nineSlice;\n this.stagesData = node.stages;\n this.wrapState = node.wrap;\n this.defaultStageId = node.defaultStageId;\n this.currentStageId = node.stages.some((stage) => stage.id === node.defaultStageId) ? node.defaultStageId : node.stages[0]!.id;\n this.enabledState = node.enabled;\n this.buildButton();\n }\n\n private currentStage(): StagedButtonStage {\n return this.stagesData.find((stage) => stage.id === this.currentStageId) ?? this.stagesData[0]!;\n }\n\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\n if (texture === undefined) return new Graphics();\n return nineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\n }\n\n /**\n * (Re)builds `FancyButton` and its four state views for the current stage. `size`, when provided,\n * sizes the freshly built views immediately — needed because a stage change may happen well outside\n * a `syncContent` pass (e.g. a runtime click), where nothing else would resize them afterwards.\n */\n private buildButton(size?: { width: number; height: number }): void {\n const stage = this.currentStage();\n const normalTexture = this.textureFor(stage.states.normalAssetId);\n const stateViews = {} as Record<ButtonStateKey, Container>;\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = StagedButtonNodeView.createStateView(texture, this.nineSlice);\n stateViews[state] = view;\n return view;\n };\n\n const button = new FancyButton({\n defaultView: viewFor(\"normal\", stage.states.normalAssetId),\n hoverView: viewFor(\"hover\", stage.states.hoverAssetId),\n pressedView: viewFor(\"pressed\", stage.states.pressedAssetId),\n disabledView: viewFor(\"disabled\", stage.states.disabledAssetId),\n });\n // Authoring-сцена инертна, как и у обычной кнопки: клики не должны крутить стадию, а попадание по\n // ноде остаётся ответственностью NodeView.containsPoint.\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\n else {\n button.onPress.connect(() => {\n this.next();\n const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play();\n if (result instanceof Promise) void result.catch(() => undefined);\n });\n button.onHover.connect(() => {\n const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play();\n if (result instanceof Promise) void result.catch(() => undefined);\n });\n }\n this.button = button;\n this.stateViews = stateViews;\n this.setContent(button);\n\n const resolved = size ?? this.layoutRectangle;\n this.applySizes(resolved.width, resolved.height);\n\n // Пересборка — деталь реализации `FancyButton`, а не действие пользователя: transient enabled и\n // визуальное состояние восстанавливаются на новом инстансе, иначе переключение nine-slice или\n // догрузка текстуры сбрасывали бы их.\n this.applyEnabled(this.enabledState);\n if (this.forcedState !== undefined) this.button.setState(FANCY_STATE_BY_KEY[this.forcedState]);\n }\n\n /**\n * Sizes the four state views to the resolved layout rectangle without touching their textures.\n *\n * `NineSliceSprite` проверяется отдельно: в PixiJS 8 он наследуется от `ViewContainer`, а не от\n * `Sprite`, поэтому одна ветка `instanceof Sprite` его молча пропускает.\n */\n private applySizes(width: number, height: number): void {\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n if (view instanceof NineSliceSprite) view.setSize(width, height);\n else if (view instanceof Sprite) view.setSize(width, height);\n else if (view instanceof Graphics) view.clear().rect(0, 0, width, height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\n }\n }\n\n /**\n * Applies the current stage's textures/border to the existing state views (or rebuilds them if a\n * view's required type no longer matches, the same rule `ButtonNodeView.syncContent` follows).\n */\n private refreshStateViews(width: number, height: number): void {\n const stage = this.currentStage();\n const normalTexture = this.textureFor(stage.states.normalAssetId);\n\n let needsRebuild = false;\n for (const state of BUTTON_STATE_KEYS) {\n const assetId = stage.states[`${state}AssetId`];\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = this.stateViews[state];\n const wantsNineSlice = texture !== undefined && this.nineSlice !== undefined;\n // `NineSliceSprite` не наследуется от `Sprite` в PixiJS 8, поэтому ветки не пересекаются.\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite;\n if (!matches) { needsRebuild = true; break; }\n }\n\n if (needsRebuild) {\n this.buildButton({ width, height });\n return;\n }\n\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n const assetId = stage.states[`${state}AssetId`];\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\n if (view instanceof NineSliceSprite) {\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\n if (this.nineSlice !== undefined) {\n view.leftWidth = this.nineSlice.left;\n view.topHeight = this.nineSlice.top;\n view.rightWidth = this.nineSlice.right;\n view.bottomHeight = this.nineSlice.bottom;\n }\n } else if (view instanceof Sprite) {\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\n }\n }\n this.applySizes(width, height);\n }\n\n private applyStage(stageId: string): void {\n this.currentStageId = stageId;\n const { width, height } = this.layoutRectangle;\n this.refreshStateViews(width, height);\n }\n\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\n private applyEnabled(enabled: boolean): void {\n this.enabledState = enabled;\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\n else this.button.setState(enabled ? \"default\" : \"disabled\");\n }\n\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\n if (node.type !== \"staged-button\") return;\n this.soundAssetIds = node.sounds;\n this.nineSlice = node.nineSlice;\n this.wrapState = node.wrap;\n this.defaultStageId = node.defaultStageId;\n\n // Сохраняет текущую стадию, если она ещё существует после изменения документа; если стадию\n // удалили — переходит на ближайшую валидную по прежнему индексу.\n const previousIndex = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\n this.stagesData = node.stages;\n if (!node.stages.some((stage) => stage.id === this.currentStageId)) {\n const clampedIndex = Math.min(Math.max(previousIndex, 0), node.stages.length - 1);\n this.currentStageId = node.stages[clampedIndex]!.id;\n }\n\n this.refreshStateViews(transform.width, transform.height);\n\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\n }\n\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\n previewNineSlice(nineSlice: LayoutPadding): void {\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n if (!(view instanceof NineSliceSprite)) continue;\n view.leftWidth = nineSlice.left;\n view.topHeight = nineSlice.top;\n view.rightWidth = nineSlice.right;\n view.bottomHeight = nineSlice.bottom;\n }\n }\n\n get enabled(): boolean {\n return this.enabledState;\n }\n\n set enabled(value: boolean) {\n this.applyEnabled(value);\n }\n\n get stage(): number {\n const index = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\n return index === -1 ? 0 : index;\n }\n\n get value(): string {\n return this.currentStage().value;\n }\n\n get stageCount(): number {\n return this.stagesData.length;\n }\n\n /** Moves to the stage at `index` and emits `onStageChange`; an out-of-range index is a no-op. */\n setStage(index: number): void {\n const target = this.stagesData[index];\n if (target === undefined) return;\n this.applyStage(target.id);\n this.onStageChange.emit({ index, value: target.value });\n }\n\n /** Moves to the stage at `index` without emitting — used by editor preview to avoid feedback loops. */\n forceStage(index: number): void {\n const target = this.stagesData[index];\n if (target === undefined) return;\n this.applyStage(target.id);\n }\n\n /** Moves to the first stage whose `value` matches; an unknown value is ignored. */\n setValue(value: string): void {\n const index = this.stagesData.findIndex((stage) => stage.value === value);\n if (index === -1) return;\n this.setStage(index);\n }\n\n /** Advances one stage, as a click does; respects `wrap` at the last stage. */\n next(): void {\n const nextIndex = this.stage + 1;\n if (nextIndex >= this.stagesData.length) {\n if (!this.wrapState) return;\n this.setStage(0);\n return;\n }\n this.setStage(nextIndex);\n }\n\n /** Returns to `defaultStageId`, emitting `onStageChange`. */\n reset(): void {\n const index = this.stagesData.findIndex((stage) => stage.id === this.defaultStageId);\n this.setStage(index === -1 ? 0 : index);\n }\n\n /** Forces an editor-only visual state without changing `enabled`, mirroring `ButtonNodeView.setState`. */\n setState(state: ButtonStateKey): void {\n this.forcedState = state;\n this.button.setState(FANCY_STATE_BY_KEY[state]);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StagedButtonNodeView.js","sourceRoot":"","sources":["../../src/views/StagedButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+E,MAAM,wBAAwB,CAAC;AACxI,OAAO,EAA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AAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC;QACrF,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,0GAA0G;IAC1G,QAAQ,CAAC,KAAqB;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type StagedButtonNode, 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 { Signal } from \"typed-signals\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type { StagedButtonNode };\r\ntype StagedButtonStage = StagedButtonNode[\"stages\"][number];\r\ntype FancyButtonEventHandler = Parameters<FancyButton[\"onPress\"][\"connect\"]>[0];\r\n\r\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\n\r\n/**\r\n * Adapts a staged-button node to `@pixi/ui`'s `FancyButton`, exactly like `ButtonNodeView` does for a\r\n * plain button — this class never reimplements its pointer state machine either. It is a deliberately\r\n * separate component (see TASK-057): it does not extend or share behavior with `ButtonNodeView`.\r\n *\r\n * A click at runtime advances the current stage (`next()`), which respects `wrap`. Four state views\r\n * are created once and reused across stages: changing stage only reassigns their textures/size, never\r\n * replacing the view type — a full `FancyButton` rebuild only happens when a view's required *type*\r\n * changes (nine-slice toggled, or a texture just finished loading), because `FancyButton` gives no way\r\n * to swap a view after construction.\r\n */\r\nexport class StagedButtonNodeView 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: StagedButtonNode[\"sounds\"];\r\n private nineSlice: LayoutPadding | undefined;\r\n private stagesData: StagedButtonStage[];\r\n private currentStageId: string;\r\n private defaultStageId: string;\r\n private wrapState: boolean;\r\n private enabledState: boolean;\r\n /** Последнее editor-only визуальное состояние из `setState`: переживает пересборку `FancyButton`. */\r\n private forcedState: ButtonStateKey | undefined;\r\n\r\n /** Stable public signals: subscriptions survive an internal `FancyButton` rebuild. */\r\n readonly onPress: FancyButton[\"onPress\"] = new Signal<FancyButtonEventHandler>();\r\n readonly onDown: FancyButton[\"onDown\"] = new Signal<FancyButtonEventHandler>();\r\n readonly onUp: FancyButton[\"onUp\"] = new Signal<FancyButtonEventHandler>();\r\n readonly onHover: FancyButton[\"onHover\"] = new Signal<FancyButtonEventHandler>();\r\n readonly onOut: FancyButton[\"onOut\"] = new Signal<FancyButtonEventHandler>();\r\n readonly onStageChange = new Signal<(stage: { index: number; value: string }) => void>();\r\n\r\n constructor(node: StagedButtonNode, 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.nineSlice = node.nineSlice;\r\n this.stagesData = node.stages;\r\n this.wrapState = node.wrap;\r\n this.defaultStageId = node.defaultStageId;\r\n this.currentStageId = node.stages.some((stage) => stage.id === node.defaultStageId) ? node.defaultStageId : node.stages[0]!.id;\r\n this.enabledState = node.enabled;\r\n this.buildButton();\r\n }\r\n\r\n private currentStage(): StagedButtonStage {\r\n return this.stagesData.find((stage) => stage.id === this.currentStageId) ?? this.stagesData[0]!;\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\r\n if (texture === undefined) return new Graphics();\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n /**\r\n * (Re)builds `FancyButton` and its four state views for the current stage. `size`, when provided,\r\n * sizes the freshly built views immediately — needed because a stage change may happen well outside\r\n * a `syncContent` pass (e.g. a runtime click), where nothing else would resize them afterwards.\r\n */\r\n private buildButton(size?: { width: number; height: number }): void {\r\n const stage = this.currentStage();\r\n const normalTexture = this.textureFor(stage.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 = StagedButtonNodeView.createStateView(texture, this.nineSlice);\r\n stateViews[state] = view;\r\n return view;\r\n };\r\n\r\n const button = new FancyButton({\r\n defaultView: viewFor(\"normal\", stage.states.normalAssetId),\r\n hoverView: viewFor(\"hover\", stage.states.hoverAssetId),\r\n pressedView: viewFor(\"pressed\", stage.states.pressedAssetId),\r\n disabledView: viewFor(\"disabled\", stage.states.disabledAssetId),\r\n });\r\n // Authoring-сцена инертна, как и у обычной кнопки: клики не должны крутить стадию, а попадание по\r\n // ноде остаётся ответственностью NodeView.containsPoint.\r\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\r\n else {\r\n button.onPress.connect((source, event) => {\r\n this.next();\r\n const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play();\r\n if (result instanceof Promise) void result.catch(() => undefined);\r\n this.onPress.emit(source, event);\r\n });\r\n button.onDown.connect((source, event) => this.onDown.emit(source, event));\r\n button.onUp.connect((source, event) => this.onUp.emit(source, event));\r\n button.onHover.connect((source, event) => {\r\n const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play();\r\n if (result instanceof Promise) void result.catch(() => undefined);\r\n this.onHover.emit(source, event);\r\n });\r\n button.onOut.connect((source, event) => this.onOut.emit(source, event));\r\n }\r\n this.button = button;\r\n this.stateViews = stateViews;\r\n this.setContent(button);\r\n\r\n const resolved = size ?? this.layoutRectangle;\r\n this.applySizes(resolved.width, resolved.height);\r\n\r\n // Пересборка — деталь реализации `FancyButton`, а не действие пользователя: transient enabled и\r\n // визуальное состояние восстанавливаются на новом инстансе, иначе переключение nine-slice или\r\n // догрузка текстуры сбрасывали бы их.\r\n this.applyEnabled(this.enabledState);\r\n if (this.forcedState !== undefined) this.button.setState(FANCY_STATE_BY_KEY[this.forcedState]);\r\n }\r\n\r\n /**\r\n * Sizes the four state views to the resolved layout rectangle without touching their textures.\r\n *\r\n * `NineSliceSprite` проверяется отдельно: в PixiJS 8 он наследуется от `ViewContainer`, а не от\r\n * `Sprite`, поэтому одна ветка `instanceof Sprite` его молча пропускает.\r\n */\r\n private applySizes(width: number, height: number): void {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n if (view instanceof NineSliceSprite) view.setSize(width, height);\r\n else if (view instanceof Sprite) view.setSize(width, height);\r\n else if (view instanceof Graphics) view.clear().rect(0, 0, width, height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n }\r\n }\r\n\r\n /**\r\n * Applies the current stage's textures/border to the existing state views (or rebuilds them if a\r\n * view's required type no longer matches, the same rule `ButtonNodeView.syncContent` follows).\r\n */\r\n private refreshStateViews(width: number, height: number): void {\r\n const stage = this.currentStage();\r\n const normalTexture = this.textureFor(stage.states.normalAssetId);\r\n\r\n let needsRebuild = false;\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const assetId = stage.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 && this.nineSlice !== undefined;\r\n // `NineSliceSprite` не наследуется от `Sprite` в PixiJS 8, поэтому ветки не пересекаются.\r\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite;\r\n if (!matches) { needsRebuild = true; break; }\r\n }\r\n\r\n if (needsRebuild) {\r\n this.buildButton({ width, height });\r\n return;\r\n }\r\n\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n const assetId = stage.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 (this.nineSlice !== undefined) {\r\n view.leftWidth = this.nineSlice.left;\r\n view.topHeight = this.nineSlice.top;\r\n view.rightWidth = this.nineSlice.right;\r\n view.bottomHeight = this.nineSlice.bottom;\r\n }\r\n } else if (view instanceof Sprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n }\r\n }\r\n this.applySizes(width, height);\r\n }\r\n\r\n private applyStage(stageId: string): void {\r\n this.currentStageId = stageId;\r\n const { width, height } = this.layoutRectangle;\r\n this.refreshStateViews(width, height);\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 !== \"staged-button\") return;\r\n this.soundAssetIds = node.sounds;\r\n this.nineSlice = node.nineSlice;\r\n this.wrapState = node.wrap;\r\n this.defaultStageId = node.defaultStageId;\r\n\r\n // Сохраняет текущую стадию, если она ещё существует после изменения документа; если стадию\r\n // удалили — переходит на ближайшую валидную по прежнему индексу.\r\n const previousIndex = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\r\n this.stagesData = node.stages;\r\n if (!node.stages.some((stage) => stage.id === this.currentStageId)) {\r\n const clampedIndex = Math.min(Math.max(previousIndex, 0), node.stages.length - 1);\r\n this.currentStageId = node.stages[clampedIndex]!.id;\r\n }\r\n\r\n this.refreshStateViews(transform.width, transform.height);\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 stage(): number {\r\n const index = this.stagesData.findIndex((stage) => stage.id === this.currentStageId);\r\n return index === -1 ? 0 : index;\r\n }\r\n\r\n get value(): string {\r\n return this.currentStage().value;\r\n }\r\n\r\n get stageCount(): number {\r\n return this.stagesData.length;\r\n }\r\n\r\n /** Moves to the stage at `index` and emits `onStageChange`; an out-of-range index is a no-op. */\r\n setStage(index: number): void {\r\n const target = this.stagesData[index];\r\n if (target === undefined) return;\r\n this.applyStage(target.id);\r\n this.onStageChange.emit({ index, value: target.value });\r\n }\r\n\r\n /** Moves to the stage at `index` without emitting — used by editor preview to avoid feedback loops. */\r\n forceStage(index: number): void {\r\n const target = this.stagesData[index];\r\n if (target === undefined) return;\r\n this.applyStage(target.id);\r\n }\r\n\r\n /** Moves to the first stage whose `value` matches; an unknown value is ignored. */\r\n setValue(value: string): void {\r\n const index = this.stagesData.findIndex((stage) => stage.value === value);\r\n if (index === -1) return;\r\n this.setStage(index);\r\n }\r\n\r\n /** Advances one stage, as a click does; respects `wrap` at the last stage. */\r\n next(): void {\r\n const nextIndex = this.stage + 1;\r\n if (nextIndex >= this.stagesData.length) {\r\n if (!this.wrapState) return;\r\n this.setStage(0);\r\n return;\r\n }\r\n this.setStage(nextIndex);\r\n }\r\n\r\n /** Returns to `defaultStageId`, emitting `onStageChange`. */\r\n reset(): void {\r\n const index = this.stagesData.findIndex((stage) => stage.id === this.defaultStageId);\r\n this.setStage(index === -1 ? 0 : index);\r\n }\r\n\r\n /** Forces an editor-only visual state without changing `enabled`, mirroring `ButtonNodeView.setState`. */\r\n setState(state: ButtonStateKey): void {\r\n this.forcedState = state;\r\n this.button.setState(FANCY_STATE_BY_KEY[state]);\r\n }\r\n}\r\n"]}
|
package/dist/views/basic.d.ts
CHANGED
|
@@ -102,6 +102,11 @@ export declare class BitmapTextNodeView extends NodeView {
|
|
|
102
102
|
private lastVerticalAlign;
|
|
103
103
|
constructor(fonts?: ReadonlyMap<string, string> | undefined);
|
|
104
104
|
protected syncContent(node: UINode, transform: UINode["transform"]): void;
|
|
105
|
+
/**
|
|
106
|
+
* Updates the rendered bitmap text without reapplying the node transform. This lets game code
|
|
107
|
+
* refresh counters that are temporarily attached to a Spine connector without dislodging them.
|
|
108
|
+
*/
|
|
109
|
+
setText(text: string): void;
|
|
105
110
|
/**
|
|
106
111
|
* Applies the node's style at the largest font size (down to `minFontSize`) that keeps the text
|
|
107
112
|
* inside `transform`, when `autoSize` is on — the same "shrink, never grow past the authored size"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,eAAe,EAA2C,KAAK,MAAM,EAAE,MAAM,wBA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kBAAmB,SAAQ,QAAQ;IAKlC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAJnC,OAAO,CAAC,aAAa,CAAC,CAAsB;IAC5C,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,iBAAiB,CAAsC;gBAElC,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,YAAA;IAKhE,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;IAkBzE;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM3B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IA6BxB;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK;CASd;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,QAAQ;gBACtC,QAAQ,EAAE,OAAO;IAK7B,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;CAG3E"}
|
package/dist/views/basic.js
CHANGED
|
@@ -304,6 +304,16 @@ export class BitmapTextNodeView extends NodeView {
|
|
|
304
304
|
this.applyFittedStyle(bitmapText, node, family, transform);
|
|
305
305
|
this.align();
|
|
306
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Updates the rendered bitmap text without reapplying the node transform. This lets game code
|
|
309
|
+
* refresh counters that are temporarily attached to a Spine connector without dislodging them.
|
|
310
|
+
*/
|
|
311
|
+
setText(text) {
|
|
312
|
+
if (!(this.content instanceof BitmapText) || this.content.text === text)
|
|
313
|
+
return;
|
|
314
|
+
this.content.text = text;
|
|
315
|
+
this.align();
|
|
316
|
+
}
|
|
307
317
|
/**
|
|
308
318
|
* Applies the node's style at the largest font size (down to `minFontSize`) that keeps the text
|
|
309
319
|
* inside `transform`, when `autoSize` is on — the same "shrink, never grow past the authored size"
|