@pixi-ui-editor/runtime-pixi 0.13.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.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.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
package/dist/scene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,qBAAqB,EAAiJ,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA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QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AACpO,CAAC","sourcesContent":["import { type SkeletonData } from \"@esotericsoftware/spine-pixi-v8\";\nimport { createStableId, isLayoutGroup, isParticleEffect, resolveLayoutGroupSettings, resolveOwnerNodeGraph, type EffectDefinition, type GridLayoutSettings, type LayoutProfileId, type ProjectDocument, type Scene, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\nimport { Container, Texture, type Ticker } from \"pixi.js\";\nimport { loadSceneSpines } from \"./assets/spine.js\";\nimport { loadSceneTextures, type FileUrlResolver } from \"./assets/textures.js\";\nimport { loadSceneFonts } from \"./assets/fonts.js\";\nimport { loadSceneBitmapFonts } from \"./assets/bitmapFonts.js\";\nimport type { SceneAssetCache } from \"./assets/cache.js\";\nimport { getCanvasLogicalSize, getCanvasScale, resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\nimport { NodeView, type SceneInteractionMode } from \"./views/NodeView.js\";\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\nimport { createNodeView } from \"./views/createNodeView.js\";\nimport { applyLayoutGroup, applyLayoutItem, createGridLineBreak, initializePixiLayout, LayoutItemContainer } from \"./layoutGroups.js\";\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\nimport { PageItemContainer } from \"./pageGroup.js\";\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\nimport { PaginationNodeView, type PaginationArrow } from \"./views/PaginationNodeView.js\";\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\nimport { ScrollItemContainer } from \"./scrollView.js\";\nimport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\nimport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\nimport { SceneLocalization, type SceneLocalizationOptions } from \"./localization.js\";\nimport { SceneViewport } from \"./SceneViewport.js\";\nimport type { Sound } from \"@pixi/sound\";\n\nexport type BuildSceneViewOptions = {\n /** Explicit: an editor canvas must pass \"authoring\", Preview and the consuming app \"runtime\". */\n interaction: SceneInteractionMode;\n textures?: ReadonlyMap<string, Texture>;\n spines?: ReadonlyMap<string, SkeletonData>;\n fonts?: ReadonlyMap<string, string>;\n bitmapFonts?: ReadonlyMap<string, string>;\n sounds?: ReadonlyMap<string, Sound>;\n /**\n * The host's own Application ticker, driving self-updating content such as Spine skeletons.\n * Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the\n * renderer that draws them — see the same rule as `updateParticleEmitters`.\n */\n ticker?: Ticker;\n /** Called after Yoga changes a managed rectangle; authoring hosts use it to refresh overlays. */\n onLayout?: () => void;\n /**\n * Начальное состояние локализации. Опция необязательна: при наличии `Text.textKey` base locale\n * каталога применяется и без неё, а документ без ключей выглядит ровно как раньше.\n */\n localization?: SceneLocalizationOptions;\n /** Internal host boundary override: prefab views are spawnable content, not screen viewports. */\n clipToViewport?: boolean;\n};\n\nexport type SceneViewResult = { root: SceneViewport; nodeViews: Map<string, Container>; localization: SceneLocalization };\nconst particleEmitterRegistry = new WeakMap<Container, readonly ParticleEmitterNodeView[]>();\n\nfunction spineReferenceFrameFor(document: ProjectDocument, node: UINode): SpineReferenceFrame | undefined {\n if (node.type !== \"spine\") return undefined;\n const asset = document.assets.find((candidate) => candidate.id === node.assetId);\n return asset?.type === \"spine\" ? asset.referenceFrame : undefined;\n}\n\n/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */\nexport function buildSceneView(\n document: ProjectDocument,\n sceneId: string,\n profile: LayoutProfileId,\n options: BuildSceneViewOptions,\n): SceneViewResult {\n initializePixiLayout();\n const { interaction, textures, spines, fonts, bitmapFonts, sounds, ticker, onLayout } = options;\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\n\n if (scene === undefined) {\n throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\n }\n\n const nodeViews = new Map<string, Container>();\n const particleEmitters: ParticleEmitterNodeView[] = [];\n\n // Materialized prefab children use instance-scoped IDs, so authoring and runtime can address\n // multiple instances independently without changing canonical definition IDs.\n const screenSize = scene.layout.referenceViewports[profile];\n const referenceResolution = scene.layout.preferredViewports[profile];\n const canvasScale = getCanvasScale(screenSize, referenceResolution);\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\n\n // Единый резолвер иерархии: тот же граф, что видит редактор, включая вложенные пресеты.\n const owner = resolveOwnerNodeGraph(document, scene);\n const prefabIds = new Set(document.prefabs.map((prefab) => prefab.id));\n\n const buildOwner = (rootSize: LayoutSize): Container => {\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\n\n const buildNode = (nodeId: string, parentSize: LayoutSize): NodeView => {\n const node = nodesById.get(nodeId);\n\n if (node === undefined) {\n throw new Error(`Scene '${sceneId}' references missing node '${nodeId}'.`);\n }\n\n const resolved = resolveProfileTransform(node, profile);\n const transform = resolveAnchoredTransform(resolved.transform, parentSize);\n const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sounds, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\n // Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.\n view.update(node, profile, parentSize);\n nodeViews.set(node.id, view);\n if (view instanceof ParticleEmitterNodeView) particleEmitters.push(view);\n\n // Прямые дети корня сцены разрешают якоря относительно логического Canvas, а не размера корня.\n // Прямой ребёнок grid-layout (сам `node` здесь) не владеет своим отрисованным размером: Unity-подобная\n // фиксированная ячейка полностью переопределяет authored transform (см. applyLayoutItem). Его\n // собственным потомкам нужен именно cellWidth/cellHeight, а не anchor-resolved authored-размер —\n // иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.\n const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);\n const gridCell = gridParent?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(gridParent, profile) : undefined;\n // Та же логика для прямого ребёнка page-group (страницы): `PageItemContainer`/`updateManaged`\n // растягивают её на весь resolved rectangle группы независимо от собственных anchors ноды\n // (см. NodeView.applyResolvedTransform, managedByLayout). Здесь `node` — сама страница, поэтому\n // это переопределённый размер, который она фактически получит, — `parentSize`, уже разрешённый\n // как rectangle page-group. Без этой ветки дети страницы якорились бы относительно её\n // anchor-resolved authored-размера, который может расходиться с фактическим rectangle группы,\n // особенно в другом layout-профиле.\n const childSize = node.parentId === null\n ? rootSize\n : gridCell !== undefined\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\n : gridParent?.type === \"page-group\"\n ? parentSize\n : { width: transform.width, height: transform.height };\n for (const [childIndex, childId] of node.children.entries()) {\n const childNode = nodesById.get(childId);\n const childView = buildNode(childId, childSize);\n if (isLayoutGroup(node) && childNode !== undefined && view instanceof LayoutGroupNodeView) {\n const layoutItem = new LayoutItemContainer(childView, onLayout);\n applyLayoutItem(layoutItem, childNode, node, profile);\n view.addLayoutChild(layoutItem);\n } else if (node.type === \"scroll-view\" && childNode !== undefined && view instanceof ScrollViewNodeView) {\n const scrollItem = new ScrollItemContainer(childView, onLayout);\n // Как и у layout-item: собственный (не растянутый якорями) размер ребёнка — List не\n // предоставляет per-item override размера, в отличие от Yoga flexGrow/cellSize.\n const own = resolveProfileTransform(childNode, profile).transform;\n scrollItem.sync(childNode, profile, { width: own.width, height: own.height });\n view.addScrollItem(scrollItem);\n } else if (node.type === \"page-group\" && childNode !== undefined && view instanceof PageGroupNodeView) {\n // Unlike a scroll-view item, a page fills the group's own resolved rect completely\n // (`childSize`, computed above): a page is a full sub-screen, not content sized to itself.\n const pageItem = new PageItemContainer(childView);\n pageItem.sync(childNode, profile, childSize);\n view.addPageItem(pageItem);\n } else {\n view.addChild(childView);\n }\n if (node.type === \"grid-layout\") {\n const settings = node.layoutGroup.overrides?.[profile] === undefined ? node.layoutGroup.base : { ...node.layoutGroup.base, ...node.layoutGroup.overrides[profile] };\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\n const lineBreak = createGridLineBreak(node, profile);\n if (lineBreak !== undefined && view instanceof LayoutGroupNodeView) view.addLayoutChild(lineBreak);\n }\n }\n }\n\n return view;\n };\n\n const ownerRoot = new Container();\n for (const rootNodeId of owner.rootNodeIds) {\n ownerRoot.addChild(buildNode(rootNodeId, rootSize));\n }\n\n return ownerRoot;\n };\n\n const canvasRoot = buildOwner(canvasSize);\n canvasRoot.scale.set(canvasScale);\n const hostRoot = new SceneViewport(canvasRoot, screenSize, options.clipToViewport ?? interaction === \"runtime\");\n particleEmitterRegistry.set(hostRoot, particleEmitters);\n // Контроллер применяет переводы сразу к уже созданным views, поэтому keyed Text показывает\n // базовую локаль без единого дополнительного вызова со стороны хоста.\n const localization = new SceneLocalization(document, scene, nodeViews, options.localization);\n wireCheckboxGroups(owner.nodes, nodeViews);\n wireSpineConnectors(owner.nodes, nodeViews);\n wireNodeReferences(owner.nodes, nodeViews, interaction);\n return { root: hostRoot, nodeViews, localization };\n}\n\nfunction wireSpineConnectors(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\n for (const node of nodes) {\n if (node.type !== \"spine\") continue;\n const view = nodeViews.get(node.id);\n if (!(view instanceof SpineNodeView)) continue;\n view.setConnectorBones((node.connectors ?? []).flatMap((connector) => {\n const target = nodeViews.get(connector.targetNodeId);\n return target === undefined ? [] : [{ ...connector, target }];\n }));\n }\n}\n\n/**\n * Разрешает все ссылки «нода → нода» в живые views: элементы item table и кнопки-стрелки пагинатора.\n * Та же форма, что у `wireSpineConnectors`: документ хранит id, а во что он превратился, знает только\n * собранная сцена, поэтому сами виды никогда не резолвят id. Один проход на все виды ссылок, чтобы\n * следующая не завела собственный обход с чуть другой областью видимости.\n *\n * Стрелки подключаются только в runtime-сцене: на authoring-канвасе контрол инертен, как и клик по\n * самой точке пагинатора. Вместимость таблицы, наоборот, видна и в редакторе — это не интерактивность.\n */\nfunction wireNodeReferences(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>, interaction: SceneInteractionMode): void {\n const arrowView = (nodeId: string | undefined): PaginationArrow | undefined => {\n const view = nodeId === undefined ? undefined : nodeViews.get(nodeId);\n return view instanceof ButtonNodeView || view instanceof StagedButtonNodeView ? view : undefined;\n };\n for (const node of nodes) {\n const view = nodeViews.get(node.id);\n if (node.type === \"item-table\" && view instanceof ItemTableNodeView) {\n view.setItems((node.items ?? []).map((itemId) => nodeViews.get(itemId)));\n } else if (node.type === \"pagination\" && view instanceof PaginationNodeView && interaction === \"runtime\") {\n view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });\n } else if (node.type === \"page-group\" && view instanceof PageGroupNodeView && interaction === \"runtime\") {\n view.setArrows({ up: arrowView(node.pageUpButtonNodeId), down: arrowView(node.pageDownButtonNodeId) });\n }\n }\n}\n\n/**\n * Authored `group` gives sibling checkboxes radio-button behavior: checking one force-unchecks its\n * live group-mates (same `parentId`, same `group`), without touching the document. Runs once per\n * scene build; `CheckboxNodeView.forceCheck` never re-emits `onCheck`, so this can't recurse.\n */\nfunction wireCheckboxGroups(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\n const byGroup = new Map<string, CheckboxNodeView[]>();\n for (const node of nodes) {\n if (node.type !== \"checkbox\" || node.group === undefined) continue;\n const view = nodeViews.get(node.id);\n if (!(view instanceof CheckboxNodeView)) continue;\n const key = `${node.parentId ?? \"\"}::${node.group}`;\n const group = byGroup.get(key) ?? [];\n group.push(view);\n byGroup.set(key, group);\n }\n for (const group of byGroup.values()) {\n if (group.length < 2) continue;\n for (const view of group) {\n view.onCheck.connect((checked) => {\n if (!checked) return;\n for (const other of group) if (other !== view) other.forceCheck(false);\n });\n }\n }\n}\n\n/**\n * Applies a node's resolved transform, visibility, and content to an existing display object,\n * so editors can update views in place without rebuilding the scene tree.\n */\nexport function updateNodeView(view: Container, node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize, parentNode?: UINode, effect?: EffectDefinition, spineReferenceFrame?: SpineReferenceFrame): void {\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\n if (!(view instanceof NodeView)) return;\n if (view instanceof SpineNodeView) view.setReferenceFrame(spineReferenceFrame);\n if (node.type === \"particle-emitter\" && effect !== undefined && isParticleEffect(effect) && \"syncEffect\" in view && typeof (view as { syncEffect?: unknown }).syncEffect === \"function\") (view as { syncEffect(effect: import(\"@pixi-ui-editor/schema\").ParticleEffectDefinition): void }).syncEffect(effect);\n if (parentNode !== undefined && isLayoutGroup(parentNode) && view.parent instanceof LayoutItemContainer) {\n applyLayoutItem(view.parent, node, parentNode, profile);\n } else if (parentNode !== undefined && parentNode.type === \"scroll-view\" && view.parent instanceof ScrollItemContainer) {\n const own = resolveProfileTransform(node, profile).transform;\n view.parent.sync(node, profile, { width: own.width, height: own.height });\n } else if (parentNode !== undefined && parentNode.type === \"page-group\" && view.parent instanceof PageItemContainer && parentSize !== undefined) {\n // A page is position-managed exactly like a layout/scroll item: it fills the group's own rectangle\n // (`parentSize`, the same value `buildSceneView` passes as `childSize`). Without this branch an\n // in-place update fell through to `view.update` and handed the page back its authored x/y and\n // anchors, so editing anything inside a page group knocked its pages out of place.\n view.parent.sync(node, profile, parentSize);\n } else {\n view.update(node, profile, parentSize);\n }\n}\n\n/** Previews a resolved editor rectangle without consulting content bounds or rebuilding the view. */\nexport function previewNodeView(view: Container, node: UINode, profile: LayoutProfileId, transform: UINode[\"transform\"]): void {\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, undefined, { width: transform.width, height: transform.height });\n if (view instanceof NodeView) view.preview(node, transform, resolveProfileTransform(node, profile).visible, profile);\n}\n\n/** Hosts call this from their own Application ticker; runtime never subscribes to Ticker.shared. */\nexport function updateParticleEmitters(root: Container, deltaSeconds: number): void {\n const registered = particleEmitterRegistry.get(root);\n if (registered !== undefined) {\n for (const emitter of registered) emitter.updateParticles(deltaSeconds);\n return;\n }\n // Backward-compatible fallback for hosts that assemble a display tree manually instead of using\n // buildSceneView. Built scenes always take the O(emitter count) registry path above.\n const visit = (view: Container): void => {\n if (view instanceof ParticleEmitterNodeView) view.updateParticles(deltaSeconds);\n for (const child of view.children) visit(child);\n };\n visit(root);\n}\n\n/** Lists the nodes a scene renders, including nodes of prefab definitions its prefab instances expand to. */\nexport function collectRenderedNodes(document: ProjectDocument, scene: Scene): UINode[] {\n return resolveOwnerNodeGraph(document, scene).nodes;\n}\n\nexport type PrefabViewConfiguration = Pick<Extract<UINode, { type: \"prefab-instance\" }>, \"propertyOverrides\" | \"locallyAddedNodes\"> & { instanceId?: string };\n\nfunction prefabScene(document: ProjectDocument, prefabId: string, configuration: PrefabViewConfiguration = {}): { document: ProjectDocument; sceneId: string; instanceId: string } {\n const prefab = document.prefabs.find((candidate) => candidate.id === prefabId);\n if (prefab === undefined) throw new Error(`Prefab '${prefabId}' does not exist in the project document.`);\n const width = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.x) + Math.max(0, node.transform.width)));\n const height = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.y) + Math.max(0, node.transform.height)));\n const instanceId = configuration.instanceId ?? createStableId();\n const instance: Extract<UINode, { type: \"prefab-instance\" }> = {\n id: instanceId, name: prefab.name, type: \"prefab-instance\", prefabId, parentId: null, children: [],\n visible: true, transform: { x: 0, y: 0, width, height, scaleX: 1, scaleY: 1, rotation: 0, anchorMinX: 0, anchorMaxX: 0, anchorMinY: 0, anchorMaxY: 0, pivotX: 0, pivotY: 0 },\n ...(configuration.propertyOverrides === undefined ? {} : { propertyOverrides: structuredClone(configuration.propertyOverrides) }),\n ...(configuration.locallyAddedNodes === undefined ? {} : { locallyAddedNodes: structuredClone(configuration.locallyAddedNodes) }),\n };\n const sceneId = createStableId();\n const viewport = { width, height };\n const scene: Scene = { id: sceneId, name: prefab.name, rootNodeIds: [instance.id], nodes: [instance], layout: { referenceViewports: { desktop: viewport, mobile: viewport }, preferredViewports: { desktop: viewport, mobile: viewport } } };\n return { document: { ...document, scenes: [...document.scenes, scene] }, sceneId, instanceId };\n}\n\n/** Builds a fresh runtime prefab instance without requiring it to already exist in a scene. */\nexport function buildPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, options: BuildSceneViewOptions, configuration: PrefabViewConfiguration = {}): SceneViewResult & { instanceId: string } {\n const synthetic = prefabScene(document, prefabId, configuration);\n return { ...buildSceneView(synthetic.document, synthetic.sceneId, profile, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\n}\n\n/** Loads a prefab's assets and returns a fresh display tree suitable for dynamic game-code spawning. */\nexport async function loadPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, resolveFileUrl: FileUrlResolver, options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; assetCache?: SceneAssetCache }, configuration: PrefabViewConfiguration = {}): Promise<SceneViewResult & { instanceId: string }> {\n const synthetic = prefabScene(document, prefabId, configuration);\n return { ...await loadSceneView(synthetic.document, synthetic.sceneId, profile, resolveFileUrl, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\n}\n\n/** Loads a scene's textures and Spine data, then builds its display tree in one call. */\nexport async function loadSceneView(\n document: ProjectDocument,\n sceneId: string,\n profile: LayoutProfileId,\n resolveFileUrl: FileUrlResolver,\n options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; clipToViewport?: boolean; assetCache?: SceneAssetCache },\n): Promise<SceneViewResult> {\n // Без assetCache каждый вызов начинает с пустых кэшей: для одиночной загрузки сцены это нормально, а вот\n // игровой код, который поднимает пресеты по одному, обязан передать собственный кэш — иначе один и тот же\n // скелет, атлас и текстура парсятся заново на каждую вьюху и дублируются в видеопамяти.\n const cache = options.assetCache;\n const [textures, spines, fonts, bitmapFonts] = await Promise.all([\n loadSceneTextures(document, sceneId, (asset) => (asset.type === \"image\" ? resolveFileUrl(asset.source.uri) : undefined), resolveFileUrl, cache?.textures, cache?.spritesheets, cache?.bitmapFonts),\n loadSceneSpines(document, sceneId, resolveFileUrl, cache?.spines),\n loadSceneFonts(document, sceneId, resolveFileUrl, cache?.fonts),\n loadSceneBitmapFonts(document, sceneId, resolveFileUrl, cache?.bitmapFonts),\n ]);\n return buildSceneView(document, sceneId, profile, { interaction: options.interaction, textures, spines, fonts, bitmapFonts, ticker: options.ticker, localization: options.localization, clipToViewport: options.clipToViewport });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../src/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,qBAAqB,EAAiJ,MAAM,wBAAwB,CAAC;AAC3R,OAAO,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,wBAAwB,EAAE,uBAAuB,EAAmB,MAAM,aAAa,CAAC;AACvI,OAAO,EAAE,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,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LayoutGroupSettings, resolveOwnerNodeGraph, type EffectDefinition, type GridLayoutSettings, type LayoutProfileId, type ProjectDocument, type Scene, type SpineReferenceFrame, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { Container, Texture, type Ticker } from \"pixi.js\";\r\nimport { loadSceneSpines } from \"./assets/spine.js\";\r\nimport { loadSceneTextures, type FileUrlResolver } from \"./assets/textures.js\";\r\nimport { loadSceneFonts } from \"./assets/fonts.js\";\r\nimport { loadSceneBitmapFonts } from \"./assets/bitmapFonts.js\";\r\nimport type { SceneAssetCache } from \"./assets/cache.js\";\r\nimport { getCanvasLogicalSize, getCanvasScale, resolveAnchoredTransform, resolveProfileTransform, type LayoutSize } from \"./layout.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./views/NodeView.js\";\r\nimport { CheckboxNodeView } from \"./views/CheckboxNodeView.js\";\r\nimport { createNodeView } from \"./views/createNodeView.js\";\r\nimport { applyLayoutGroup, applyLayoutItem, createGridLineBreak, initializePixiLayout, LayoutItemContainer } from \"./layoutGroups.js\";\r\nimport { LayoutGroupNodeView } from \"./views/basic.js\";\r\nimport { PageItemContainer } from \"./pageGroup.js\";\r\nimport { PageGroupNodeView } from \"./views/PageGroupNodeView.js\";\r\nimport { PaginationNodeView, type PaginationArrow } from \"./views/PaginationNodeView.js\";\r\nimport { ItemTableNodeView } from \"./views/ItemTableNodeView.js\";\r\nimport { ButtonNodeView } from \"./views/ButtonNodeView.js\";\r\nimport { StagedButtonNodeView } from \"./views/StagedButtonNodeView.js\";\r\nimport { ScrollItemContainer } from \"./scrollView.js\";\r\nimport { ScrollViewNodeView } from \"./views/ScrollViewNodeView.js\";\r\nimport { SpineNodeView } from \"./views/SpineNodeView.js\";\r\nimport { ParticleEmitterNodeView } from \"./views/ParticleEmitterNodeView.js\";\r\nimport { SceneLocalization, type SceneLocalizationOptions } from \"./localization.js\";\r\nimport { SceneViewport } from \"./SceneViewport.js\";\r\nimport type { Sound } from \"@pixi/sound\";\r\n\r\nexport type BuildSceneViewOptions = {\r\n /** Explicit: an editor canvas must pass \"authoring\", Preview and the consuming app \"runtime\". */\r\n interaction: SceneInteractionMode;\r\n textures?: ReadonlyMap<string, Texture>;\r\n spines?: ReadonlyMap<string, SkeletonData>;\r\n fonts?: ReadonlyMap<string, string>;\r\n bitmapFonts?: ReadonlyMap<string, string>;\r\n sounds?: ReadonlyMap<string, Sound>;\r\n /**\r\n * The host's own Application ticker, driving self-updating content such as Spine skeletons.\r\n * Without it they fall back to `Ticker.shared`, which runs a second rAF loop independent of the\r\n * renderer that draws them — see the same rule as `updateParticleEmitters`.\r\n */\r\n ticker?: Ticker;\r\n /** Called after Yoga changes a managed rectangle; authoring hosts use it to refresh overlays. */\r\n onLayout?: () => void;\r\n /**\r\n * Начальное состояние локализации. Опция необязательна: при наличии `Text.textKey` base locale\r\n * каталога применяется и без неё, а документ без ключей выглядит ровно как раньше.\r\n */\r\n localization?: SceneLocalizationOptions;\r\n /** Internal host boundary override: prefab views are spawnable content, not screen viewports. */\r\n clipToViewport?: boolean;\r\n};\r\n\r\nexport type SceneViewResult = { root: SceneViewport; nodeViews: Map<string, Container>; localization: SceneLocalization };\r\nconst particleEmitterRegistry = new WeakMap<Container, readonly ParticleEmitterNodeView[]>();\r\n\r\nfunction spineReferenceFrameFor(document: ProjectDocument, node: UINode): SpineReferenceFrame | undefined {\r\n if (node.type !== \"spine\") return undefined;\r\n const asset = document.assets.find((candidate) => candidate.id === node.assetId);\r\n return asset?.type === \"spine\" ? asset.referenceFrame : undefined;\r\n}\r\n\r\n/** Builds a PixiJS display tree for a scene without depending on DOM or editor state. */\r\nexport function buildSceneView(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n profile: LayoutProfileId,\r\n options: BuildSceneViewOptions,\r\n): SceneViewResult {\r\n initializePixiLayout();\r\n const { interaction, textures, spines, fonts, bitmapFonts, sounds, ticker, onLayout } = options;\r\n const scene = document.scenes.find((candidate) => candidate.id === sceneId);\r\n\r\n if (scene === undefined) {\r\n throw new Error(`Scene '${sceneId}' does not exist in the project document.`);\r\n }\r\n\r\n const nodeViews = new Map<string, Container>();\r\n const particleEmitters: ParticleEmitterNodeView[] = [];\r\n\r\n // Materialized prefab children use instance-scoped IDs, so authoring and runtime can address\r\n // multiple instances independently without changing canonical definition IDs.\r\n const screenSize = scene.layout.referenceViewports[profile];\r\n const referenceResolution = scene.layout.preferredViewports[profile];\r\n const canvasScale = getCanvasScale(screenSize, referenceResolution);\r\n const canvasSize = getCanvasLogicalSize(screenSize, referenceResolution);\r\n\r\n // Единый резолвер иерархии: тот же граф, что видит редактор, включая вложенные пресеты.\r\n const owner = resolveOwnerNodeGraph(document, scene);\r\n const prefabIds = new Set(document.prefabs.map((prefab) => prefab.id));\r\n\r\n const buildOwner = (rootSize: LayoutSize): Container => {\r\n const nodesById = new Map(owner.nodes.map((node) => [node.id, node]));\r\n\r\n const buildNode = (nodeId: string, parentSize: LayoutSize): NodeView => {\r\n const node = nodesById.get(nodeId);\r\n\r\n if (node === undefined) {\r\n throw new Error(`Scene '${sceneId}' references missing node '${nodeId}'.`);\r\n }\r\n\r\n const resolved = resolveProfileTransform(node, profile);\r\n const transform = resolveAnchoredTransform(resolved.transform, parentSize);\r\n const view = createNodeView(node, interaction, textures, spines, (prefabId) => prefabIds.has(prefabId), fonts, sounds, node.type === \"particle-emitter\" ? document.effects.find((effect) => effect.id === node.effectId && isParticleEffect(effect)) : undefined, spineReferenceFrameFor(document, node), ticker, bitmapFonts);\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\r\n // Yoga owns only the group's inner layoutContent; the outer NodeView keeps authored transform.\r\n view.update(node, profile, parentSize);\r\n nodeViews.set(node.id, view);\r\n if (view instanceof ParticleEmitterNodeView) particleEmitters.push(view);\r\n\r\n // Прямые дети корня сцены разрешают якоря относительно логического Canvas, а не размера корня.\r\n // Прямой ребёнок grid-layout (сам `node` здесь) не владеет своим отрисованным размером: Unity-подобная\r\n // фиксированная ячейка полностью переопределяет authored transform (см. applyLayoutItem). Его\r\n // собственным потомкам нужен именно cellWidth/cellHeight, а не anchor-resolved authored-размер —\r\n // иначе они не отслеживают изменение Cell width/height и якорятся относительно устаревшего размера.\r\n const gridParent = node.parentId === null ? undefined : nodesById.get(node.parentId);\r\n const gridCell = gridParent?.type === \"grid-layout\" ? resolveLayoutGroupSettings<GridLayoutSettings>(gridParent, profile) : undefined;\r\n // Та же логика для прямого ребёнка page-group (страницы): `PageItemContainer`/`updateManaged`\r\n // растягивают её на весь resolved rectangle группы независимо от собственных anchors ноды\r\n // (см. NodeView.applyResolvedTransform, managedByLayout). Здесь `node` — сама страница, поэтому\r\n // это переопределённый размер, который она фактически получит, — `parentSize`, уже разрешённый\r\n // как rectangle page-group. Без этой ветки дети страницы якорились бы относительно её\r\n // anchor-resolved authored-размера, который может расходиться с фактическим rectangle группы,\r\n // особенно в другом layout-профиле.\r\n const childSize = node.parentId === null\r\n ? rootSize\r\n : gridCell !== undefined\r\n ? { width: gridCell.cellWidth, height: gridCell.cellHeight }\r\n : gridParent?.type === \"page-group\"\r\n ? parentSize\r\n : { width: transform.width, height: transform.height };\r\n for (const [childIndex, childId] of node.children.entries()) {\r\n const childNode = nodesById.get(childId);\r\n const childView = buildNode(childId, childSize);\r\n if (isLayoutGroup(node) && childNode !== undefined && view instanceof LayoutGroupNodeView) {\r\n const layoutItem = new LayoutItemContainer(childView, onLayout);\r\n applyLayoutItem(layoutItem, childNode, node, profile);\r\n view.addLayoutChild(layoutItem);\r\n } else if (node.type === \"scroll-view\" && childNode !== undefined && view instanceof ScrollViewNodeView) {\r\n const scrollItem = new ScrollItemContainer(childView, onLayout);\r\n // Как и у layout-item: собственный (не растянутый якорями) размер ребёнка — List не\r\n // предоставляет per-item override размера, в отличие от Yoga flexGrow/cellSize.\r\n const own = resolveProfileTransform(childNode, profile).transform;\r\n scrollItem.sync(childNode, profile, { width: own.width, height: own.height });\r\n view.addScrollItem(scrollItem);\r\n } else if (node.type === \"page-group\" && childNode !== undefined && view instanceof PageGroupNodeView) {\r\n // Unlike a scroll-view item, a page fills the group's own resolved rect completely\r\n // (`childSize`, computed above): a page is a full sub-screen, not content sized to itself.\r\n const pageItem = new PageItemContainer(childView);\r\n pageItem.sync(childNode, profile, childSize);\r\n view.addPageItem(pageItem);\r\n } else {\r\n view.addChild(childView);\r\n }\r\n if (node.type === \"grid-layout\") {\r\n const settings = node.layoutGroup.overrides?.[profile] === undefined ? node.layoutGroup.base : { ...node.layoutGroup.base, ...node.layoutGroup.overrides[profile] };\r\n if (settings.constraint !== \"flexible\" && settings.constraintCount !== undefined && (childIndex + 1) % settings.constraintCount === 0 && childIndex + 1 < node.children.length) {\r\n const lineBreak = createGridLineBreak(node, profile);\r\n if (lineBreak !== undefined && view instanceof LayoutGroupNodeView) view.addLayoutChild(lineBreak);\r\n }\r\n }\r\n }\r\n\r\n return view;\r\n };\r\n\r\n const ownerRoot = new Container();\r\n for (const rootNodeId of owner.rootNodeIds) {\r\n ownerRoot.addChild(buildNode(rootNodeId, rootSize));\r\n }\r\n\r\n return ownerRoot;\r\n };\r\n\r\n const canvasRoot = buildOwner(canvasSize);\r\n canvasRoot.scale.set(canvasScale);\r\n const hostRoot = new SceneViewport(canvasRoot, screenSize, options.clipToViewport ?? interaction === \"runtime\");\r\n particleEmitterRegistry.set(hostRoot, particleEmitters);\r\n // Контроллер применяет переводы сразу к уже созданным views, поэтому keyed Text показывает\r\n // базовую локаль без единого дополнительного вызова со стороны хоста.\r\n const localization = new SceneLocalization(document, scene, nodeViews, options.localization);\r\n wireCheckboxGroups(owner.nodes, nodeViews);\r\n wireSpineConnectors(owner.nodes, nodeViews);\r\n wireNodeReferences(owner.nodes, nodeViews, interaction);\r\n return { root: hostRoot, nodeViews, localization };\r\n}\r\n\r\nfunction wireSpineConnectors(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\r\n for (const node of nodes) {\r\n if (node.type !== \"spine\") continue;\r\n const view = nodeViews.get(node.id);\r\n if (!(view instanceof SpineNodeView)) continue;\r\n view.setConnectorBones((node.connectors ?? []).flatMap((connector) => {\r\n const target = nodeViews.get(connector.targetNodeId);\r\n return target === undefined ? [] : [{ ...connector, target }];\r\n }));\r\n }\r\n}\r\n\r\n/**\r\n * Разрешает все ссылки «нода → нода» в живые views: элементы item table и кнопки-стрелки пагинатора.\r\n * Та же форма, что у `wireSpineConnectors`: документ хранит id, а во что он превратился, знает только\r\n * собранная сцена, поэтому сами виды никогда не резолвят id. Один проход на все виды ссылок, чтобы\r\n * следующая не завела собственный обход с чуть другой областью видимости.\r\n *\r\n * Стрелки подключаются только в runtime-сцене: на authoring-канвасе контрол инертен, как и клик по\r\n * самой точке пагинатора. Вместимость таблицы, наоборот, видна и в редакторе — это не интерактивность.\r\n */\r\nfunction wireNodeReferences(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>, interaction: SceneInteractionMode): void {\r\n const arrowView = (nodeId: string | undefined): PaginationArrow | undefined => {\r\n const view = nodeId === undefined ? undefined : nodeViews.get(nodeId);\r\n return view instanceof ButtonNodeView || view instanceof StagedButtonNodeView ? view : undefined;\r\n };\r\n for (const node of nodes) {\r\n const view = nodeViews.get(node.id);\r\n if (node.type === \"item-table\" && view instanceof ItemTableNodeView) {\r\n view.setItems((node.items ?? []).map((itemId) => nodeViews.get(itemId)));\r\n } else if (node.type === \"pagination\" && view instanceof PaginationNodeView && interaction === \"runtime\") {\r\n view.setArrows({ previous: arrowView(node.prevButtonNodeId), next: arrowView(node.nextButtonNodeId) });\r\n } else if (node.type === \"page-group\" && view instanceof PageGroupNodeView && interaction === \"runtime\") {\r\n view.setArrows({ up: arrowView(node.pageUpButtonNodeId), down: arrowView(node.pageDownButtonNodeId) });\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Authored `group` gives sibling checkboxes radio-button behavior: checking one force-unchecks its\r\n * live group-mates (same `parentId`, same `group`), without touching the document. Runs once per\r\n * scene build; `CheckboxNodeView.forceCheck` never re-emits `onCheck`, so this can't recurse.\r\n */\r\nfunction wireCheckboxGroups(nodes: readonly UINode[], nodeViews: ReadonlyMap<string, Container>): void {\r\n const byGroup = new Map<string, CheckboxNodeView[]>();\r\n for (const node of nodes) {\r\n if (node.type !== \"checkbox\" || node.group === undefined) continue;\r\n const view = nodeViews.get(node.id);\r\n if (!(view instanceof CheckboxNodeView)) continue;\r\n const key = `${node.parentId ?? \"\"}::${node.group}`;\r\n const group = byGroup.get(key) ?? [];\r\n group.push(view);\r\n byGroup.set(key, group);\r\n }\r\n for (const group of byGroup.values()) {\r\n if (group.length < 2) continue;\r\n for (const view of group) {\r\n view.onCheck.connect((checked) => {\r\n if (!checked) return;\r\n for (const other of group) if (other !== view) other.forceCheck(false);\r\n });\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Applies a node's resolved transform, visibility, and content to an existing display object,\r\n * so editors can update views in place without rebuilding the scene tree.\r\n */\r\nexport function updateNodeView(view: Container, node: UINode, profile: LayoutProfileId, parentSize?: LayoutSize, parentNode?: UINode, effect?: EffectDefinition, spineReferenceFrame?: SpineReferenceFrame): void {\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, parentSize);\r\n if (!(view instanceof NodeView)) return;\r\n if (view instanceof SpineNodeView) view.setReferenceFrame(spineReferenceFrame);\r\n if (node.type === \"particle-emitter\" && effect !== undefined && isParticleEffect(effect) && \"syncEffect\" in view && typeof (view as { syncEffect?: unknown }).syncEffect === \"function\") (view as { syncEffect(effect: import(\"@pixi-ui-editor/schema\").ParticleEffectDefinition): void }).syncEffect(effect);\r\n if (parentNode !== undefined && isLayoutGroup(parentNode) && view.parent instanceof LayoutItemContainer) {\r\n applyLayoutItem(view.parent, node, parentNode, profile);\r\n } else if (parentNode !== undefined && parentNode.type === \"scroll-view\" && view.parent instanceof ScrollItemContainer) {\r\n const own = resolveProfileTransform(node, profile).transform;\r\n view.parent.sync(node, profile, { width: own.width, height: own.height });\r\n } else if (parentNode !== undefined && parentNode.type === \"page-group\" && view.parent instanceof PageItemContainer && parentSize !== undefined) {\r\n // A page is position-managed exactly like a layout/scroll item: it fills the group's own rectangle\r\n // (`parentSize`, the same value `buildSceneView` passes as `childSize`). Without this branch an\r\n // in-place update fell through to `view.update` and handed the page back its authored x/y and\r\n // anchors, so editing anything inside a page group knocked its pages out of place.\r\n view.parent.sync(node, profile, parentSize);\r\n } else {\r\n view.update(node, profile, parentSize);\r\n }\r\n}\r\n\r\n/** Previews a resolved editor rectangle without consulting content bounds or rebuilding the view. */\r\nexport function previewNodeView(view: Container, node: UINode, profile: LayoutProfileId, transform: UINode[\"transform\"]): void {\r\n if (isLayoutGroup(node)) applyLayoutGroup(view, node, profile, undefined, { width: transform.width, height: transform.height });\r\n if (view instanceof NodeView) view.preview(node, transform, resolveProfileTransform(node, profile).visible, profile);\r\n}\r\n\r\n/** Hosts call this from their own Application ticker; runtime never subscribes to Ticker.shared. */\r\nexport function updateParticleEmitters(root: Container, deltaSeconds: number): void {\r\n const registered = particleEmitterRegistry.get(root);\r\n if (registered !== undefined) {\r\n for (const emitter of registered) emitter.updateParticles(deltaSeconds);\r\n return;\r\n }\r\n // Backward-compatible fallback for hosts that assemble a display tree manually instead of using\r\n // buildSceneView. Built scenes always take the O(emitter count) registry path above.\r\n const visit = (view: Container): void => {\r\n if (view instanceof ParticleEmitterNodeView) view.updateParticles(deltaSeconds);\r\n for (const child of view.children) visit(child);\r\n };\r\n visit(root);\r\n}\r\n\r\n/** Lists the nodes a scene renders, including nodes of prefab definitions its prefab instances expand to. */\r\nexport function collectRenderedNodes(document: ProjectDocument, scene: Scene): UINode[] {\r\n return resolveOwnerNodeGraph(document, scene).nodes;\r\n}\r\n\r\nexport type PrefabViewConfiguration = Pick<Extract<UINode, { type: \"prefab-instance\" }>, \"propertyOverrides\" | \"locallyAddedNodes\"> & { instanceId?: string };\r\n\r\nfunction prefabScene(document: ProjectDocument, prefabId: string, configuration: PrefabViewConfiguration = {}): { document: ProjectDocument; sceneId: string; instanceId: string } {\r\n const prefab = document.prefabs.find((candidate) => candidate.id === prefabId);\r\n if (prefab === undefined) throw new Error(`Prefab '${prefabId}' does not exist in the project document.`);\r\n const width = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.x) + Math.max(0, node.transform.width)));\r\n const height = Math.max(1, ...prefab.nodes.map((node) => Math.abs(node.transform.y) + Math.max(0, node.transform.height)));\r\n const instanceId = configuration.instanceId ?? createStableId();\r\n const instance: Extract<UINode, { type: \"prefab-instance\" }> = {\r\n id: instanceId, name: prefab.name, type: \"prefab-instance\", prefabId, parentId: null, children: [],\r\n visible: true, transform: { x: 0, y: 0, width, height, scaleX: 1, scaleY: 1, rotation: 0, anchorMinX: 0, anchorMaxX: 0, anchorMinY: 0, anchorMaxY: 0, pivotX: 0, pivotY: 0 },\r\n ...(configuration.propertyOverrides === undefined ? {} : { propertyOverrides: structuredClone(configuration.propertyOverrides) }),\r\n ...(configuration.locallyAddedNodes === undefined ? {} : { locallyAddedNodes: structuredClone(configuration.locallyAddedNodes) }),\r\n };\r\n const sceneId = createStableId();\r\n const viewport = { width, height };\r\n const scene: Scene = { id: sceneId, name: prefab.name, rootNodeIds: [instance.id], nodes: [instance], layout: { referenceViewports: { desktop: viewport, mobile: viewport }, preferredViewports: { desktop: viewport, mobile: viewport } } };\r\n return { document: { ...document, scenes: [...document.scenes, scene] }, sceneId, instanceId };\r\n}\r\n\r\n/** Builds a fresh runtime prefab instance without requiring it to already exist in a scene. */\r\nexport function buildPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, options: BuildSceneViewOptions, configuration: PrefabViewConfiguration = {}): SceneViewResult & { instanceId: string } {\r\n const synthetic = prefabScene(document, prefabId, configuration);\r\n return { ...buildSceneView(synthetic.document, synthetic.sceneId, profile, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\r\n}\r\n\r\n/** Loads a prefab's assets and returns a fresh display tree suitable for dynamic game-code spawning. */\r\nexport async function loadPrefabView(document: ProjectDocument, prefabId: string, profile: LayoutProfileId, resolveFileUrl: FileUrlResolver, options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; assetCache?: SceneAssetCache }, configuration: PrefabViewConfiguration = {}): Promise<SceneViewResult & { instanceId: string }> {\r\n const synthetic = prefabScene(document, prefabId, configuration);\r\n return { ...await loadSceneView(synthetic.document, synthetic.sceneId, profile, resolveFileUrl, { ...options, clipToViewport: false }), instanceId: synthetic.instanceId };\r\n}\r\n\r\n/** Loads a scene's textures and Spine data, then builds its display tree in one call. */\r\nexport async function loadSceneView(\r\n document: ProjectDocument,\r\n sceneId: string,\r\n profile: LayoutProfileId,\r\n resolveFileUrl: FileUrlResolver,\r\n options: { interaction: SceneInteractionMode; ticker?: Ticker; localization?: SceneLocalizationOptions; clipToViewport?: boolean; assetCache?: SceneAssetCache },\r\n): Promise<SceneViewResult> {\r\n // Без assetCache каждый вызов начинает с пустых кэшей: для одиночной загрузки сцены это нормально, а вот\r\n // игровой код, который поднимает пресеты по одному, обязан передать собственный кэш — иначе один и тот же\r\n // скелет, атлас и текстура парсятся заново на каждую вьюху и дублируются в видеопамяти.\r\n const cache = options.assetCache;\r\n const [textures, spines, fonts, bitmapFonts] = await Promise.all([\r\n loadSceneTextures(document, sceneId, (asset) => (asset.type === \"image\" ? resolveFileUrl(asset.source.uri) : undefined), resolveFileUrl, cache?.textures, cache?.spritesheets, cache?.bitmapFonts),\r\n loadSceneSpines(document, sceneId, resolveFileUrl, cache?.spines),\r\n loadSceneFonts(document, sceneId, resolveFileUrl, cache?.fonts),\r\n loadSceneBitmapFonts(document, sceneId, resolveFileUrl, cache?.bitmapFonts),\r\n ]);\r\n return buildSceneView(document, sceneId, profile, { interaction: options.interaction, textures, spines, fonts, bitmapFonts, ticker: options.ticker, localization: options.localization, clipToViewport: options.clipToViewport });\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonNodeView.js","sourceRoot":"","sources":["../../src/views/ButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,E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OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,IAAI,IAAI,KAA0B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IAAI,OAAO,KAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,KAA2B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAChE","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { FancyButton } from \"@pixi/ui\";\r\nimport type { Sound } from \"@pixi/sound\";\r\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type ButtonNode = Extract<UINode, { type: \"button\" }>;\r\n\r\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\nconst KEY_BY_FANCY_STATE = { default: \"normal\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\n\r\n/**\r\n * Adapts a button node to `@pixi/ui`'s `FancyButton`, which owns the pointer state machine —\r\n * this class never reimplements it. Optional states fall back to the normal image, and runtime\r\n * changes to `enabled` or the current state stay in the view: they never touch the document.\r\n *\r\n * `nineSlice`, when set, applies the same borders to all four state views (`NineSliceSprite`\r\n * instead of `Sprite`) — the button's frame shape is normally the same regardless of which state\r\n * image is currently shown.\r\n */\r\nexport class ButtonNodeView extends NodeView {\r\n private button!: FancyButton;\r\n private stateViews!: Record<ButtonStateKey, Container>;\r\n private readonly interaction: SceneInteractionMode;\r\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\r\n private soundAssetIds: ButtonNode[\"sounds\"];\r\n private enabledState: boolean;\r\n\r\n constructor(node: ButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\r\n super(textures);\r\n this.interaction = interaction;\r\n this.sounds = sounds;\r\n this.soundAssetIds = node.sounds;\r\n this.enabledState = node.enabled;\r\n this.buildButton(node);\r\n this.applyEnabled(node.enabled);\r\n }\r\n\r\n /**\r\n * Invisible (alpha 0) but still hit-testable: Pixi's `containsPoint` hit-tests the fill's geometry\r\n * regardless of its alpha. Painted with a real size *before* the view ever reaches `FancyButton`:\r\n * `FancyButton` reads `defaultView`'s bounds exactly once, synchronously during construction, to\r\n * freeze its own `hitArea` — it never re-reads them afterwards. A `Graphics` still at its default\r\n * (0, 0) size at that moment would freeze a zero-size, permanently unclickable hit area.\r\n */\r\n private static paintPlaceholder(graphics: Graphics, width: number, height: number): void {\r\n graphics.clear().rect(0, 0, width, height).fill({ color: 0x000000, alpha: 0 });\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined, size: { width: number; height: number }): Container {\n if (texture === undefined) {\r\n const graphics = new Graphics();\r\n ButtonNodeView.paintPlaceholder(graphics, size.width, size.height);\r\n return graphics;\r\n }\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\n\n private static applyStateAppearance(view: Container, node: ButtonNode, state: ButtonStateKey): void {\n view.tint = node.states[`${state}Tint`] ?? \"#ffffff\";\n view.alpha = node.states[`${state}Opacity`] ?? 1;\n }\n\r\n /**\r\n * (Re)builds `FancyButton` and its four state views. `FancyButton` has no API to replace a view\r\n * after construction, so any change to a view's *type* — nine-slice toggled, or an asset\r\n * finishing an async load — goes through here instead of `syncContent`'s cheap in-place path.\r\n *\r\n * `size` is the best size known *right now*: the resolved layout rectangle when called from\r\n * `syncContent`, or the authored transform when called from the constructor (before any layout\r\n * pass has run). Only feeds the initial placeholder paint above — see its doc comment for why.\r\n */\r\n private buildButton(node: ButtonNode, size?: { width: number; height: number }): void {\r\n const nineSlice = node.nineSlice;\r\n const resolvedSize = size ?? { width: node.transform.width, height: node.transform.height };\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n const stateViews = {} as Record<ButtonStateKey, Container>;\r\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\n const view = ButtonNodeView.createStateView(texture, nineSlice, resolvedSize);\n ButtonNodeView.applyStateAppearance(view, node, state);\n stateViews[state] = view;\r\n return view;\r\n };\r\n\r\n const button = new FancyButton({\r\n defaultView: viewFor(\"normal\", node.states.normalAssetId),\r\n hoverView: viewFor(\"hover\", node.states.hoverAssetId),\r\n pressedView: viewFor(\"pressed\", node.states.pressedAssetId),\r\n disabledView: viewFor(\"disabled\", node.states.disabledAssetId),\r\n });\r\n // Authoring-сцена инертна: FancyButton уже включил себе eventMode \"static\", снимаем его до applyEnabled.\r\n // Выделение и drag при этом не страдают: попадание ловит hitArea базового NodeView, а не это поддерево.\r\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\r\n else if (this.sounds !== undefined) {\r\n button.onPress.connect(() => { const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n button.onHover.connect(() => { const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n }\r\n this.button = button;\r\n this.stateViews = stateViews;\r\n this.setContent(button);\r\n }\r\n\r\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\r\n private applyEnabled(enabled: boolean): void {\r\n this.enabledState = enabled;\r\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\r\n else this.button.setState(enabled ? \"default\" : \"disabled\");\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"button\") return;\r\n this.soundAssetIds = node.sounds;\r\n const nineSlice = node.nineSlice;\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n\r\n // A state view's required *type* (Graphics/Sprite/NineSliceSprite) may no longer match what's\r\n // needed — nine-slice toggled, or a texture finished loading after this view had to fall back\r\n // to Graphics. FancyButton can't swap a view after construction, so that goes through a full\r\n // rebuild; everything else (texture identity, border values, size) updates the live views in\r\n // place, which is the path a nine-slice gizmo drag runs every frame.\r\n let needsRebuild = false;\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n const view = this.stateViews[state];\r\n const wantsNineSlice = texture !== undefined && nineSlice !== undefined;\r\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite && !(view instanceof NineSliceSprite);\r\n if (!matches) { needsRebuild = true; break; }\r\n }\r\n\r\n if (needsRebuild) {\r\n this.buildButton(node, transform);\r\n } else {\r\n for (const state of BUTTON_STATE_KEYS) {\n const view = this.stateViews[state];\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\r\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\r\n if (view instanceof NineSliceSprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n if (nineSlice !== undefined) {\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Sprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Graphics) {\n ButtonNodeView.paintPlaceholder(view, transform.width, transform.height);\n }\n ButtonNodeView.applyStateAppearance(view, node, state);\n }\n }\r\n\r\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\r\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\r\n }\r\n\r\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n if (!(view instanceof NineSliceSprite)) continue;\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n }\r\n\r\n get enabled(): boolean {\r\n return this.enabledState;\r\n }\r\n\r\n set enabled(value: boolean) {\r\n this.applyEnabled(value);\r\n }\r\n\r\n get state(): ButtonStateKey {\r\n return KEY_BY_FANCY_STATE[this.button.state];\r\n }\r\n\r\n /** Forces a visual state without changing `enabled`, so a disabled button still emits no press. */\r\n setState(state: ButtonStateKey): void {\r\n this.button.setState(FANCY_STATE_BY_KEY[state]);\r\n }\r\n\r\n get onPress(): FancyButton[\"onPress\"] { return this.button.onPress; }\r\n get onDown(): FancyButton[\"onDown\"] { return this.button.onDown; }\r\n get onUp(): FancyButton[\"onUp\"] { return this.button.onUp; }\r\n get onHover(): FancyButton[\"onHover\"] { return this.button.onHover; }\r\n get onOut(): FancyButton[\"onOut\"] { return this.button.onOut; }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ButtonNodeView.js","sourceRoot":"","sources":["../../src/views/ButtonNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwD,MAAM,wBAAwB,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAW,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,QAAQ,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,OAAO,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,KAA2B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAChE","sourcesContent":["import { BUTTON_STATE_KEYS, type ButtonStateKey, type LayoutPadding, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { FancyButton } from \"@pixi/ui\";\r\nimport type { Sound } from \"@pixi/sound\";\r\nimport { Container, Graphics, NineSliceSprite, Sprite, Texture } from \"pixi.js\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type ButtonNode = Extract<UINode, { type: \"button\" }>;\r\n\r\nconst FANCY_STATE_BY_KEY = { normal: \"default\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\nconst KEY_BY_FANCY_STATE = { default: \"normal\", hover: \"hover\", pressed: \"pressed\", disabled: \"disabled\" } as const;\r\n\r\n/**\r\n * Adapts a button node to `@pixi/ui`'s `FancyButton`, which owns the pointer state machine —\r\n * this class never reimplements it. Optional states fall back to the normal image, and runtime\r\n * changes to `enabled` or the current state stay in the view: they never touch the document.\r\n *\r\n * `nineSlice`, when set, applies the same borders to all four state views (`NineSliceSprite`\r\n * instead of `Sprite`) — the button's frame shape is normally the same regardless of which state\r\n * image is currently shown.\r\n */\r\nexport class ButtonNodeView extends NodeView {\r\n private button!: FancyButton;\r\n private stateViews!: Record<ButtonStateKey, Container>;\r\n private readonly interaction: SceneInteractionMode;\r\n private readonly sounds: ReadonlyMap<string, Sound> | undefined;\r\n private soundAssetIds: ButtonNode[\"sounds\"];\r\n private enabledState: boolean;\r\n\r\n constructor(node: ButtonNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, sounds?: ReadonlyMap<string, Sound>) {\r\n super(textures);\r\n this.interaction = interaction;\r\n this.sounds = sounds;\r\n this.soundAssetIds = node.sounds;\r\n this.enabledState = node.enabled;\r\n this.buildButton(node);\r\n this.applyEnabled(node.enabled);\r\n }\r\n\r\n /**\r\n * Invisible (alpha 0) but still hit-testable: Pixi's `containsPoint` hit-tests the fill's geometry\r\n * regardless of its alpha. Painted with a real size *before* the view ever reaches `FancyButton`:\r\n * `FancyButton` reads `defaultView`'s bounds exactly once, synchronously during construction, to\r\n * freeze its own `hitArea` — it never re-reads them afterwards. A `Graphics` still at its default\r\n * (0, 0) size at that moment would freeze a zero-size, permanently unclickable hit area.\r\n */\r\n private static paintPlaceholder(graphics: Graphics, width: number, height: number): void {\r\n graphics.clear().rect(0, 0, width, height).fill({ color: 0x000000, alpha: 0 });\r\n }\r\n\r\n private static createStateView(texture: Texture | undefined, nineSlice: LayoutPadding | undefined, size: { width: number; height: number }): Container {\r\n if (texture === undefined) {\r\n const graphics = new Graphics();\r\n ButtonNodeView.paintPlaceholder(graphics, size.width, size.height);\r\n return graphics;\r\n }\r\n return nineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: nineSlice.left, topHeight: nineSlice.top, rightWidth: nineSlice.right, bottomHeight: nineSlice.bottom });\r\n }\r\n\r\n private static applyStateAppearance(view: Container, node: ButtonNode, state: ButtonStateKey): void {\r\n view.tint = node.states[`${state}Tint`] ?? \"#ffffff\";\r\n view.alpha = node.states[`${state}Opacity`] ?? 1;\r\n }\r\n\r\n /**\r\n * (Re)builds `FancyButton` and its four state views. `FancyButton` has no API to replace a view\r\n * after construction, so any change to a view's *type* — nine-slice toggled, or an asset\r\n * finishing an async load — goes through here instead of `syncContent`'s cheap in-place path.\r\n *\r\n * `size` is the best size known *right now*: the resolved layout rectangle when called from\r\n * `syncContent`, or the authored transform when called from the constructor (before any layout\r\n * pass has run). Only feeds the initial placeholder paint above — see its doc comment for why.\r\n */\r\n private buildButton(node: ButtonNode, size?: { width: number; height: number }): void {\r\n const nineSlice = node.nineSlice;\r\n const resolvedSize = size ?? { width: node.transform.width, height: node.transform.height };\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n const stateViews = {} as Record<ButtonStateKey, Container>;\r\n const viewFor = (state: ButtonStateKey, assetId: string | undefined): Container => {\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n const view = ButtonNodeView.createStateView(texture, nineSlice, resolvedSize);\r\n ButtonNodeView.applyStateAppearance(view, node, 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\", node.states.normalAssetId),\r\n hoverView: viewFor(\"hover\", node.states.hoverAssetId),\r\n pressedView: viewFor(\"pressed\", node.states.pressedAssetId),\r\n disabledView: viewFor(\"disabled\", node.states.disabledAssetId),\r\n });\r\n // Authoring-сцена инертна: FancyButton уже включил себе eventMode \"static\", снимаем его до applyEnabled.\r\n // Выделение и drag при этом не страдают: попадание ловит hitArea базового NodeView, а не это поддерево.\r\n if (this.interaction === \"authoring\") button.eventMode = \"none\";\r\n else if (this.sounds !== undefined) {\r\n button.onPress.connect(() => { const result = this.soundAssetIds?.pressAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.pressAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n button.onHover.connect(() => { const result = this.soundAssetIds?.hoverAssetId === undefined ? undefined : this.sounds?.get(this.soundAssetIds.hoverAssetId)?.play(); if (result instanceof Promise) void result.catch(() => undefined); });\r\n }\r\n this.button = button;\r\n this.stateViews = stateViews;\r\n this.setContent(button);\r\n }\r\n\r\n /** In authoring mode `enabled` may only drive the visuals: `FancyButton` couples it to `eventMode`. */\r\n private applyEnabled(enabled: boolean): void {\r\n this.enabledState = enabled;\r\n if (this.interaction === \"runtime\") this.button.enabled = enabled;\r\n else this.button.setState(enabled ? \"default\" : \"disabled\");\r\n }\r\n\r\n protected syncContent(node: UINode, transform: UINode[\"transform\"]): void {\r\n if (node.type !== \"button\") return;\r\n this.soundAssetIds = node.sounds;\r\n const nineSlice = node.nineSlice;\r\n const normalTexture = this.textureFor(node.states.normalAssetId);\r\n\r\n // A state view's required *type* (Graphics/Sprite/NineSliceSprite) may no longer match what's\r\n // needed — nine-slice toggled, or a texture finished loading after this view had to fall back\r\n // to Graphics. FancyButton can't swap a view after construction, so that goes through a full\r\n // rebuild; everything else (texture identity, border values, size) updates the live views in\r\n // place, which is the path a nine-slice gizmo drag runs every frame.\r\n let needsRebuild = false;\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n const view = this.stateViews[state];\r\n const wantsNineSlice = texture !== undefined && nineSlice !== undefined;\r\n const matches = texture === undefined ? view instanceof Graphics : wantsNineSlice ? view instanceof NineSliceSprite : view instanceof Sprite && !(view instanceof NineSliceSprite);\r\n if (!matches) { needsRebuild = true; break; }\r\n }\r\n\r\n if (needsRebuild) {\r\n this.buildButton(node, transform);\r\n } else {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n const assetId = node.states[`${state}AssetId`];\r\n const texture = (assetId === undefined ? undefined : this.textureFor(assetId)) ?? normalTexture;\r\n // Set the texture before the layout size: Sprite/NineSliceSprite preserve scale when their\r\n // texture changes, so sizing first would shift visual bounds for a differently-sized source.\r\n if (view instanceof NineSliceSprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n if (nineSlice !== undefined) {\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Sprite) {\r\n if (texture !== undefined && view.texture !== texture) view.texture = texture;\r\n view.setSize(transform.width, transform.height);\r\n } else if (view instanceof Graphics) {\r\n ButtonNodeView.paintPlaceholder(view, transform.width, transform.height);\r\n }\r\n ButtonNodeView.applyStateAppearance(view, node, state);\r\n }\r\n }\r\n\r\n // Только на изменение документа: иначе любой пересчёт layout сбрасывал бы transient preview state.\r\n if (node.enabled !== this.enabledState) this.applyEnabled(node.enabled);\r\n }\r\n\r\n /** Editor-only live preview of nine-slice border edits while dragging the canvas gizmo. */\r\n previewNineSlice(nineSlice: LayoutPadding): void {\r\n for (const state of BUTTON_STATE_KEYS) {\r\n const view = this.stateViews[state];\r\n if (!(view instanceof NineSliceSprite)) continue;\r\n view.leftWidth = nineSlice.left;\r\n view.topHeight = nineSlice.top;\r\n view.rightWidth = nineSlice.right;\r\n view.bottomHeight = nineSlice.bottom;\r\n }\r\n }\r\n\r\n get enabled(): boolean {\r\n return this.enabledState;\r\n }\r\n\r\n set enabled(value: boolean) {\r\n this.applyEnabled(value);\r\n }\r\n\r\n get state(): ButtonStateKey {\r\n return KEY_BY_FANCY_STATE[this.button.state];\r\n }\r\n\r\n /** Forces a visual state without changing `enabled`, so a disabled button still emits no press. */\r\n setState(state: ButtonStateKey): void {\r\n this.button.setState(FANCY_STATE_BY_KEY[state]);\r\n }\r\n\r\n get onPress(): FancyButton[\"onPress\"] { return this.button.onPress; }\r\n get onDown(): FancyButton[\"onDown\"] { return this.button.onDown; }\r\n get onUp(): FancyButton[\"onUp\"] { return this.button.onUp; }\r\n get onHover(): FancyButton[\"onHover\"] { return this.button.onHover; }\r\n get onOut(): FancyButton[\"onOut\"] { return this.button.onOut; }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemTableNodeView.js","sourceRoot":"","sources":["../../src/views/ItemTableNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAqC,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IACrC,SAAS,GAA8B,EAAE,CAAC;IAC1C,oBAAoB,GAAG,CAAC,CAAC;IACjC,+FAA+F;IACvF,mBAAmB,CAAU;IACrC,oGAAoG;IAC5F,kBAAkB,CAAW;IAErC;;;;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IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,+FAA+F;IAC/F,eAAe,CAAC,OAA4B;QAC1C,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC;QAClC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACK,eAAe;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACrC,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO;YAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,KAAK,GAAG,KAAK,CAAC;YACzD,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;gBAC7B,IAAI,CAAC,aAAa,GAAG,CAAC,OAAO,CAAC;gBAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,eAAe,CAAC;gBAC/C,OAAO;YACT,CAAC;YACD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAES,WAAW,CAAC,IAAY,EAAE,UAA+B,EAAE,OAAwB;QAC3F,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;YAAE,OAAO;QACvC,IAAI,CAAC,oBAAoB,GAAG,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["import { resolveItemTableVisibleCount, type LayoutProfileId, type UINode } from \"@pixi-ui-editor/schema\";\nimport { Container } from \"pixi.js\";\nimport { NodeView } from \"./NodeView.js\";\n\n/**\n * Узел фиксированной вместимости: держит авторский список узлов (`items`, ссылки по адресу — их\n * разрешает `scene.ts`, тем же приёмом, что цели spine-коннекторов) и показывает только первые\n * `visibleCount` из них — остальные скрыты всегда, а не «на этой странице». Автор раскладывает\n * элементы под максимум, а сколько их реально помещается, задаётся на профиль: в разной ориентации\n * экрана на экран влезает разное число строк.\n *\n * Список именно авторский, а не дети: элемент обычно уже лежит там, где его выравнивает layout-группа.\n *\n * Узел намеренно ничего больше не делает. Он не страницы (`PageGroupNodeView` показывает ровно\n * одного ребёнка и растягивает его на себя), не раскладка (позицию элементы сохраняют свою) и ничего не\n * знает ни про какие данные: чем наполнить видимые элементы и когда, решает игровой код через\n * generic API из `controls.ts` (`getItemTableViewVisibleItems`, `getItemTableViewItem`,\n * `setItemTableViewVisibleCount`, `setItemTableViewItemsVisible`). Связка «переключили страницу →\n * перезаполнили элементы» тоже принадлежит игре: `PaginationNodeView.onPageChange` и эта таблица\n * ничего друг о друге не знают.\n *\n * Видимость складывается с авторской: элемент, скрытый в документе, не станет видимым из-за\n * вместимости, а скрытый вместимостью держится флагом `NodeView.hiddenByOwner` (см. `applyVisibility`).\n */\nexport class ItemTableNodeView extends NodeView {\n private itemViews: (Container | undefined)[] = [];\n private authoredVisibleCount = 0;\n /** Транзиентное переопределение от игрового кода; `undefined` — авторское значение профиля. */\n private runtimeVisibleCount?: number;\n /** Транзиентный «скрыть/показать всё» поверх вместимости; `undefined` — вместимость решает сама. */\n private forcedItemsVisible?: boolean;\n\n /**\n * Разрешённые views авторского списка `items`, позиционно выровненные с ним (`scene.ts`). Ссылка,\n * которая ни во что не разрешилась, сохраняет свою дырку `undefined`, чтобы остальные элементы не\n * сдвинулись; сама висячая ссылка — ошибка валидации документа, а не забота этого вида.\n */\n setItems(views: readonly (Container | undefined)[]): void {\n // Выбывшие из списка возвращаются под управление документа: иначе узел, убранный из таблицы,\n // остался бы скрытым её прежней вместимостью навсегда.\n const next = new Set(views);\n for (const previous of this.itemViews) {\n if (previous instanceof NodeView && !next.has(previous)) { previous.hiddenByOwner = false; previous.visible = previous.documentVisible; }\n }\n this.itemViews = [...views];\n this.applyVisibility();\n }\n\n /** Элементы в авторском порядке; нерезолвенные ссылки пропущены. */\n get items(): Container[] {\n return this.itemViews.filter((item): item is Container => item !== undefined);\n }\n\n get visibleCount(): number {\n return this.runtimeVisibleCount ?? this.authoredVisibleCount;\n }\n\n /** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */\n set visibleCount(value: number | undefined) {\n this.runtimeVisibleCount = value === undefined ? undefined : Math.max(0, Math.round(value));\n this.applyVisibility();\n }\n\n /** Элементы, показанные прямо сейчас, в авторском порядке. */\n get visibleItems(): Container[] {\n return this.items.filter((item) => item.visible);\n }\n\n /** Индекс — позиция в авторском списке, а не среди показанных: адресация не «плавает». */\n itemAt(index: number): Container | undefined {\n return this.itemViews[index];\n }\n\n /** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */\n setItemsVisible(visible: boolean | undefined): void {\n this.forcedItemsVisible = visible;\n this.applyVisibility();\n }\n\n /**\n * Проход по элементам: влезающие включены, остальные выключены. Помимо самого `visible` ставится\n * `hiddenByOwner`, потому что `visible` узла пересчитывается из документа на каждом обновлении —\n * в том числе из колбэка layout-движка, который для элемента внутри layout-группы срабатывает\n * позже прохода таблицы и без флага вернул бы скрытый элемент обратно.\n */\n private applyVisibility(): void {\n const count = this.visibleCount;\n this.itemViews.forEach((item, index) => {\n if (item === undefined) return;\n const enabled = this.forcedItemsVisible ?? index < count;\n if (item instanceof NodeView) {\n item.hiddenByOwner = !enabled;\n item.visible = enabled && item.documentVisible;\n return;\n }\n item.visible = enabled;\n });\n }\n\n protected syncContent(node: UINode, _transform: UINode[\"transform\"], profile: LayoutProfileId): void {\n if (node.type !== \"item-table\") return;\n this.authoredVisibleCount = resolveItemTableVisibleCount(node, profile);\n this.applyVisibility();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ItemTableNodeView.js","sourceRoot":"","sources":["../../src/views/ItemTableNodeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAqC,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;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editor/schema\";\r\nimport { Container } from \"pixi.js\";\r\nimport { NodeView } from \"./NodeView.js\";\r\n\r\n/**\r\n * Узел фиксированной вместимости: держит авторский список узлов (`items`, ссылки по адресу — их\r\n * разрешает `scene.ts`, тем же приёмом, что цели spine-коннекторов) и показывает только первые\r\n * `visibleCount` из них — остальные скрыты всегда, а не «на этой странице». Автор раскладывает\r\n * элементы под максимум, а сколько их реально помещается, задаётся на профиль: в разной ориентации\r\n * экрана на экран влезает разное число строк.\r\n *\r\n * Список именно авторский, а не дети: элемент обычно уже лежит там, где его выравнивает layout-группа.\r\n *\r\n * Узел намеренно ничего больше не делает. Он не страницы (`PageGroupNodeView` показывает ровно\r\n * одного ребёнка и растягивает его на себя), не раскладка (позицию элементы сохраняют свою) и ничего не\r\n * знает ни про какие данные: чем наполнить видимые элементы и когда, решает игровой код через\r\n * generic API из `controls.ts` (`getItemTableViewVisibleItems`, `getItemTableViewItem`,\r\n * `setItemTableViewVisibleCount`, `setItemTableViewItemsVisible`). Связка «переключили страницу →\r\n * перезаполнили элементы» тоже принадлежит игре: `PaginationNodeView.onPageChange` и эта таблица\r\n * ничего друг о друге не знают.\r\n *\r\n * Видимость складывается с авторской: элемент, скрытый в документе, не станет видимым из-за\r\n * вместимости, а скрытый вместимостью держится флагом `NodeView.hiddenByOwner` (см. `applyVisibility`).\r\n */\r\nexport class ItemTableNodeView extends NodeView {\r\n private itemViews: (Container | undefined)[] = [];\r\n private authoredVisibleCount = 0;\r\n /** Транзиентное переопределение от игрового кода; `undefined` — авторское значение профиля. */\r\n private runtimeVisibleCount?: number;\r\n /** Транзиентный «скрыть/показать всё» поверх вместимости; `undefined` — вместимость решает сама. */\r\n private forcedItemsVisible?: boolean;\r\n\r\n /**\r\n * Разрешённые views авторского списка `items`, позиционно выровненные с ним (`scene.ts`). Ссылка,\r\n * которая ни во что не разрешилась, сохраняет свою дырку `undefined`, чтобы остальные элементы не\r\n * сдвинулись; сама висячая ссылка — ошибка валидации документа, а не забота этого вида.\r\n */\r\n setItems(views: readonly (Container | undefined)[]): void {\r\n // Выбывшие из списка возвращаются под управление документа: иначе узел, убранный из таблицы,\r\n // остался бы скрытым её прежней вместимостью навсегда.\r\n const next = new Set(views);\r\n for (const previous of this.itemViews) {\r\n if (previous instanceof NodeView && !next.has(previous)) { previous.hiddenByOwner = false; previous.visible = previous.documentVisible; }\r\n }\r\n this.itemViews = [...views];\r\n this.applyVisibility();\r\n }\r\n\r\n /** Элементы в авторском порядке; нерезолвенные ссылки пропущены. */\r\n get items(): Container[] {\r\n return this.itemViews.filter((item): item is Container => item !== undefined);\r\n }\r\n\r\n get visibleCount(): number {\r\n return this.runtimeVisibleCount ?? this.authoredVisibleCount;\r\n }\r\n\r\n /** Транзиентно меняет вместимость; `undefined` возвращает авторское значение профиля. */\r\n set visibleCount(value: number | undefined) {\r\n this.runtimeVisibleCount = value === undefined ? undefined : Math.max(0, Math.round(value));\r\n this.applyVisibility();\r\n }\r\n\r\n /** Элементы, показанные прямо сейчас, в авторском порядке. */\r\n get visibleItems(): Container[] {\r\n return this.items.filter((item) => item.visible);\r\n }\r\n\r\n /** Индекс — позиция в авторском списке, а не среди показанных: адресация не «плавает». */\r\n itemAt(index: number): Container | undefined {\r\n return this.itemViews[index];\r\n }\r\n\r\n /** Показывает или прячет все элементы разом; `undefined` возвращает управление вместимости. */\r\n setItemsVisible(visible: boolean | undefined): void {\r\n this.forcedItemsVisible = visible;\r\n this.applyVisibility();\r\n }\r\n\r\n /**\r\n * Проход по элементам: влезающие включены, остальные выключены. Помимо самого `visible` ставится\r\n * `hiddenByOwner`, потому что `visible` узла пересчитывается из документа на каждом обновлении —\r\n * в том числе из колбэка layout-движка, который для элемента внутри layout-группы срабатывает\r\n * позже прохода таблицы и без флага вернул бы скрытый элемент обратно.\r\n */\r\n private applyVisibility(): void {\r\n const count = this.visibleCount;\r\n this.itemViews.forEach((item, index) => {\r\n if (item === undefined) return;\r\n const enabled = this.forcedItemsVisible ?? index < count;\r\n if (item instanceof NodeView) {\r\n item.hiddenByOwner = !enabled;\r\n item.visible = enabled && item.documentVisible;\r\n return;\r\n }\r\n item.visible = enabled;\r\n });\r\n }\r\n\r\n protected syncContent(node: UINode, _transform: UINode[\"transform\"], profile: LayoutProfileId): void {\r\n if (node.type !== \"item-table\") return;\r\n this.authoredVisibleCount = resolveItemTableVisibleCount(node, profile);\r\n this.applyVisibility();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationNodeView.js","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAyB,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAIpE,MAAM,oBAAoB,GAAwB,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAEpP;wGACwG;AACxG,SAAS,eAAe,CAAC,KAAsC,EAAE,IAAY,EAAE,KAA8C;IAC3H,MAAM,QAAQ,GAAG,KAAK,IAAI,oBAAoB,CAAC;IAC/C,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,UAAU;QAC9H,QAAQ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AG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,IAAI,CAAC,SAAS,KAAK,iBAAiB;YAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;;YAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE/C,4GAA4G;IAC5G,IAAI,IAAI,CAAC,KAAa;QACpB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,iHAAiH;IACzG,OAAO,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { type LayoutPadding, type PaginationNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\nimport { List } from \"@pixi/ui\";\nimport { Container, NineSliceSprite, Sprite, Text, Texture, type TextStyleOptions } from \"pixi.js\";\nimport { Signal } from \"typed-signals\";\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\n\nexport type { PaginationNode };\n\nconst DEFAULT_NUMBER_STYLE: TextStyleDefinition = { fontFamily: \"Arial\", fontSize: 18, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\", align: \"center\", verticalAlign: \"middle\", wordWrap: false, breakWords: false, letterSpacing: 0 };\n\n/** Same shape `ValueControlNodeViews.ts`'s own `textStyle` resolves — kept as its own small copy rather\n * than shared, the same call ADR 0029 makes for two similar-but-separately-evolving style resolvers. */\nfunction numberTextStyle(style: TextStyleDefinition | undefined, fill: string, fonts: ReadonlyMap<string, string> | undefined): Partial<TextStyleOptions> {\n const resolved = style ?? DEFAULT_NUMBER_STYLE;\n return {\n fontFamily: resolved.fontAssetId === undefined ? resolved.fontFamily : fonts?.get(resolved.fontAssetId) ?? resolved.fontFamily,\n fontSize: resolved.fontSize,\n fontWeight: resolved.fontWeight,\n fontStyle: resolved.fontStyle,\n fill,\n align: resolved.align,\n wordWrap: resolved.wordWrap,\n breakWords: resolved.breakWords,\n lineHeight: resolved.lineHeight,\n letterSpacing: resolved.letterSpacing,\n stroke: resolved.stroke === undefined ? undefined : { color: resolved.stroke.color, width: resolved.stroke.width },\n };\n}\n\n/**\n * Кнопка-стрелка пагинатора: ровно та часть `ButtonNodeView`/`StagedButtonNodeView`, которая нужна\n * виджету, — нажатие и «доступна ли». Тип объявлен структурно, чтобы этот файл не зависел от обоих\n * классов кнопок и не решал, какой из них «настоящий».\n */\nexport type PaginationArrow = { onPress: { connect(handler: () => void): unknown }; enabled: boolean };\n\n/** Clamps a page index into the valid `[0, pageCount)` range; an empty widget still shows dot 0. */\nfunction clampPage(page: number, pageCount: number): number {\n return Math.min(Math.max(0, Math.round(page)), Math.max(0, pageCount - 1));\n}\n\n/**\n * One `numbers`-style item: a centered page-number label, plus an optional \"pill\" background shown\n * only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the\n * same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly\n * whether or not its (rarely-present) background happens to be attached right now.\n */\nclass NumberItem extends Container {\n private itemWidth = 0;\n private itemHeight = 0;\n private background?: Sprite | NineSliceSprite;\n\n // Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.\n constructor(readonly numberText: Text) {\n super();\n numberText.anchor.set(0.5);\n super.addChild(numberText);\n }\n\n override get width(): number { return this.itemWidth; }\n override set width(value: number) { this.itemWidth = value; }\n override get height(): number { return this.itemHeight; }\n override set height(value: number) { this.itemHeight = value; }\n\n resize(width: number, height: number): void {\n this.itemWidth = width;\n this.itemHeight = height;\n this.numberText.position.set(width / 2, height / 2);\n this.background?.setSize(width, height);\n }\n\n /** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */\n setBackground(view: Sprite | NineSliceSprite | undefined): void {\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); }\n this.background = view;\n if (view === undefined) return;\n view.setSize(this.itemWidth, this.itemHeight);\n super.addChildAt(view, 0);\n }\n}\n\n/**\n * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same\n * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never\n * reimplements arrangement. Deliberately not wired to any scroll-view: game code owns the actual page\n * transition and drives the widget one-way through `setPaginationViewPage`/`setPaginationViewPageCount`,\n * the same relationship a slider or progress bar has to whatever value it displays.\n *\n * `style` picks between two mutually exclusive, differently-rendered item kinds — image dots\n * (`Sprite`, two states) or rendered page-number text (`NumberItem`: a label, base style + an optional\n * highlight color, plus an optional pill background behind only the current page) — never both.\n * Switching `style` rebuilds every item, the same \"view's required *type* changed\" rule\n * `StagedButtonNodeView` follows for its state views; `pageCount`/`dotSize` changes do too, since the\n * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this\n * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself\n * is not structural: switching pages only recreates the (one) background view that needs to move.\n *\n * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active\n * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real\n * page range keeps its footprint and renders nothing, so the active page never shifts sideways.\n *\n * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the\n * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution\n * Spine connector targets use) and steps the page on press. It never draws an arrow itself.\n */\nexport class PaginationNodeView extends NodeView {\n private readonly list: List;\n private readonly interaction: SceneInteractionMode;\n private readonly fonts: ReadonlyMap<string, string> | undefined;\n private items: (Sprite | NumberItem)[] = [];\n private visibleSlots: number | undefined;\n private arrows?: { previous?: PaginationArrow; next?: PaginationArrow };\n private styleMode: PaginationNode[\"style\"];\n private activeTexture: Texture;\n private inactiveTexture: Texture;\n private numberStyle: TextStyleDefinition | undefined;\n private numberActiveColor: string | undefined;\n private numberActiveBackgroundTexture: Texture | undefined;\n private numberActiveNineSlice: LayoutPadding | undefined;\n private pageCountState: number;\n private currentPage: number;\n private dotWidth: number;\n private dotHeight: number;\n private clickableState: boolean;\n\n /** Fires only from a click on an item (when `clickable`); setting `page` programmatically never emits. */\n readonly onPageChange = new Signal<(page: number) => void>();\n\n constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined) {\n super(textures);\n this.interaction = interaction;\n this.fonts = fonts;\n this.styleMode = node.style;\n this.activeTexture = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n this.inactiveTexture = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.pageCountState = Math.max(1, Math.round(node.pageCount));\n this.visibleSlots = node.visiblePageCount;\n this.currentPage = clampPage(node.defaultPage, this.pageCount);\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.clickableState = node.clickable;\n this.list = new List({ type: node.direction, elementsMargin: node.spacing });\n this.buildItems();\n this.setContent(this.list);\n }\n\n private createBackgroundView(texture: Texture): Sprite | NineSliceSprite {\n return this.numberActiveNineSlice === undefined\n ? new Sprite(texture)\n : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });\n }\n\n /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */\n private get slotCount(): number {\n return this.visibleSlots === undefined ? this.pageCount : Math.max(1, Math.round(this.visibleSlots));\n }\n\n /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */\n private pageForSlot(slot: number): number {\n return this.visibleSlots === undefined ? slot : this.currentPage - Math.floor(this.slotCount / 2) + slot;\n }\n\n private createItem(slot: number): Sprite | NumberItem {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (this.styleMode === \"dots\") {\n const dot = new Sprite(isActive ? this.activeTexture : this.inactiveTexture);\n dot.setSize(this.dotWidth, this.dotHeight);\n // An out-of-range slot renders nothing but keeps its size, so `List` still reserves its place.\n dot.visible = exists;\n return dot;\n }\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\n const item = new NumberItem(new Text({ text: exists ? String(page + 1) : \"\", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));\n item.resize(this.dotWidth, this.dotHeight);\n if (isActive && this.numberActiveBackgroundTexture !== undefined) item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));\n return item;\n }\n\n /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */\n private buildItems(): void {\n this.list.removeChildren();\n this.items = [];\n for (let slot = 0; slot < this.slotCount; slot++) {\n const item = this.createItem(slot);\n this.wireItem(item, slot);\n this.items.push(item);\n this.list.addChild(item);\n }\n this.applyArrowState();\n }\n\n /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */\n private wireItem(item: Sprite | NumberItem, slot: number): void {\n if (this.interaction === \"authoring\" || !this.clickableState) { item.eventMode = \"none\"; return; }\n item.eventMode = \"static\";\n item.cursor = \"pointer\";\n // Resolved on click, not captured: a windowed slot points at a different page after every move.\n item.on(\"pointertap\", () => {\n const page = this.pageForSlot(slot);\n if (page >= 0 && page < this.pageCount) this.setPage(page);\n });\n }\n\n private applyCurrentPage(): void {\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\n this.items.forEach((item, slot) => {\n const page = this.pageForSlot(slot);\n const exists = page >= 0 && page < this.pageCount;\n const isActive = exists && page === this.currentPage;\n if (item instanceof NumberItem) {\n item.numberText.text = exists ? String(page + 1) : \"\";\n item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);\n item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);\n return;\n }\n item.texture = isActive ? this.activeTexture : this.inactiveTexture;\n item.setSize(this.dotWidth, this.dotHeight);\n item.visible = exists;\n });\n this.applyArrowState();\n }\n\n /**\n * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит\n * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только\n * подписывается на них и гасит ту, за которой страниц больше нет.\n */\n setArrows(arrows: { previous?: PaginationArrow; next?: PaginationArrow }): void {\n this.arrows = arrows;\n arrows.previous?.onPress.connect(() => this.setPage(this.currentPage - 1));\n arrows.next?.onPress.connect(() => this.setPage(this.currentPage + 1));\n this.applyArrowState();\n }\n\n /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */\n private applyArrowState(): void {\n if (this.arrows === undefined) return;\n if (this.arrows.previous !== undefined) this.arrows.previous.enabled = this.currentPage > 0;\n if (this.arrows.next !== undefined) this.arrows.next.enabled = this.currentPage < this.pageCount - 1;\n }\n\n protected syncContent(node: UINode): void {\n if (node.type !== \"pagination\") return;\n const active = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\n const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\n const pageCount = Math.max(1, Math.round(node.pageCount));\n this.clickableState = node.clickable;\n\n const previousSlotCount = this.slotCount;\n this.visibleSlots = node.visiblePageCount;\n this.pageCountState = pageCount;\n const structureChanged = node.style !== this.styleMode || this.slotCount !== previousSlotCount || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;\n this.styleMode = node.style;\n this.activeTexture = active;\n this.inactiveTexture = inactive;\n this.numberStyle = node.numberStyle;\n this.numberActiveColor = node.numberActiveColor;\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\n this.numberActiveNineSlice = node.numberActiveNineSlice;\n this.dotWidth = node.dotSize.width;\n this.dotHeight = node.dotSize.height;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n\n if (this.list.type !== node.direction) this.list.type = node.direction;\n if (this.list.elementsMargin !== node.spacing) this.list.elementsMargin = node.spacing;\n\n if (structureChanged) this.buildItems();\n else this.applyCurrentPage();\n }\n\n get pageCount(): number { return this.pageCountState; }\n\n /** Used by `setPaginationViewPageCount` once game code knows the real content length. */\n set pageCount(value: number) {\n const next = Math.max(1, Math.round(value));\n if (next === this.pageCountState) return;\n const previousSlotCount = this.slotCount;\n this.pageCountState = next;\n this.currentPage = clampPage(this.currentPage, this.pageCount);\n if (this.slotCount === previousSlotCount) this.applyCurrentPage();\n else this.buildItems();\n }\n\n get page(): number { return this.currentPage; }\n\n /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */\n set page(value: number) {\n const next = clampPage(value, this.pageCountState);\n if (next === this.currentPage) return;\n this.currentPage = next;\n this.applyCurrentPage();\n }\n\n /** An item click: highlights immediately, then notifies game code — the same order a checkbox/slider follows. */\n private setPage(index: number): void {\n const next = clampPage(index, this.pageCountState);\n if (next !== this.currentPage) { this.currentPage = next; this.applyCurrentPage(); }\n this.onPageChange.emit(next);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PaginationNodeView.js","sourceRoot":"","sources":["../../src/views/PaginationNodeView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAyB,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA6B,MAAM,eAAe,CAAC;AAIpE,MAAM,oBAAoB,GAAwB,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAEpP;wGACwG;AACxG,SAAS,eAAe,CAAC,KAAsC,EAAE,IAAY,EAAE,KAA8C;IAC3H,MAAM,QAAQ,GAAG,KAAK,IAAI,oBAAoB,CAAC;IAC/C,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,UAAU;QAC9H,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,IAAI;QACJ,KAAK,EAAE,QAAQ,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,KAAK,iBAAiB;YAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;;YAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE/C,4GAA4G;IAC5G,IAAI,IAAI,CAAC,KAAa;QACpB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED,iHAAiH;IACzG,OAAO,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { type LayoutPadding, type PaginationNode, type TextStyleDefinition, type UINode } from \"@pixi-ui-editor/schema\";\r\nimport { List } from \"@pixi/ui\";\r\nimport { Container, NineSliceSprite, Sprite, Text, Texture, type TextStyleOptions } from \"pixi.js\";\r\nimport { Signal } from \"typed-signals\";\r\nimport { NodeView, type SceneInteractionMode } from \"./NodeView.js\";\r\n\r\nexport type { PaginationNode };\r\n\r\nconst DEFAULT_NUMBER_STYLE: TextStyleDefinition = { fontFamily: \"Arial\", fontSize: 18, fontWeight: \"normal\", fontStyle: \"normal\", fill: \"#FFFFFF\", align: \"center\", verticalAlign: \"middle\", wordWrap: false, breakWords: false, letterSpacing: 0 };\r\n\r\n/** Same shape `ValueControlNodeViews.ts`'s own `textStyle` resolves — kept as its own small copy rather\r\n * than shared, the same call ADR 0029 makes for two similar-but-separately-evolving style resolvers. */\r\nfunction numberTextStyle(style: TextStyleDefinition | undefined, fill: string, fonts: ReadonlyMap<string, string> | undefined): Partial<TextStyleOptions> {\r\n const resolved = style ?? DEFAULT_NUMBER_STYLE;\r\n return {\r\n fontFamily: resolved.fontAssetId === undefined ? resolved.fontFamily : fonts?.get(resolved.fontAssetId) ?? resolved.fontFamily,\r\n fontSize: resolved.fontSize,\r\n fontWeight: resolved.fontWeight,\r\n fontStyle: resolved.fontStyle,\r\n fill,\r\n align: resolved.align,\r\n wordWrap: resolved.wordWrap,\r\n breakWords: resolved.breakWords,\r\n lineHeight: resolved.lineHeight,\r\n letterSpacing: resolved.letterSpacing,\r\n stroke: resolved.stroke === undefined ? undefined : { color: resolved.stroke.color, width: resolved.stroke.width },\r\n };\r\n}\r\n\r\n/**\r\n * Кнопка-стрелка пагинатора: ровно та часть `ButtonNodeView`/`StagedButtonNodeView`, которая нужна\r\n * виджету, — нажатие и «доступна ли». Тип объявлен структурно, чтобы этот файл не зависел от обоих\r\n * классов кнопок и не решал, какой из них «настоящий».\r\n */\r\nexport type PaginationArrow = { onPress: { connect(handler: () => void): unknown }; enabled: boolean };\r\n\r\n/** Clamps a page index into the valid `[0, pageCount)` range; an empty widget still shows dot 0. */\r\nfunction clampPage(page: number, pageCount: number): number {\r\n return Math.min(Math.max(0, Math.round(page)), Math.max(0, pageCount - 1));\r\n}\r\n\r\n/**\r\n * One `numbers`-style item: a centered page-number label, plus an optional \"pill\" background shown\r\n * only while it is the current page. `width`/`height` are overridden to the authored `dotSize` — the\r\n * same fixed-footprint trick `ScrollItemContainer` uses — so the `List` spaces every item evenly\r\n * whether or not its (rarely-present) background happens to be attached right now.\r\n */\r\nclass NumberItem extends Container {\r\n private itemWidth = 0;\r\n private itemHeight = 0;\r\n private background?: Sprite | NineSliceSprite;\r\n\r\n // Named `numberText`, not `label`: `Container.label` is pixi.js's own display-object name string.\r\n constructor(readonly numberText: Text) {\r\n super();\r\n numberText.anchor.set(0.5);\r\n super.addChild(numberText);\r\n }\r\n\r\n override get width(): number { return this.itemWidth; }\r\n override set width(value: number) { this.itemWidth = value; }\r\n override get height(): number { return this.itemHeight; }\r\n override set height(value: number) { this.itemHeight = value; }\r\n\r\n resize(width: number, height: number): void {\r\n this.itemWidth = width;\r\n this.itemHeight = height;\r\n this.numberText.position.set(width / 2, height / 2);\r\n this.background?.setSize(width, height);\r\n }\r\n\r\n /** Replaces the pill behind the label (destroying the previous one); `undefined` removes it. */\r\n setBackground(view: Sprite | NineSliceSprite | undefined): void {\r\n if (this.background !== undefined) { super.removeChild(this.background); this.background.destroy(); }\r\n this.background = view;\r\n if (view === undefined) return;\r\n view.setSize(this.itemWidth, this.itemHeight);\r\n super.addChildAt(view, 0);\r\n }\r\n}\r\n\r\n/**\r\n * Standalone page indicator: N procedurally generated items arranged by `@pixi/ui`'s `List` (the same\r\n * approach `ScrollViewNodeView`/`scrollView.ts` use for arranging children) — this view never\r\n * reimplements arrangement. Deliberately not wired to any scroll-view: game code owns the actual page\r\n * transition and drives the widget one-way through `setPaginationViewPage`/`setPaginationViewPageCount`,\r\n * the same relationship a slider or progress bar has to whatever value it displays.\r\n *\r\n * `style` picks between two mutually exclusive, differently-rendered item kinds — image dots\r\n * (`Sprite`, two states) or rendered page-number text (`NumberItem`: a label, base style + an optional\r\n * highlight color, plus an optional pill background behind only the current page) — never both.\r\n * Switching `style` rebuilds every item, the same \"view's required *type* changed\" rule\r\n * `StagedButtonNodeView` follows for its state views; `pageCount`/`dotSize` changes do too, since the\r\n * item count/footprint is a runtime fact about this control, not scene topology — it only rebuilds this\r\n * view's own item children, never the owning `NodeView` or the wider scene tree. The active pill itself\r\n * is not structural: switching pages only recreates the (one) background view that needs to move.\r\n *\r\n * With `visiblePageCount` set, the indicator becomes a fixed strip of that many slots with the active\r\n * page always in the middle one (4 pages, page 3 active → 2-3-4). A slot pointing outside the real\r\n * page range keeps its footprint and renders nothing, so the active page never shifts sideways.\r\n *\r\n * The prev/next arrows are ordinary authored button nodes placed wherever the layout needs them; the\r\n * widget only takes their views (`scene.ts`'s `wireNodeReferences`, the same address → view resolution\r\n * Spine connector targets use) and steps the page on press. It never draws an arrow itself.\r\n */\r\nexport class PaginationNodeView extends NodeView {\r\n private readonly list: List;\r\n private readonly interaction: SceneInteractionMode;\r\n private readonly fonts: ReadonlyMap<string, string> | undefined;\r\n private items: (Sprite | NumberItem)[] = [];\r\n private visibleSlots: number | undefined;\r\n private arrows?: { previous?: PaginationArrow; next?: PaginationArrow };\r\n private styleMode: PaginationNode[\"style\"];\r\n private activeTexture: Texture;\r\n private inactiveTexture: Texture;\r\n private numberStyle: TextStyleDefinition | undefined;\r\n private numberActiveColor: string | undefined;\r\n private numberActiveBackgroundTexture: Texture | undefined;\r\n private numberActiveNineSlice: LayoutPadding | undefined;\r\n private pageCountState: number;\r\n private currentPage: number;\r\n private dotWidth: number;\r\n private dotHeight: number;\r\n private clickableState: boolean;\r\n\r\n /** Fires only from a click on an item (when `clickable`); setting `page` programmatically never emits. */\r\n readonly onPageChange = new Signal<(page: number) => void>();\r\n\r\n constructor(node: PaginationNode, textures: ReadonlyMap<string, Texture> | undefined, interaction: SceneInteractionMode, fonts: ReadonlyMap<string, string> | undefined) {\r\n super(textures);\r\n this.interaction = interaction;\r\n this.fonts = fonts;\r\n this.styleMode = node.style;\r\n this.activeTexture = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\r\n this.inactiveTexture = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\r\n this.numberStyle = node.numberStyle;\r\n this.numberActiveColor = node.numberActiveColor;\r\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\r\n this.numberActiveNineSlice = node.numberActiveNineSlice;\r\n this.pageCountState = Math.max(1, Math.round(node.pageCount));\r\n this.visibleSlots = node.visiblePageCount;\r\n this.currentPage = clampPage(node.defaultPage, this.pageCount);\r\n this.dotWidth = node.dotSize.width;\r\n this.dotHeight = node.dotSize.height;\r\n this.clickableState = node.clickable;\r\n this.list = new List({ type: node.direction, elementsMargin: node.spacing });\r\n this.buildItems();\r\n this.setContent(this.list);\r\n }\r\n\r\n private createBackgroundView(texture: Texture): Sprite | NineSliceSprite {\r\n return this.numberActiveNineSlice === undefined\r\n ? new Sprite(texture)\r\n : new NineSliceSprite({ texture, leftWidth: this.numberActiveNineSlice.left, topHeight: this.numberActiveNineSlice.top, rightWidth: this.numberActiveNineSlice.right, bottomHeight: this.numberActiveNineSlice.bottom });\r\n }\r\n\r\n /** How many indicator slots are drawn: the fixed authored window, or one slot per real page. */\r\n private get slotCount(): number {\r\n return this.visibleSlots === undefined ? this.pageCount : Math.max(1, Math.round(this.visibleSlots));\r\n }\r\n\r\n /** The page a slot points at. Windowed slots slide with the current page, which keeps its middle seat. */\r\n private pageForSlot(slot: number): number {\r\n return this.visibleSlots === undefined ? slot : this.currentPage - Math.floor(this.slotCount / 2) + slot;\r\n }\r\n\r\n private createItem(slot: number): Sprite | NumberItem {\r\n const page = this.pageForSlot(slot);\r\n const exists = page >= 0 && page < this.pageCount;\r\n const isActive = exists && page === this.currentPage;\r\n if (this.styleMode === \"dots\") {\r\n const dot = new Sprite(isActive ? this.activeTexture : this.inactiveTexture);\r\n dot.setSize(this.dotWidth, this.dotHeight);\r\n // An out-of-range slot renders nothing but keeps its size, so `List` still reserves its place.\r\n dot.visible = exists;\r\n return dot;\r\n }\r\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\r\n const fill = isActive ? this.numberActiveColor ?? baseFill : baseFill;\r\n const item = new NumberItem(new Text({ text: exists ? String(page + 1) : \"\", style: numberTextStyle(this.numberStyle, fill, this.fonts) }));\r\n item.resize(this.dotWidth, this.dotHeight);\r\n if (isActive && this.numberActiveBackgroundTexture !== undefined) item.setBackground(this.createBackgroundView(this.numberActiveBackgroundTexture));\r\n return item;\r\n }\r\n\r\n /** Recreates every item for the current `styleMode`/`slotCount`/`dotWidth`/`dotHeight`. */\r\n private buildItems(): void {\r\n this.list.removeChildren();\r\n this.items = [];\r\n for (let slot = 0; slot < this.slotCount; slot++) {\r\n const item = this.createItem(slot);\r\n this.wireItem(item, slot);\r\n this.items.push(item);\r\n this.list.addChild(item);\r\n }\r\n this.applyArrowState();\r\n }\r\n\r\n /** Authoring canvas stays inert like every other control; a clickable item is only live at runtime. */\r\n private wireItem(item: Sprite | NumberItem, slot: number): void {\r\n if (this.interaction === \"authoring\" || !this.clickableState) { item.eventMode = \"none\"; return; }\r\n item.eventMode = \"static\";\r\n item.cursor = \"pointer\";\r\n // Resolved on click, not captured: a windowed slot points at a different page after every move.\r\n item.on(\"pointertap\", () => {\r\n const page = this.pageForSlot(slot);\r\n if (page >= 0 && page < this.pageCount) this.setPage(page);\r\n });\r\n }\r\n\r\n private applyCurrentPage(): void {\r\n const baseFill = this.numberStyle?.fill ?? DEFAULT_NUMBER_STYLE.fill;\r\n this.items.forEach((item, slot) => {\r\n const page = this.pageForSlot(slot);\r\n const exists = page >= 0 && page < this.pageCount;\r\n const isActive = exists && page === this.currentPage;\r\n if (item instanceof NumberItem) {\r\n item.numberText.text = exists ? String(page + 1) : \"\";\r\n item.numberText.style = numberTextStyle(this.numberStyle, isActive ? this.numberActiveColor ?? baseFill : baseFill, this.fonts);\r\n item.setBackground(isActive && this.numberActiveBackgroundTexture !== undefined ? this.createBackgroundView(this.numberActiveBackgroundTexture) : undefined);\r\n return;\r\n }\r\n item.texture = isActive ? this.activeTexture : this.inactiveTexture;\r\n item.setSize(this.dotWidth, this.dotHeight);\r\n item.visible = exists;\r\n });\r\n this.applyArrowState();\r\n }\r\n\r\n /**\r\n * Подключает авторские кнопки-стрелки: нажатие шагает на страницу назад/вперёд и эмитит\r\n * `onPageChange`, как клик по самому пункту. Кнопки остаются обычными нодами сцены — виджет только\r\n * подписывается на них и гасит ту, за которой страниц больше нет.\r\n */\r\n setArrows(arrows: { previous?: PaginationArrow; next?: PaginationArrow }): void {\r\n this.arrows = arrows;\r\n arrows.previous?.onPress.connect(() => this.setPage(this.currentPage - 1));\r\n arrows.next?.onPress.connect(() => this.setPage(this.currentPage + 1));\r\n this.applyArrowState();\r\n }\r\n\r\n /** На краях диапазона соответствующая стрелка недоступна — она никуда не ведёт. */\r\n private applyArrowState(): void {\r\n if (this.arrows === undefined) return;\r\n if (this.arrows.previous !== undefined) this.arrows.previous.enabled = this.currentPage > 0;\r\n if (this.arrows.next !== undefined) this.arrows.next.enabled = this.currentPage < this.pageCount - 1;\r\n }\r\n\r\n protected syncContent(node: UINode): void {\r\n if (node.type !== \"pagination\") return;\r\n const active = node.activeAssetId === undefined ? Texture.WHITE : this.textureFor(node.activeAssetId) ?? Texture.WHITE;\r\n const inactive = node.inactiveAssetId === undefined ? Texture.WHITE : this.textureFor(node.inactiveAssetId) ?? Texture.WHITE;\r\n const pageCount = Math.max(1, Math.round(node.pageCount));\r\n this.clickableState = node.clickable;\r\n\r\n const previousSlotCount = this.slotCount;\r\n this.visibleSlots = node.visiblePageCount;\r\n this.pageCountState = pageCount;\r\n const structureChanged = node.style !== this.styleMode || this.slotCount !== previousSlotCount || node.dotSize.width !== this.dotWidth || node.dotSize.height !== this.dotHeight;\r\n this.styleMode = node.style;\r\n this.activeTexture = active;\r\n this.inactiveTexture = inactive;\r\n this.numberStyle = node.numberStyle;\r\n this.numberActiveColor = node.numberActiveColor;\r\n this.numberActiveBackgroundTexture = node.numberActiveBackgroundAssetId === undefined ? undefined : this.textureFor(node.numberActiveBackgroundAssetId);\r\n this.numberActiveNineSlice = node.numberActiveNineSlice;\r\n this.dotWidth = node.dotSize.width;\r\n this.dotHeight = node.dotSize.height;\r\n this.currentPage = clampPage(this.currentPage, this.pageCount);\r\n\r\n if (this.list.type !== node.direction) this.list.type = node.direction;\r\n if (this.list.elementsMargin !== node.spacing) this.list.elementsMargin = node.spacing;\r\n\r\n if (structureChanged) this.buildItems();\r\n else this.applyCurrentPage();\r\n }\r\n\r\n get pageCount(): number { return this.pageCountState; }\r\n\r\n /** Used by `setPaginationViewPageCount` once game code knows the real content length. */\r\n set pageCount(value: number) {\r\n const next = Math.max(1, Math.round(value));\r\n if (next === this.pageCountState) return;\r\n const previousSlotCount = this.slotCount;\r\n this.pageCountState = next;\r\n this.currentPage = clampPage(this.currentPage, this.pageCount);\r\n if (this.slotCount === previousSlotCount) this.applyCurrentPage();\r\n else this.buildItems();\r\n }\r\n\r\n get page(): number { return this.currentPage; }\r\n\r\n /** External sync from game code (or editor preview): highlights an item without emitting `onPageChange`. */\r\n set page(value: number) {\r\n const next = clampPage(value, this.pageCountState);\r\n if (next === this.currentPage) return;\r\n this.currentPage = next;\r\n this.applyCurrentPage();\r\n }\r\n\r\n /** An item click: highlights immediately, then notifies game code — the same order a checkbox/slider follows. */\r\n private setPage(index: number): void {\r\n const next = clampPage(index, this.pageCountState);\r\n if (next !== this.currentPage) { this.currentPage = next; this.applyCurrentPage(); }\r\n this.onPageChange.emit(next);\r\n }\r\n}\r\n"]}
|