{"version":3,"file":"NineSliceSprite.mjs","sources":["../../../src/scene/sprite-nine-slice/NineSliceSprite.ts"],"sourcesContent":["import { ObservablePoint } from '../../maths/point/ObservablePoint';\nimport { type PointData } from '../../maths/point/PointData';\nimport { Texture } from '../../rendering/renderers/shared/texture/Texture';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation';\nimport { ViewContainer, type ViewContainerOptions } from '../view/ViewContainer';\nimport { NineSliceGeometry } from './NineSliceGeometry';\nimport { type NineSliceSpriteGpuData } from './NineSliceSpritePipe';\n\nimport type { Size } from '../../maths/misc/Size';\nimport type { View } from '../../rendering/renderers/shared/view/View';\nimport type { Optional } from '../container/container-mixins/measureMixin';\nimport type { DestroyOptions } from '../container/destroyTypes';\n\n/**\n * Constructor options used for `NineSliceSprite` instances.\n * Defines how the sprite's texture is divided and scaled in nine sections.\n *
\n * A B\n * +---+----------------------+---+\n * C | 1 | 2 | 3 |\n * +---+----------------------+---+\n * | | | |\n * | 4 | 5 | 6 |\n * | | | |\n * +---+----------------------+---+\n * D | 7 | 8 | 9 |\n * +---+----------------------+---+\n * When changing this objects width and/or height:\n * areas 1 3 7 and 9 will remain unscaled.\n * areas 2 and 8 will be stretched horizontally\n * areas 4 and 6 will be stretched vertically\n * area 5 will be stretched both horizontally and vertically\n *\n * @example\n * ```ts\n * // Create a basic nine-slice sprite\n * const button = new NineSliceSprite({\n * texture: Texture.from('button.png'),\n * leftWidth: 20, // Left border (A)\n * rightWidth: 20, // Right border (B)\n * topHeight: 20, // Top border (C)\n * bottomHeight: 20, // Bottom border (D)\n * width: 100, // Initial width\n * height: 50, // Initial height\n * anchor: 0.5, // Center anchor point\n * });\n * ```\n * @see {@link NineSliceSprite} For the main sprite class\n * @see {@link Texture#defaultBorders} For texture-level border settings\n * @category scene\n * @standard\n */\nexport interface NineSliceSpriteOptions extends PixiMixins.NineSliceSpriteOptions, ViewContainerOptions\n{\n /**\n * The texture to use on the NineSliceSprite.\n * ```ts\n * // Create a sprite with a texture\n * const sprite = new NineSliceSprite({\n * texture: Texture.from('path/to/image.png')\n * });\n * // Update the texture later\n * sprite.texture = Texture.from('path/to/another-image.png');\n * ```\n * @default Texture.EMPTY\n */\n texture: Texture;\n\n /**\n * Width of the left vertical bar (A).\n * Controls the size of the left edge that remains unscaled\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., leftWidth: 20 });\n * sprite.leftWidth = 20; // Set left border width\n * ```\n * @default 10\n */\n leftWidth?: number;\n\n /**\n * Height of the top horizontal bar (C).\n * Controls the size of the top edge that remains unscaled\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., topHeight: 20 });\n * sprite.topHeight = 20; // Set top border height\n * ```\n * @default 10\n */\n topHeight?: number;\n\n /**\n * Width of the right vertical bar (B).\n * Controls the size of the right edge that remains unscaled\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., rightWidth: 20 });\n * sprite.rightWidth = 20; // Set right border width\n * ```\n * @default 10\n */\n rightWidth?: number;\n\n /**\n * Height of the bottom horizontal bar (D).\n * Controls the size of the bottom edge that remains unscaled\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., bottomHeight: 20 });\n * sprite.bottomHeight = 20; // Set bottom border height\n * ```\n * @default 10\n */\n bottomHeight?: number;\n\n /**\n * Width of the NineSliceSprite.\n * Modifies the vertices directly rather than UV coordinates\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., width: 200 });\n * sprite.width = 200; // Set the width of the sprite\n * ```\n * @default 100\n */\n width?: number;\n\n /**\n * Height of the NineSliceSprite.\n * Modifies the vertices directly rather than UV coordinates\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., height: 100 });\n * sprite.height = 100; // Set the height of the sprite\n * ```\n * @default 100\n */\n height?: number;\n\n /**\n * Whether to round the x/y position to whole pixels\n * @example\n * ```ts\n * const sprite = new NineSliceSprite({ ..., roundPixels: true });\n * ```\n * @default false\n */\n roundPixels?: boolean;\n\n /**\n * The anchor point of the NineSliceSprite (0-1 range)\n *\n * Controls the origin point for rotation, scaling, and positioning.\n * Can be a number for uniform anchor or a PointData for separate x/y values.\n * @default 0\n * @example\n * ```ts\n * // Centered anchor\n * const sprite = new NineSliceSprite({ ..., anchor: 0.5 });\n * sprite.anchor = 0.5;\n * // Separate x/y anchor\n * sprite.anchor = { x: 0.5, y: 0.5 };\n * // Right-aligned anchor\n * sprite.anchor = { x: 1, y: 0 };\n * // Update anchor directly\n * sprite.anchor.set(0.5, 0.5);\n * ```\n */\n anchor?: PointData | number;\n}\n// eslint-disable-next-line requireExport/require-export-jsdoc, requireMemberAPI/require-member-api-doc\nexport interface NineSliceSprite extends PixiMixins.NineSliceSprite, ViewContainer
\n * A B\n * +---+----------------------+---+\n * C | 1 | 2 | 3 |\n * +---+----------------------+---+\n * | | | |\n * | 4 | 5 | 6 |\n * | | | |\n * +---+----------------------+---+\n * D | 7 | 8 | 9 |\n * +---+----------------------+---+\n * When changing this objects width and/or height:\n * areas 1 3 7 and 9 will remain unscaled.\n * areas 2 and 8 will be stretched horizontally\n * areas 4 and 6 will be stretched vertically\n * area 5 will be stretched both horizontally and vertically\n *\n * @example\n * ```ts\n * import { NineSliceSprite, Texture } from 'pixi.js';\n *\n * const plane9 = new NineSliceSprite({\n * texture: Texture.from('BoxWithRoundedCorners.png'),\n * leftWidth: 15,\n * topHeight: 15,\n * rightWidth: 15,\n * bottomHeight: 15,\n * width: 200,\n * height: 100,\n * });\n * ```\n * @category scene\n * @standard\n */\nexport class NineSliceSprite extends ViewContainer