Files
Foundry-VTT-Docker/resources/app/node_modules/@pixi/display/lib/Container.mjs.map

1 line
35 KiB
Plaintext
Raw Normal View History

2025-01-04 00:34:03 +01:00
{"version":3,"file":"Container.mjs","sources":["../src/Container.ts"],"sourcesContent":["import { MASK_TYPES, Matrix, utils } from '@pixi/core';\nimport { DisplayObject } from './DisplayObject';\n\nimport type { MaskData, Rectangle, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nconst tempMatrix = new Matrix();\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n * @example\n * import { BlurFilter, Container, Graphics, Sprite } from 'pixi.js';\n *\n * const container = new Container();\n * const sprite = Sprite.from('https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png');\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * @memberof PIXI\n */\nexport class Container<T extends DisplayObject = DisplayObject> extends DisplayObject\n{\n /**\n * Sets the default value for the container property `sortableChildren`.\n * If set to true, the container will sort its children by zIndex value\n * when `updateTransform()` is called, or manually if `sortChildren()` is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as {@link https://github.com/pixijs/layers PixiJS Layers}.\n *\n * Also be aware of that this may not work nicely with the `addChildAt()` function,\n * as the `zIndex` sorting may cause the child to automatically sorted to another position.\n * @static\n */\n public static defaultSortableChildren = false;\n\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by `zIndex` value\n * when `updateTransform()` is called, or manually if `sortChildren()` is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as {@link https://github.com/pixijs/layers PixiJS Layers}\n *\n * Also be aware of that this may not work nicely with the `addChildAt()` function,\n * as the `zIndex` sorting may cause the child to automatically sorted to another position.\n * @see PIXI.Container.defaultSortableChildren\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = Container.defaultSortableChildren;\n this.sortDirty = false;\n\n /**\n * Fire