@pixi-ui-editor/runtime-pixi 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SceneViewport.js.map +1 -1
- package/dist/assets/bitmapFonts.d.ts.map +1 -1
- package/dist/assets/bitmapFonts.js +3 -1
- package/dist/assets/bitmapFonts.js.map +1 -1
- package/dist/controls.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +3 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +13 -0
- package/dist/layout.js.map +1 -1
- package/dist/particles.js.map +1 -1
- package/dist/scene.js.map +1 -1
- package/dist/views/ButtonNodeView.d.ts +1 -0
- package/dist/views/ButtonNodeView.d.ts.map +1 -1
- package/dist/views/ButtonNodeView.js +6 -0
- package/dist/views/ButtonNodeView.js.map +1 -1
- package/dist/views/ItemTableNodeView.js.map +1 -1
- package/dist/views/PaginationNodeView.js.map +1 -1
- package/dist/views/ParticleEmitterNodeView.js.map +1 -1
- package/dist/views/StagedButtonNodeView.d.ts +1 -0
- package/dist/views/StagedButtonNodeView.d.ts.map +1 -1
- package/dist/views/StagedButtonNodeView.js +6 -0
- package/dist/views/StagedButtonNodeView.js.map +1 -1
- package/dist/views/basic.d.ts +1 -1
- package/dist/views/basic.d.ts.map +1 -1
- package/dist/views/basic.js +13 -12
- package/dist/views/basic.js.map +1 -1
- package/dist/views/createNodeView.js +1 -1
- package/dist/views/createNodeView.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,OAA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AAC,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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Q,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"]}
|
|
@@ -51,6 +51,7 @@ export declare class StagedButtonNodeView extends NodeView {
|
|
|
51
51
|
*/
|
|
52
52
|
private static paintPlaceholder;
|
|
53
53
|
private static createStateView;
|
|
54
|
+
private static applyStateAppearance;
|
|
54
55
|
/**
|
|
55
56
|
* (Re)builds `FancyButton` and its four state views for the current stage. `size`, when provided,
|
|
56
57
|
* sizes the freshly built views immediately — needed because a stage change may happen well outside
|
|
@@ -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;AACxI,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAgD,OAAO,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAA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MAAM,CAEvB;IAED,iGAAiG;IACjG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAK5B;IAED,uGAAuG;IACvG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI9B;IAED,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI5B;IAED,8EAA8E;IAC9E,IAAI,IAAI,IAAI,CAQX;IAED,6DAA6D;IAC7D,KAAK,IAAI,IAAI,CAGZ;IAED,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAGpC;CACF"}
|
|
@@ -74,6 +74,10 @@ export class StagedButtonNodeView extends NodeView {
|
|
|
74
74
|
? new Sprite(texture)
|
|
75
75
|
: new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });
|
|
76
76
|
}
|
|
77
|
+
static applyStateAppearance(view, stage, state) {
|
|
78
|
+
view.tint = stage.states[`${state}Tint`] ?? "#ffffff";
|
|
79
|
+
view.alpha = stage.states[`${state}Opacity`] ?? 1;
|
|
80
|
+
}
|
|
77
81
|
/**
|
|
78
82
|
* (Re)builds `FancyButton` and its four state views for the current stage. `size`, when provided,
|
|
79
83
|
* sizes the freshly built views immediately — needed because a stage change may happen well outside
|
|
@@ -90,6 +94,7 @@ export class StagedButtonNodeView extends NodeView {
|
|
|
90
94
|
const viewFor = (state, assetId) => {
|
|
91
95
|
const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;
|
|
92
96
|
const view = StagedButtonNodeView.createStateView(texture, this.nineSlice, resolvedSize);
|
|
97
|
+
StagedButtonNodeView.applyStateAppearance(view, stage, state);
|
|
93
98
|
stateViews[state] = view;
|
|
94
99
|
return view;
|
|
95
100
|
};
|
|
@@ -193,6 +198,7 @@ export class StagedButtonNodeView extends NodeView {
|
|
|
193
198
|
if (texture !== undefined && view.texture !== texture)
|
|
194
199
|
view.texture = texture;
|
|
195
200
|
}
|
|
201
|
+
StagedButtonNodeView.applyStateAppearance(view, stage, state);
|
|
196
202
|
}
|
|
197
203
|
this.applySizes(width, height);
|
|
198
204
|
}
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAW,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAMpE,MAAM,kBAAkB,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAW,CAAC;AAEpH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,QAAQ;IACxC,MAAM,CAAe;IACrB,UAAU,CAAqC;IACtC,WAAW,CAAuB;IAClC,MAAM,CAAyC;IACxD,aAAa,CAA6B;IAC1C,SAAS,CAA4B;IACrC,UAAU,CAAsB;IAChC,cAAc,CAAS;IACvB,cAAc,CAAS;IACvB,SAAS,CAAU;IACnB,YAAY,CAAU;IAC9B,qGAAqG;IAC7F,WAAW,CAA6B;IAEhD,sFAAsF;IAC7E,OAAO,GAA2B,IAAI,MAAM,EAA2B,CAAC;IACxE,MAAM,GAA0B,IAAI,MAAM,EAA2B,CAAC;IACtE,IAAI,GAAwB,IAAI,MAAM,EAA2B,CAAC;IAClE,OAAO,GAA2B,IAAI,MAAM,EAA2B,CAAC;IACxE,KAAK,GAAyB,IAAI,MAAM,EAA2B,CAAC;IACpE,aAAa,GAAG,IAAI,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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 // Explicit size, not the `this.layoutRectangle` default `buildButton()` would otherwise fall back\r\n // to: no layout pass has run yet at construction time, so that getter still reads `{0, 0}`.\r\n this.buildButton({ width: node.transform.width, height: node.transform.height });\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 /**\r\n * Invisible (alpha 0) but still hit-testable: Pixi's `containsPoint` hit-tests the fill's geometry\r\n * regardless of its alpha. Painted with a real size *before* the view ever reaches `FancyButton`:\r\n * `FancyButton` reads `defaultView`'s bounds exactly once, synchronously during construction, to\r\n * freeze its own `hitArea` — it never re-reads them afterwards. A `Graphics` still at its default\r\n * (0, 0) size at that moment would freeze a zero-size, permanently unclickable hit area.\r\n */\r\n private static paintPlaceholder(graphics: Graphics, width: number, height: number): void {\r\n graphics.clear().rect(0, 0, width, height).fill({ color: 0x000000, alpha: 0 });\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined, size: { width: number; height: number }): Container {\r\n if (texture === undefined) {\r\n const graphics = new Graphics();\r\n StagedButtonNodeView.paintPlaceholder(graphics, size.width, size.height);\r\n return graphics;\r\n }\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n /**\r\n * (Re)builds `FancyButton` and its four state views 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. The\r\n * constructor also always passes it explicitly: `this.layoutRectangle` is still `{0, 0}` before the\r\n * first layout pass, and an initial placeholder painted at that size would freeze a zero-size,\r\n * permanently unclickable `hitArea` on `FancyButton` (see `paintPlaceholder`).\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 resolvedSize = size ?? this.layoutRectangle;\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, resolvedSize);\r\n stateViews[state] = view;\r\n return view;\r\n };\r\n\r\n const button = new FancyButton({\r\n defaultView: viewFor(\"normal\", 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 this.applySizes(resolvedSize.width, resolvedSize.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) StagedButtonNodeView.paintPlaceholder(view, width, height);\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"]}
|
|
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,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAW,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAMpE,MAAM,kBAAkB,GAAG,EAAE,MAA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AAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAC1E,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,OAAO;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\";\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 // Explicit size, not the `this.layoutRectangle` default `buildButton()` would otherwise fall back\r\n // to: no layout pass has run yet at construction time, so that getter still reads `{0, 0}`.\r\n this.buildButton({ width: node.transform.width, height: node.transform.height });\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 /**\r\n * Invisible (alpha 0) but still hit-testable: Pixi's `containsPoint` hit-tests the fill's geometry\r\n * regardless of its alpha. Painted with a real size *before* the view ever reaches `FancyButton`:\r\n * `FancyButton` reads `defaultView`'s bounds exactly once, synchronously during construction, to\r\n * freeze its own `hitArea` — it never re-reads them afterwards. A `Graphics` still at its default\r\n * (0, 0) size at that moment would freeze a zero-size, permanently unclickable hit area.\r\n */\r\n private static paintPlaceholder(graphics: Graphics, width: number, height: number): void {\r\n graphics.clear().rect(0, 0, width, height).fill({ color: 0x000000, alpha: 0 });\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined, size: { width: number; height: number }): Container {\r\n if (texture === undefined) {\r\n const graphics = new Graphics();\r\n StagedButtonNodeView.paintPlaceholder(graphics, size.width, size.height);\r\n return graphics;\r\n }\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n private static applyStateAppearance(view: Container, stage: StagedButtonStage, state: ButtonStateKey): void {\r\n view.tint = stage.states[`${state}Tint`] ?? \"#ffffff\";\r\n view.alpha = stage.states[`${state}Opacity`] ?? 1;\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. The\r\n * constructor also always passes it explicitly: `this.layoutRectangle` is still `{0, 0}` before the\r\n * first layout pass, and an initial placeholder painted at that size would freeze a zero-size,\r\n * permanently unclickable `hitArea` on `FancyButton` (see `paintPlaceholder`).\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 resolvedSize = size ?? this.layoutRectangle;\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, resolvedSize);\r\n StagedButtonNodeView.applyStateAppearance(view, stage, state);\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 this.applySizes(resolvedSize.width, resolvedSize.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) StagedButtonNodeView.paintPlaceholder(view, width, height);\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 StagedButtonNodeView.applyStateAppearance(view, stage, state);\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
|
@@ -129,7 +129,7 @@ export declare class BitmapTextNodeView extends NodeView {
|
|
|
129
129
|
private lastAlign;
|
|
130
130
|
private lastVerticalAlign;
|
|
131
131
|
constructor(fonts?: ReadonlyMap<string, string> | undefined);
|
|
132
|
-
protected syncContent(node: UINode, transform: UINode["transform"]): void;
|
|
132
|
+
protected syncContent(node: UINode, transform: UINode["transform"], profile: LayoutProfileId): void;
|
|
133
133
|
/**
|
|
134
134
|
* Updates the rendered bitmap text without reapplying the node transform. This lets game code
|
|
135
135
|
* refresh counters that are temporarily attached to a Spine connector without dislodging them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,aAAa,EAAE,KAAK,eAAe,EAA0D,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3L,OAAO,EAAc,SAAS,EAA2C,OAAO,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGpE,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,SAAS,CAAC,WAAW,IAAI,IAAI,CAAG;CACjC;AAED,iFAAiF;AACjF,qBAAa,YAAa,SAAQ,QAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAE5C,cAMC;IAED,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAGxE;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IACnD,8FAA8F;IAC9F,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,eAAe,CAAK;IAE5B,YAAY,WAAW,EAAE,oBAAoB,EAG5C;IAED,2GAA2G;IAC3G,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAG5C;IAED,OAAO,CAAC,YAAY;IAQpB,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIxC;CACF;AAED,yHAAyH;AACzH,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,OAAO,CAAC,UAAU,CAAC,CAAS;I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AAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,iBAAiB,CAAsC;IAE/D,YAA6B,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,YAAA,EAG/D;IAED,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAiBlG;IAED;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IA6BxB;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK;CASd;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,YAAY,QAAQ,EAAE,OAAO,EAG5B;IAED,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAEzE;CACF"}
|
package/dist/views/basic.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { applyTextCase } from "@pixi-ui-editor/schema";
|
|
2
2
|
import { BitmapText, Container, Graphics, NineSliceSprite, Sprite, Text } from "pixi.js";
|
|
3
3
|
import { NodeView } from "./NodeView.js";
|
|
4
|
-
import { resolveTextStyle } from "../layout.js";
|
|
4
|
+
import { resolveBitmapTextStyle, resolveTextStyle } from "../layout.js";
|
|
5
5
|
export class ContainerNodeView extends NodeView {
|
|
6
6
|
syncContent() { }
|
|
7
7
|
}
|
|
@@ -334,13 +334,14 @@ export class BitmapTextNodeView extends NodeView {
|
|
|
334
334
|
this.fonts = fonts;
|
|
335
335
|
this.setContent(new Graphics());
|
|
336
336
|
}
|
|
337
|
-
syncContent(node, transform) {
|
|
337
|
+
syncContent(node, transform, profile) {
|
|
338
338
|
if (node.type !== "bitmap-text")
|
|
339
339
|
return;
|
|
340
|
+
const style = resolveBitmapTextStyle(node, profile);
|
|
340
341
|
this.lastTransform = transform;
|
|
341
|
-
this.lastAlign =
|
|
342
|
-
this.lastVerticalAlign =
|
|
343
|
-
const family = this.fonts?.get(
|
|
342
|
+
this.lastAlign = style.align;
|
|
343
|
+
this.lastVerticalAlign = style.verticalAlign;
|
|
344
|
+
const family = this.fonts?.get(style.assetId);
|
|
344
345
|
if (family === undefined) {
|
|
345
346
|
if (!(this.content instanceof Graphics))
|
|
346
347
|
this.setContent(new Graphics());
|
|
@@ -348,11 +349,11 @@ export class BitmapTextNodeView extends NodeView {
|
|
|
348
349
|
return;
|
|
349
350
|
}
|
|
350
351
|
if (!(this.content instanceof BitmapText))
|
|
351
|
-
this.setContent(new BitmapText({ text: node.text, style: { fontFamily: family, fontSize:
|
|
352
|
+
this.setContent(new BitmapText({ text: node.text, style: { fontFamily: family, fontSize: style.fontSize, fill: style.fill } }));
|
|
352
353
|
const bitmapText = this.content;
|
|
353
354
|
if (bitmapText.text !== node.text)
|
|
354
355
|
bitmapText.text = node.text;
|
|
355
|
-
this.applyFittedStyle(bitmapText, node, family, transform);
|
|
356
|
+
this.applyFittedStyle(bitmapText, node, style, family, transform);
|
|
356
357
|
this.align();
|
|
357
358
|
}
|
|
358
359
|
/**
|
|
@@ -372,8 +373,8 @@ export class BitmapTextNodeView extends NodeView {
|
|
|
372
373
|
* closed-form scale, because word-wrapped text re-flows at every size: a smaller font can fit more
|
|
373
374
|
* words per line, so height doesn't shrink linearly with font size the way unwrapped bounds would.
|
|
374
375
|
*/
|
|
375
|
-
applyFittedStyle(bitmapText, node, family, transform) {
|
|
376
|
-
const baseStyle = { fontFamily: family, fill:
|
|
376
|
+
applyFittedStyle(bitmapText, node, style, family, transform) {
|
|
377
|
+
const baseStyle = { fontFamily: family, fill: style.fill, align: style.align, letterSpacing: style.letterSpacing, wordWrap: style.wordWrap, wordWrapWidth: transform.width };
|
|
377
378
|
const fits = (fontSize) => {
|
|
378
379
|
bitmapText.style = { ...baseStyle, fontSize };
|
|
379
380
|
// Headless loaders and schema tests have no browser canvas to measure against; they keep the
|
|
@@ -390,13 +391,13 @@ export class BitmapTextNodeView extends NodeView {
|
|
|
390
391
|
// just the shrink-check's fast path. Written as `||` short-circuit, `fits(node.fontSize)` would
|
|
391
392
|
// never execute while `autoSize` is off, leaving `bitmapText.style` frozen at whatever the
|
|
392
393
|
// constructor set it to and silently dropping every later fill/align/letterSpacing/wordWrap edit.
|
|
393
|
-
const fitsAtAuthoredSize = fits(
|
|
394
|
+
const fitsAtAuthoredSize = fits(style.fontSize);
|
|
394
395
|
if (node.autoSize !== true || fitsAtAuthoredSize)
|
|
395
396
|
return;
|
|
396
|
-
const minFontSize = Math.min(node.minFontSize ?? 1,
|
|
397
|
+
const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);
|
|
397
398
|
if (!fits(minFontSize))
|
|
398
399
|
return; // Best effort: even the floor overflows, so it stays at the floor.
|
|
399
|
-
let lo = minFontSize, hi =
|
|
400
|
+
let lo = minFontSize, hi = style.fontSize;
|
|
400
401
|
for (let i = 0; i < 8; i++) {
|
|
401
402
|
const mid = (lo + hi) / 2;
|
|
402
403
|
if (fits(mid))
|
package/dist/views/basic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsI,MAAM,wBAAwB,CAAC;AAC3L,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAW,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IACnC,WAAW,KAAU,CAAC;CACjC;AAED,iFAAiF;AACjF,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACvB,SA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AAC;IAES,WAAW,CAAC,KAAa,EAAE,SAA8B;QACjE,IAAI,IAAI,CAAC,OAAO,YAAY,QAAQ;YAAE,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;IAC1H,CAAC;CACF","sourcesContent":["import { applyTextCase, type BitmapTextNode, type LayoutPadding, type LayoutProfileId, type TextCase, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { BitmapText, Container, Graphics, NineSliceSprite, Sprite, Text, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\nimport { resolveTextStyle } from \"../layout.js\";\r\n\r\nexport class ContainerNodeView extends NodeView {\r\n protected syncContent(): void {}\r\n}\r\n\r\n/** Clips every authored child to the node's resolved rectangular layout area. */\r\nexport class MaskNodeView extends NodeView {\r\n private readonly maskShape = new Graphics();\r\n\r\n constructor() {\r\n super();\r\n this.addChild(this.maskShape);\r\n // A Graphics mask keeps the shape GPU-native and avoids the offscreen texture pass of alpha masks.\r\n // Pixi's regular mask contract also preserves correct clipping through rotation and transformed parents.\r\n this.mask = this.maskShape;\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"mask\") return;\r\n this.maskShape.clear().rect(0, 0, transform.width, transform.height).fill(0xffffff);\r\n }\r\n}\r\n\r\n/**\r\n * Multiplies one opacity into its whole child subtree, the same contract as Unity's `CanvasGroup.alpha`:\r\n * PixiJS already folds a container's `alpha` into every descendant's `worldAlpha`, so this costs one\r\n * multiply per object in a traversal that happens anyway — no offscreen render pass, and a fade over an\r\n * arbitrarily large subtree stays a single number written once per frame. Overlapping children therefore\r\n * show through each other at intermediate values, exactly as they do under a Unity `CanvasGroup`; true\r\n * flattened group opacity would need an `AlphaFilter` and its per-frame render texture, which is\r\n * deliberately not what this node is for.\r\n *\r\n * At zero opacity a runtime scene also stops rendering and hit-testing the subtree outright — the\r\n * `blocksRaycasts` half of `CanvasGroup`, without which a fully faded-out screen keeps eating the\r\n * pointer input of the one faded in over it. Both are skipped while authoring: `eventMode = \"none\"` on\r\n * the view itself would drop the node and its children out of editor selection, and hit testing stays\r\n * `NodeView`'s responsibility.\r\n */\r\nexport class OpacityGroupNodeView extends NodeView {\r\n private readonly interaction: SceneInteractionMode;\r\n /** Transient runtime override; `undefined` keeps the authored `opacity` from the document. */\r\n private runtimeOpacity?: number;\r\n private authoredOpacity = 1;\r\n\r\n constructor(interaction: SceneInteractionMode) {\r\n super();\r\n this.interaction = interaction;\r\n }\r\n\r\n /** Drives a fade from game code without touching the document; `undefined` restores the authored value. */\r\n setOpacity(opacity: number | undefined): void {\r\n this.runtimeOpacity = opacity === undefined ? undefined : Math.min(1, Math.max(0, opacity));\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n\r\n private applyOpacity(opacity: number): void {\r\n this.alpha = opacity;\r\n if (this.interaction === \"authoring\") return;\r\n const hidden = opacity <= 0;\r\n this.renderable = !hidden;\r\n this.eventMode = hidden ? \"none\" : \"passive\";\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"opacity-group\") return;\r\n this.authoredOpacity = node.opacity;\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n}\r\n\r\n/** Layout groups may optionally paint one image behind their managed children. No asset means no content/view at all. */\r\nexport class LayoutGroupNodeView extends NodeView {\r\n private readonly layoutContent = new Container();\r\n private background?: Sprite;\r\n\r\n constructor(textures: ReadonlyMap<string, Texture> | undefined) {\r\n super(textures);\r\n // Yoga owns this inner container only. The NodeView itself retains the authored transform,\r\n // pivot and grab rectangle used by both editor gizmos and runtime interaction.\r\n super.addChild(this.layoutContent);\r\n }\r\n\r\n get layoutTarget(): Container { return this.layoutContent; }\r\n\r\n addLayoutChild<T extends Container[]>(...children: T): T[0] {\r\n return this.layoutContent.addChild(...children);\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"horizontal-layout\" && node.type !== \"vertical-layout\" && node.type !== \"grid-layout\") return;\r\n const texture = node.backgroundAssetId === undefined ? undefined : this.textureFor(node.backgroundAssetId);\r\n if (texture === undefined) {\r\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); this.background = undefined; }\r\n return;\r\n }\r\n if (this.background === undefined) { this.background = new Sprite(texture); super.addChildAt(this.background, 0); }\r\n else if (this.background.texture !== texture) this.background.texture = texture;\r\n this.background.setSize(transform.width, transform.height);\r\n }\r\n}\r\n\r\n/**\r\n * Ноде-картинке источник не обязателен: без `assetId` она рисует белый прямоугольник своего размера,\r\n * а серо-синяя заглушка остаётся признаком того, что назначенный ассет не загрузился.\r\n *\r\n * `nineSlice` переключает контент на `NineSliceSprite`: углы источника остаются нерастянутыми, а\r\n * растягиваются только края/середина — то же 9-slice, что уже использует Slider/ProgressBar через\r\n * `@pixi/ui`'s `fillPaddings`, только здесь это применяется напрямую к содержимому Image-ноды.\r\n */\r\nexport class ImageNodeView extends NodeView {\r\n constructor(assetId: string | undefined, textures: ReadonlyMap<string, Texture> | undefined, nineSlice?: LayoutPadding) {\r\n super(textures);\r\n const texture = assetId === undefined ? undefined : this.textureFor(assetId);\r\n this.setContent(ImageNodeView.createSpriteContent(texture, nineSlice));\r\n }\r\n\r\n private static createSpriteContent(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\r\n if (texture === undefined) return new Graphics();\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"image\") return;\r\n const texture = node.assetId === undefined ? undefined : this.textureFor(node.assetId);\r\n const nineSlice = node.nineSlice;\r\n // Sprite ↔ NineSliceSprite ↔ Graphics меняются местами прямо здесь: структурный ключ сцены не\r\n // включает assetId/nineSlice, поэтому переключение (в том числе на None) не пересобирает сцену.\r\n if (texture !== undefined && nineSlice !== undefined) {\r\n if (!(this.content instanceof NineSliceSprite)) this.setContent(ImageNodeView.createSpriteContent(texture, nineSlice));\r\n const sprite = this.content as NineSliceSprite;\r\n // Keep the NineSliceSprite and its layout rectangle stable when its image asset/borders change.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.leftWidth = nineSlice.left;\r\n sprite.topHeight = nineSlice.top;\r\n sprite.rightWidth = nineSlice.right;\r\n sprite.bottomHeight = nineSlice.bottom;\r\n sprite.setSize(transform.width, transform.height);\r\n } else if (texture !== undefined) {\r\n // `NineSliceSprite` is a Sprite sibling, not a subclass, so this rebuilds when switching back from it.\r\n if (!(this.content instanceof Sprite)) this.setContent(new Sprite(texture));\r\n const sprite = this.content as Sprite;\r\n // Keep the Sprite and its layout rectangle stable when its image asset changes.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.setSize(transform.width, transform.height);\r\n } else {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n const graphics = (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height);\r\n if (node.assetId === undefined) graphics.fill(node.tint ?? 0xffffff);\r\n else graphics.fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n }\r\n this.content!.alpha = node.opacity ?? 1;\r\n if (this.content instanceof Sprite || this.content instanceof NineSliceSprite) this.content.tint = node.tint ?? 0xffffff;\r\n }\r\n\r\n /**\r\n * Editor-only live preview of border edits while dragging the canvas nine-slice gizmo; the\r\n * document is only written once, on drag release. A no-op without a `NineSliceSprite` content —\r\n * e.g. mid-drag right after the asset was cleared, before the next document sync catches up.\r\n */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n if (!(this.content instanceof NineSliceSprite)) return;\r\n this.content.leftWidth = nineSlice.left;\r\n this.content.topHeight = nineSlice.top;\r\n this.content.rightWidth = nineSlice.right;\r\n this.content.bottomHeight = nineSlice.bottom;\r\n }\r\n\r\n}\r\n\r\nexport class TextNodeView extends NodeView {\r\n /**\r\n * Строка, применённая локализацией поверх авторской. Она переживает `updateNodeView`: без неё\r\n * любая синхронизация документа возвращала бы fallback `node.text` вместо текущего перевода.\r\n */\r\n private localizedText?: string;\r\n /** Последний применённый прямоугольник и стиль — их же переиспользует инкрементальный `setText`. */\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastStyle?: TextStyleDefinition;\r\n /** `Text.textCase` from the last synced node — `setText`'s incremental path re-applies it without waiting for a full `syncContent`. */\r\n private textCase?: TextCase;\r\n\r\n constructor(text: string, private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Text({ text, style: { fontFamily: \"Arial\", fontSize: 24, fill: 0xffffff } }));\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (node.type !== \"text\" || !(this.content instanceof Text)) return;\r\n this.textCase = node.textCase;\r\n const text = applyTextCase(this.localizedText ?? node.text, this.textCase);\r\n if (this.content.text !== text) this.content.text = text;\r\n const style = resolveTextStyle(node, profile);\r\n this.lastTransform = transform;\r\n this.lastStyle = style;\r\n if (style === undefined) return;\r\n this.applyFittedStyle(this.content, node, style, transform);\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the resolved style at the largest font size (down to `minFontSize`) that keeps the\r\n * rendered text inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the\r\n * authored size\" contract as `BitmapTextNodeView.applyFittedStyle` / Unity legacy Text's Best Fit.\r\n * A binary search over candidate sizes rather than a closed-form scale, because word-wrapped text\r\n * re-flows at every size: a smaller font fits more words per line, so height doesn't shrink linearly\r\n * with font size the way unwrapped bounds would — the same reasoning `measureOverflow` follows.\r\n */\r\n private applyFittedStyle(text: Text, node: TextNode, style: TextStyleDefinition, transform: UINode[\"transform\"]): void {\r\n const baseStyle = { fontFamily: style.fontAssetId === undefined ? style.fontFamily : this.fonts?.get(style.fontAssetId) ?? style.fontFamily, fontWeight: style.fontWeight, fontStyle: style.fontStyle, fill: style.fill, align: style.align, wordWrap: style.wordWrap, breakWords: style.breakWords, wordWrapWidth: transform.width, lineHeight: style.lineHeight, letterSpacing: style.letterSpacing, stroke: style.stroke === undefined ? undefined : { color: style.stroke.color, width: style.stroke.width } };\r\n const fits = (fontSize: number): boolean => {\r\n text.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = text.getLocalBounds();\r\n const tolerance = 0.5;\r\n return style.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(style.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `text.style` frozen at whatever the constructor\r\n // set it to and silently dropping every later font/color/align/wrap edit (see the identical fix\r\n // in `BitmapTextNodeView.applyFittedStyle`).\r\n const fitsAtAuthoredSize = fits(style.fontSize);\r\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\r\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\r\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `text.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Инкрементальная смена строки: та же строка не делает работы вообще, новая — только переизмеряет\r\n * и выравнивает текст в текущем authored rectangle. `TextStyle` не пересоздаётся, а сам view\r\n * сохраняет identity, поэтому смена локали не трогает ни сцену, ни GPU-ресурсы стиля.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof Text)) return;\r\n const cased = applyTextCase(text, this.textCase);\r\n if (this.content.text === cased) return;\r\n this.content.text = cased;\r\n this.align();\r\n }\r\n\r\n /** `undefined` возвращает ноду к авторской строке при следующей синхронизации документа. */\r\n setLocalizedText(text: string | undefined): void {\r\n this.localizedText = text;\r\n if (text !== undefined) this.setText(text);\r\n }\r\n\r\n /**\r\n * Rasterizes the canvas-based `Text` at a higher pixel density than the renderer's own backing\r\n * resolution, so authoring-camera zoom doesn't magnify an already-rasterized bitmap past its\r\n * source resolution. `Application.resolution` (see `resolveCanvasResolution`) only matches the\r\n * *display's* pixel density — it knows nothing about the editor's independent camera zoom, which\r\n * can reach 8x (`MAX_ZOOM`). Without this, zooming in to inspect a text node (exactly what\r\n * `autoSize`/shrink-to-fit users do, since it converges to a smaller font) reads as soft/blurred\r\n * even on a display this app already renders crisply on. A no-op if unchanged: assigning\r\n * `.resolution` always re-rasterizes, so skip it when the caller (the authoring canvas, on every\r\n * camera-zoom tick) passes back the same value.\r\n */\r\n setContentResolution(resolution: number): void {\r\n if (!(this.content instanceof Text) || this.content.resolution === resolution) return;\r\n this.content.resolution = resolution;\r\n }\r\n\r\n /**\r\n * Вылезает ли фактически отрисованный текст за логический прямоугольник ноды.\r\n *\r\n * Меряется уже готовый `Text`, а не длина строки: перенос по словам, шрифт и обводка известны\r\n * только рендеру. Без `wordWrap` переполнение возможно по ширине, с ним — по высоте, потому что\r\n * перенос сам удерживает ширину в пределах `wordWrapWidth`. Диагностика transient: она ничего не\r\n * пишет ни в документ, ни в view.\r\n */\r\n measureOverflow(): boolean {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof Text) || transform === undefined || typeof globalThis.document === \"undefined\") return false;\r\n const bounds = this.content.getLocalBounds();\r\n const tolerance = 0.5;\r\n return this.lastStyle?.wordWrap === true\r\n ? bounds.height > transform.height + tolerance\r\n : bounds.width > transform.width + tolerance || bounds.height > transform.height + tolerance;\r\n }\r\n\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n const style = this.lastStyle;\r\n if (!(this.content instanceof Text) || transform === undefined || style === undefined) return;\r\n // Headless loaders and schema tests intentionally have no browser canvas. In that boundary\r\n // text still owns its authored rectangle; browser rendering keeps the precise measurement.\r\n const bounds = typeof globalThis.document === \"undefined\" ? { x: 0, y: 0, width: 0, height: 0 } : this.content.getLocalBounds();\r\n this.content.x = style.align === \"center\" ? (transform.width - bounds.width) / 2 - bounds.x : style.align === \"right\" ? transform.width - bounds.width - bounds.x : -bounds.x;\r\n this.content.y = style.verticalAlign === \"middle\" ? (transform.height - bounds.height) / 2 - bounds.y : style.verticalAlign === \"bottom\" ? transform.height - bounds.height - bounds.y : -bounds.y;\r\n }\r\n}\r\n\r\n/**\r\n * A bitmap font's rendered glyphs come from its texture, not an arbitrary system/TTF face, so unlike\r\n * `TextNodeView` there is no style-driven fallback: without a loaded font (asset deleted, still\r\n * loading, or failed to parse) this draws the same missing-asset placeholder `ImageNodeView` does.\r\n */\r\nexport class BitmapTextNodeView extends NodeView {\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastAlign: \"left\" | \"center\" | \"right\" = \"left\";\r\n private lastVerticalAlign: \"top\" | \"middle\" | \"bottom\" = \"top\";\r\n\r\n constructor(private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"bitmap-text\") return;\r\n this.lastTransform = transform;\r\n this.lastAlign = node.align;\r\n this.lastVerticalAlign = node.verticalAlign;\r\n const family = this.fonts?.get(node.assetId);\r\n if (family === undefined) {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n return;\r\n }\r\n if (!(this.content instanceof BitmapText)) this.setContent(new BitmapText({ text: node.text, style: { fontFamily: family, fontSize: node.fontSize, fill: node.fill } }));\r\n const bitmapText = this.content as BitmapText;\r\n if (bitmapText.text !== node.text) bitmapText.text = node.text;\r\n this.applyFittedStyle(bitmapText, node, family, transform);\r\n this.align();\r\n }\r\n\r\n /**\r\n * Updates the rendered bitmap text without reapplying the node transform. This lets game code\r\n * refresh counters that are temporarily attached to a Spine connector without dislodging them.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof BitmapText) || this.content.text === text) return;\r\n this.content.text = text;\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the node's style at the largest font size (down to `minFontSize`) that keeps the text\r\n * inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the authored size\"\r\n * contract as Unity legacy Text's Best Fit. A binary search over candidate sizes rather than a\r\n * closed-form scale, because word-wrapped text re-flows at every size: a smaller font can fit more\r\n * words per line, so height doesn't shrink linearly with font size the way unwrapped bounds would.\r\n */\r\n private applyFittedStyle(bitmapText: BitmapText, node: BitmapTextNode, family: string, transform: UINode[\"transform\"]): void {\r\n const baseStyle = { fontFamily: family, fill: node.fill, align: node.align, letterSpacing: node.letterSpacing, wordWrap: node.wordWrap, wordWrapWidth: transform.width };\r\n const fits = (fontSize: number): boolean => {\r\n bitmapText.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = bitmapText.getLocalBounds();\r\n const tolerance = 0.5;\r\n return node.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(node.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `bitmapText.style` frozen at whatever the\r\n // constructor set it to and silently dropping every later fill/align/letterSpacing/wordWrap edit.\r\n const fitsAtAuthoredSize = fits(node.fontSize);\r\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, node.fontSize);\r\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = node.fontSize;\r\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `bitmapText.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Positions via PixiJS's own `anchor`, not a manual `getLocalBounds()` computation like\r\n * `TextNodeView.align()` uses: `BitmapText.updateBounds()` reports a coarse line-metrics box\r\n * (built from the font's `lineHeight`/`baseLineOffset`), not the tight pixel bounds a canvas\r\n * `Text` or `Sprite` reports. Its own glyphs are drawn with an additional baseline-derived offset\r\n * that box doesn't account for, so computing `-bounds.y`-style positions from it lands text\r\n * slightly (but consistently, for every vertical setting) off — `anchor` is the one code path\r\n * PixiJS keeps in sync with how it actually renders the glyphs.\r\n */\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof BitmapText) || transform === undefined) return;\r\n const anchorX = this.lastAlign === \"center\" ? 0.5 : this.lastAlign === \"right\" ? 1 : 0;\r\n const anchorY = this.lastVerticalAlign === \"middle\" ? 0.5 : this.lastVerticalAlign === \"bottom\" ? 1 : 0;\r\n this.content.anchor.set(anchorX, anchorY);\r\n this.content.x = anchorX * transform.width;\r\n this.content.y = anchorY * transform.height;\r\n }\r\n}\r\n\r\n/**\r\n * Содержимое инстанса приходит обычными детьми из общего резолвера иерархии. Собственный контент\r\n * нужен только как заметная заглушка, когда определение пресета отсутствует в документе.\r\n */\r\nexport class PrefabInstanceNodeView extends NodeView {\r\n constructor(resolved: boolean) {\r\n super();\r\n if (!resolved) this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(_node: UINode, transform: UINode[\"transform\"]): void {\r\n if (this.content instanceof Graphics) this.content.clear().rect(0, 0, transform.width, transform.height).fill(0xff00ff);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../src/views/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsI,MAAM,wBAAwB,CAAC;AAC3L,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAW,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExE,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IACnC,WAAW,KAAU,CAAC;CACjC;AAED,iFAAiF;AACjF,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACvB,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;IAE5C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,mGAAmG;QACnG,yGAAyG;QACzG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;IAC7B,CAAC;IAES,WAAW,CAAC,IAAY,EAAE,SAA8B;QAChE,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO;QACjC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtF,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,oBAAqB,SAAQ,QAAQ;IAC/B,WAAW,CAAuB;IACnD,8FAA8F;IACtF,cAAc,CAAU;IACxB,eAAe,GAAG,CAAC,CAAC;IAE5B,YAAY,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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvF,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC;IAC9C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,QAAQ;IAClD,YAAY,QAAiB;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAES,WAAW,CAAC,KAAa,EAAE,SAA8B;QACjE,IAAI,IAAI,CAAC,OAAO,YAAY,QAAQ;YAAE,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;IAC1H,CAAC;CACF","sourcesContent":["import { applyTextCase, type BitmapTextNode, type LayoutPadding, type LayoutProfileId, type TextCase, type TextNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { BitmapText, Container, Graphics, NineSliceSprite, Sprite, Text, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\nimport { resolveBitmapTextStyle, resolveTextStyle } from \"../layout.js\";\r\n\r\nexport class ContainerNodeView extends NodeView {\r\n protected syncContent(): void {}\r\n}\r\n\r\n/** Clips every authored child to the node's resolved rectangular layout area. */\r\nexport class MaskNodeView extends NodeView {\r\n private readonly maskShape = new Graphics();\r\n\r\n constructor() {\r\n super();\r\n this.addChild(this.maskShape);\r\n // A Graphics mask keeps the shape GPU-native and avoids the offscreen texture pass of alpha masks.\r\n // Pixi's regular mask contract also preserves correct clipping through rotation and transformed parents.\r\n this.mask = this.maskShape;\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"mask\") return;\r\n this.maskShape.clear().rect(0, 0, transform.width, transform.height).fill(0xffffff);\r\n }\r\n}\r\n\r\n/**\r\n * Multiplies one opacity into its whole child subtree, the same contract as Unity's `CanvasGroup.alpha`:\r\n * PixiJS already folds a container's `alpha` into every descendant's `worldAlpha`, so this costs one\r\n * multiply per object in a traversal that happens anyway — no offscreen render pass, and a fade over an\r\n * arbitrarily large subtree stays a single number written once per frame. Overlapping children therefore\r\n * show through each other at intermediate values, exactly as they do under a Unity `CanvasGroup`; true\r\n * flattened group opacity would need an `AlphaFilter` and its per-frame render texture, which is\r\n * deliberately not what this node is for.\r\n *\r\n * At zero opacity a runtime scene also stops rendering and hit-testing the subtree outright — the\r\n * `blocksRaycasts` half of `CanvasGroup`, without which a fully faded-out screen keeps eating the\r\n * pointer input of the one faded in over it. Both are skipped while authoring: `eventMode = \"none\"` on\r\n * the view itself would drop the node and its children out of editor selection, and hit testing stays\r\n * `NodeView`'s responsibility.\r\n */\r\nexport class OpacityGroupNodeView extends NodeView {\r\n private readonly interaction: SceneInteractionMode;\r\n /** Transient runtime override; `undefined` keeps the authored `opacity` from the document. */\r\n private runtimeOpacity?: number;\r\n private authoredOpacity = 1;\r\n\r\n constructor(interaction: SceneInteractionMode) {\r\n super();\r\n this.interaction = interaction;\r\n }\r\n\r\n /** Drives a fade from game code without touching the document; `undefined` restores the authored value. */\r\n setOpacity(opacity: number | undefined): void {\r\n this.runtimeOpacity = opacity === undefined ? undefined : Math.min(1, Math.max(0, opacity));\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n\r\n private applyOpacity(opacity: number): void {\r\n this.alpha = opacity;\r\n if (this.interaction === \"authoring\") return;\r\n const hidden = opacity <= 0;\r\n this.renderable = !hidden;\r\n this.eventMode = hidden ? \"none\" : \"passive\";\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"opacity-group\") return;\r\n this.authoredOpacity = node.opacity;\r\n this.applyOpacity(this.runtimeOpacity ?? this.authoredOpacity);\r\n }\r\n}\r\n\r\n/** Layout groups may optionally paint one image behind their managed children. No asset means no content/view at all. */\r\nexport class LayoutGroupNodeView extends NodeView {\r\n private readonly layoutContent = new Container();\r\n private background?: Sprite;\r\n\r\n constructor(textures: ReadonlyMap<string, Texture> | undefined) {\r\n super(textures);\r\n // Yoga owns this inner container only. The NodeView itself retains the authored transform,\r\n // pivot and grab rectangle used by both editor gizmos and runtime interaction.\r\n super.addChild(this.layoutContent);\r\n }\r\n\r\n get layoutTarget(): Container { return this.layoutContent; }\r\n\r\n addLayoutChild<T extends Container[]>(...children: T): T[0] {\r\n return this.layoutContent.addChild(...children);\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"horizontal-layout\" && node.type !== \"vertical-layout\" && node.type !== \"grid-layout\") return;\r\n const texture = node.backgroundAssetId === undefined ? undefined : this.textureFor(node.backgroundAssetId);\r\n if (texture === undefined) {\r\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); this.background = undefined; }\r\n return;\r\n }\r\n if (this.background === undefined) { this.background = new Sprite(texture); super.addChildAt(this.background, 0); }\r\n else if (this.background.texture !== texture) this.background.texture = texture;\r\n this.background.setSize(transform.width, transform.height);\r\n }\r\n}\r\n\r\n/**\r\n * Ноде-картинке источник не обязателен: без `assetId` она рисует белый прямоугольник своего размера,\r\n * а серо-синяя заглушка остаётся признаком того, что назначенный ассет не загрузился.\r\n *\r\n * `nineSlice` переключает контент на `NineSliceSprite`: углы источника остаются нерастянутыми, а\r\n * растягиваются только края/середина — то же 9-slice, что уже использует Slider/ProgressBar через\r\n * `@pixi/ui`'s `fillPaddings`, только здесь это применяется напрямую к содержимому Image-ноды.\r\n */\r\nexport class ImageNodeView extends NodeView {\r\n constructor(assetId: string | undefined, textures: ReadonlyMap<string, Texture> | undefined, nineSlice?: LayoutPadding) {\r\n super(textures);\r\n const texture = assetId === undefined ? undefined : this.textureFor(assetId);\r\n this.setContent(ImageNodeView.createSpriteContent(texture, nineSlice));\r\n }\r\n\r\n private static createSpriteContent(texture: Texture | undefined, nineSlice: LayoutPadding | undefined): Container {\r\n if (texture === undefined) return new Graphics();\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"image\") return;\r\n const texture = node.assetId === undefined ? undefined : this.textureFor(node.assetId);\r\n const nineSlice = node.nineSlice;\r\n // Sprite ↔ NineSliceSprite ↔ Graphics меняются местами прямо здесь: структурный ключ сцены не\r\n // включает assetId/nineSlice, поэтому переключение (в том числе на None) не пересобирает сцену.\r\n if (texture !== undefined && nineSlice !== undefined) {\r\n if (!(this.content instanceof NineSliceSprite)) this.setContent(ImageNodeView.createSpriteContent(texture, nineSlice));\r\n const sprite = this.content as NineSliceSprite;\r\n // Keep the NineSliceSprite and its layout rectangle stable when its image asset/borders change.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.leftWidth = nineSlice.left;\r\n sprite.topHeight = nineSlice.top;\r\n sprite.rightWidth = nineSlice.right;\r\n sprite.bottomHeight = nineSlice.bottom;\r\n sprite.setSize(transform.width, transform.height);\r\n } else if (texture !== undefined) {\r\n // `NineSliceSprite` is a Sprite sibling, not a subclass, so this rebuilds when switching back from it.\r\n if (!(this.content instanceof Sprite)) this.setContent(new Sprite(texture));\r\n const sprite = this.content as Sprite;\r\n // Keep the Sprite and its layout rectangle stable when its image asset changes.\r\n if (sprite.texture !== texture) sprite.texture = texture;\r\n sprite.setSize(transform.width, transform.height);\r\n } else {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n const graphics = (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height);\r\n if (node.assetId === undefined) graphics.fill(node.tint ?? 0xffffff);\r\n else graphics.fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n }\r\n this.content!.alpha = node.opacity ?? 1;\r\n if (this.content instanceof Sprite || this.content instanceof NineSliceSprite) this.content.tint = node.tint ?? 0xffffff;\r\n }\r\n\r\n /**\r\n * Editor-only live preview of border edits while dragging the canvas nine-slice gizmo; the\r\n * document is only written once, on drag release. A no-op without a `NineSliceSprite` content —\r\n * e.g. mid-drag right after the asset was cleared, before the next document sync catches up.\r\n */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n if (!(this.content instanceof NineSliceSprite)) return;\r\n this.content.leftWidth = nineSlice.left;\r\n this.content.topHeight = nineSlice.top;\r\n this.content.rightWidth = nineSlice.right;\r\n this.content.bottomHeight = nineSlice.bottom;\r\n }\r\n\r\n}\r\n\r\nexport class TextNodeView extends NodeView {\r\n /**\r\n * Строка, применённая локализацией поверх авторской. Она переживает `updateNodeView`: без неё\r\n * любая синхронизация документа возвращала бы fallback `node.text` вместо текущего перевода.\r\n */\r\n private localizedText?: string;\r\n /** Последний применённый прямоугольник и стиль — их же переиспользует инкрементальный `setText`. */\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastStyle?: TextStyleDefinition;\r\n /** `Text.textCase` from the last synced node — `setText`'s incremental path re-applies it without waiting for a full `syncContent`. */\r\n private textCase?: TextCase;\r\n\r\n constructor(text: string, private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Text({ text, style: { fontFamily: \"Arial\", fontSize: 24, fill: 0xffffff } }));\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (node.type !== \"text\" || !(this.content instanceof Text)) return;\r\n this.textCase = node.textCase;\r\n const text = applyTextCase(this.localizedText ?? node.text, this.textCase);\r\n if (this.content.text !== text) this.content.text = text;\r\n const style = resolveTextStyle(node, profile);\r\n this.lastTransform = transform;\r\n this.lastStyle = style;\r\n if (style === undefined) return;\r\n this.applyFittedStyle(this.content, node, style, transform);\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the resolved style at the largest font size (down to `minFontSize`) that keeps the\r\n * rendered text inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the\r\n * authored size\" contract as `BitmapTextNodeView.applyFittedStyle` / Unity legacy Text's Best Fit.\r\n * A binary search over candidate sizes rather than a closed-form scale, because word-wrapped text\r\n * re-flows at every size: a smaller font fits more words per line, so height doesn't shrink linearly\r\n * with font size the way unwrapped bounds would — the same reasoning `measureOverflow` follows.\r\n */\r\n private applyFittedStyle(text: Text, node: TextNode, style: TextStyleDefinition, transform: UINode[\"transform\"]): void {\r\n const baseStyle = { fontFamily: style.fontAssetId === undefined ? style.fontFamily : this.fonts?.get(style.fontAssetId) ?? style.fontFamily, fontWeight: style.fontWeight, fontStyle: style.fontStyle, fill: style.fill, align: style.align, wordWrap: style.wordWrap, breakWords: style.breakWords, wordWrapWidth: transform.width, lineHeight: style.lineHeight, letterSpacing: style.letterSpacing, stroke: style.stroke === undefined ? undefined : { color: style.stroke.color, width: style.stroke.width } };\r\n const fits = (fontSize: number): boolean => {\r\n text.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = text.getLocalBounds();\r\n const tolerance = 0.5;\r\n return style.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(style.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `text.style` frozen at whatever the constructor\r\n // set it to and silently dropping every later font/color/align/wrap edit (see the identical fix\r\n // in `BitmapTextNodeView.applyFittedStyle`).\r\n const fitsAtAuthoredSize = fits(style.fontSize);\r\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\r\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\r\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `text.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Инкрементальная смена строки: та же строка не делает работы вообще, новая — только переизмеряет\r\n * и выравнивает текст в текущем authored rectangle. `TextStyle` не пересоздаётся, а сам view\r\n * сохраняет identity, поэтому смена локали не трогает ни сцену, ни GPU-ресурсы стиля.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof Text)) return;\r\n const cased = applyTextCase(text, this.textCase);\r\n if (this.content.text === cased) return;\r\n this.content.text = cased;\r\n this.align();\r\n }\r\n\r\n /** `undefined` возвращает ноду к авторской строке при следующей синхронизации документа. */\r\n setLocalizedText(text: string | undefined): void {\r\n this.localizedText = text;\r\n if (text !== undefined) this.setText(text);\r\n }\r\n\r\n /**\r\n * Rasterizes the canvas-based `Text` at a higher pixel density than the renderer's own backing\r\n * resolution, so authoring-camera zoom doesn't magnify an already-rasterized bitmap past its\r\n * source resolution. `Application.resolution` (see `resolveCanvasResolution`) only matches the\r\n * *display's* pixel density — it knows nothing about the editor's independent camera zoom, which\r\n * can reach 8x (`MAX_ZOOM`). Without this, zooming in to inspect a text node (exactly what\r\n * `autoSize`/shrink-to-fit users do, since it converges to a smaller font) reads as soft/blurred\r\n * even on a display this app already renders crisply on. A no-op if unchanged: assigning\r\n * `.resolution` always re-rasterizes, so skip it when the caller (the authoring canvas, on every\r\n * camera-zoom tick) passes back the same value.\r\n */\r\n setContentResolution(resolution: number): void {\r\n if (!(this.content instanceof Text) || this.content.resolution === resolution) return;\r\n this.content.resolution = resolution;\r\n }\r\n\r\n /**\r\n * Вылезает ли фактически отрисованный текст за логический прямоугольник ноды.\r\n *\r\n * Меряется уже готовый `Text`, а не длина строки: перенос по словам, шрифт и обводка известны\r\n * только рендеру. Без `wordWrap` переполнение возможно по ширине, с ним — по высоте, потому что\r\n * перенос сам удерживает ширину в пределах `wordWrapWidth`. Диагностика transient: она ничего не\r\n * пишет ни в документ, ни в view.\r\n */\r\n measureOverflow(): boolean {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof Text) || transform === undefined || typeof globalThis.document === \"undefined\") return false;\r\n const bounds = this.content.getLocalBounds();\r\n const tolerance = 0.5;\r\n return this.lastStyle?.wordWrap === true\r\n ? bounds.height > transform.height + tolerance\r\n : bounds.width > transform.width + tolerance || bounds.height > transform.height + tolerance;\r\n }\r\n\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n const style = this.lastStyle;\r\n if (!(this.content instanceof Text) || transform === undefined || style === undefined) return;\r\n // Headless loaders and schema tests intentionally have no browser canvas. In that boundary\r\n // text still owns its authored rectangle; browser rendering keeps the precise measurement.\r\n const bounds = typeof globalThis.document === \"undefined\" ? { x: 0, y: 0, width: 0, height: 0 } : this.content.getLocalBounds();\r\n this.content.x = style.align === \"center\" ? (transform.width - bounds.width) / 2 - bounds.x : style.align === \"right\" ? transform.width - bounds.width - bounds.x : -bounds.x;\r\n this.content.y = style.verticalAlign === \"middle\" ? (transform.height - bounds.height) / 2 - bounds.y : style.verticalAlign === \"bottom\" ? transform.height - bounds.height - bounds.y : -bounds.y;\r\n }\r\n}\r\n\r\n/**\r\n * A bitmap font's rendered glyphs come from its texture, not an arbitrary system/TTF face, so unlike\r\n * `TextNodeView` there is no style-driven fallback: without a loaded font (asset deleted, still\r\n * loading, or failed to parse) this draws the same missing-asset placeholder `ImageNodeView` does.\r\n */\r\nexport class BitmapTextNodeView extends NodeView {\r\n private lastTransform?: UINode[\"transform\"];\r\n private lastAlign: \"left\" | \"center\" | \"right\" = \"left\";\r\n private lastVerticalAlign: \"top\" | \"middle\" | \"bottom\" = \"top\";\r\n\r\n constructor(private readonly fonts?: ReadonlyMap<string, string>) {\r\n super();\r\n this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (node.type !== \"bitmap-text\") return;\r\n const style = resolveBitmapTextStyle(node, profile);\r\n this.lastTransform = transform;\r\n this.lastAlign = style.align;\r\n this.lastVerticalAlign = style.verticalAlign;\r\n const family = this.fonts?.get(style.assetId);\r\n if (family === undefined) {\r\n if (!(this.content instanceof Graphics)) this.setContent(new Graphics());\r\n (this.content as Graphics).clear().rect(0, 0, transform.width, transform.height).fill(0x4a5568).stroke({ width: 1, color: 0x94a3b8 });\r\n return;\r\n }\r\n if (!(this.content instanceof BitmapText)) this.setContent(new BitmapText({ text: node.text, style: { fontFamily: family, fontSize: style.fontSize, fill: style.fill } }));\r\n const bitmapText = this.content as BitmapText;\r\n if (bitmapText.text !== node.text) bitmapText.text = node.text;\r\n this.applyFittedStyle(bitmapText, node, style, family, transform);\r\n this.align();\r\n }\r\n\r\n /**\r\n * Updates the rendered bitmap text without reapplying the node transform. This lets game code\r\n * refresh counters that are temporarily attached to a Spine connector without dislodging them.\r\n */\r\n setText(text: string): void {\r\n if (!(this.content instanceof BitmapText) || this.content.text === text) return;\r\n this.content.text = text;\r\n this.align();\r\n }\r\n\r\n /**\r\n * Applies the node's style at the largest font size (down to `minFontSize`) that keeps the text\r\n * inside `transform`, when `autoSize` is on — the same \"shrink, never grow past the authored size\"\r\n * contract as Unity legacy Text's Best Fit. A binary search over candidate sizes rather than a\r\n * closed-form scale, because word-wrapped text re-flows at every size: a smaller font can fit more\r\n * words per line, so height doesn't shrink linearly with font size the way unwrapped bounds would.\r\n */\r\n private applyFittedStyle(bitmapText: BitmapText, node: BitmapTextNode, style: import(\"@pixi-ui-editor/schema\").BitmapTextStyle, family: string, transform: UINode[\"transform\"]): void {\r\n const baseStyle = { fontFamily: family, fill: style.fill, align: style.align, letterSpacing: style.letterSpacing, wordWrap: style.wordWrap, wordWrapWidth: transform.width };\r\n const fits = (fontSize: number): boolean => {\r\n bitmapText.style = { ...baseStyle, fontSize };\r\n // Headless loaders and schema tests have no browser canvas to measure against; they keep the\r\n // authored fontSize, same boundary `align()` already respects.\r\n if (typeof globalThis.document === \"undefined\") return true;\r\n const bounds = bitmapText.getLocalBounds();\r\n const tolerance = 0.5;\r\n return node.wordWrap\r\n ? bounds.height <= transform.height + tolerance\r\n : bounds.width <= transform.width + tolerance && bounds.height <= transform.height + tolerance;\r\n };\r\n // Always runs at least once, applying `baseStyle` at the authored size as a side effect — not\r\n // just the shrink-check's fast path. Written as `||` short-circuit, `fits(node.fontSize)` would\r\n // never execute while `autoSize` is off, leaving `bitmapText.style` frozen at whatever the\r\n // constructor set it to and silently dropping every later fill/align/letterSpacing/wordWrap edit.\r\n const fitsAtAuthoredSize = fits(style.fontSize);\r\n if (node.autoSize !== true || fitsAtAuthoredSize) return;\r\n const minFontSize = Math.min(node.minFontSize ?? 1, style.fontSize);\r\n if (!fits(minFontSize)) return; // Best effort: even the floor overflows, so it stays at the floor.\r\n let lo = minFontSize, hi = style.fontSize;\r\n for (let i = 0; i < 8; i++) {\r\n const mid = (lo + hi) / 2;\r\n if (fits(mid)) lo = mid; else hi = mid;\r\n }\r\n fits(lo); // Leaves `bitmapText.style` applied at the converged, fitting size.\r\n }\r\n\r\n /**\r\n * Positions via PixiJS's own `anchor`, not a manual `getLocalBounds()` computation like\r\n * `TextNodeView.align()` uses: `BitmapText.updateBounds()` reports a coarse line-metrics box\r\n * (built from the font's `lineHeight`/`baseLineOffset`), not the tight pixel bounds a canvas\r\n * `Text` or `Sprite` reports. Its own glyphs are drawn with an additional baseline-derived offset\r\n * that box doesn't account for, so computing `-bounds.y`-style positions from it lands text\r\n * slightly (but consistently, for every vertical setting) off — `anchor` is the one code path\r\n * PixiJS keeps in sync with how it actually renders the glyphs.\r\n */\r\n private align(): void {\r\n const transform = this.lastTransform;\r\n if (!(this.content instanceof BitmapText) || transform === undefined) return;\r\n const anchorX = this.lastAlign === \"center\" ? 0.5 : this.lastAlign === \"right\" ? 1 : 0;\r\n const anchorY = this.lastVerticalAlign === \"middle\" ? 0.5 : this.lastVerticalAlign === \"bottom\" ? 1 : 0;\r\n this.content.anchor.set(anchorX, anchorY);\r\n this.content.x = anchorX * transform.width;\r\n this.content.y = anchorY * transform.height;\r\n }\r\n}\r\n\r\n/**\r\n * Содержимое инстанса приходит обычными детьми из общего резолвера иерархии. Собственный контент\r\n * нужен только как заметная заглушка, когда определение пресета отсутствует в документе.\r\n */\r\nexport class PrefabInstanceNodeView extends NodeView {\r\n constructor(resolved: boolean) {\r\n super();\r\n if (!resolved) this.setContent(new Graphics());\r\n }\r\n\r\n protected syncContent(_node: UINode, transform: UINode[\"transform\"]): void {\r\n if (this.content instanceof Graphics) this.content.clear().rect(0, 0, transform.width, transform.height).fill(0xff00ff);\r\n }\r\n}\r\n"]}
|