Files
nothoughts/node_modules/pixi.js/lib/scene/container/RenderContainer.mjs.map
2025-08-04 18:57:35 +02:00

1 line
4.8 KiB
Plaintext

{"version":3,"file":"RenderContainer.mjs","sources":["../../../src/scene/container/RenderContainer.ts"],"sourcesContent":["import { Bounds, type BoundsData } from './bounds/Bounds';\nimport { Container } from './Container';\n\nimport type { Point } from '../../maths/point/Point';\nimport type { Instruction } from '../../rendering/renderers/shared/instructions/Instruction';\nimport type { View } from '../../rendering/renderers/shared/view/View';\nimport type { Renderer } from '../../rendering/renderers/types';\nimport type { ContainerOptions } from './Container';\n\ntype RenderFunction = (renderer: Renderer) => void;\n\n/**\n * Options for the {@link scene.RenderContainer} constructor.\n * @memberof scene\n */\nexport interface RenderContainerOptions extends ContainerOptions\n{\n /** the optional custom render function if you want to inject the function via the constructor */\n render?: RenderFunction;\n /** how to know if the custom render logic contains a point or not, used for interaction */\n containsPoint?: (point: Point) => boolean;\n /** how to add the bounds of this object when measuring */\n addBounds?: (bounds: BoundsData) => void;\n}\n\n/**\n * A container that allows for custom rendering logic. Its essentially calls the render function each frame\n * and allows for custom rendering logic - the render could be a WebGL renderer or WebGPU render or even a canvas render.\n * Its up to you to define the logic.\n *\n * This can be used in two ways, either by extending the class and overriding the render method,\n * or by passing a custom render function\n * @example\n * ```js\n * import { RenderContainer } from 'pixi.js';\n *\n * // extend the class\n * class MyRenderContainer extends RenderContainer\n * {\n * render(renderer)\n * {\n * renderer.clear({\n * clearColor: 'green', // clear the screen to green when rendering this item\n * });\n * }\n * }\n *\n * // override the render method\n * const renderContainer = new RenderContainer(\n * (renderer) => {\n * renderer.clear({\n * clearColor: 'green', // clear the screen to green when rendering this item\n * });\n * })\n * ```\n * @memberof scene\n * @extends scene.Container\n */\nexport class RenderContainer extends Container implements View, Instruction\n{\n public batched = false;\n /**\n * Whether or not to round the x/y position of the sprite.\n * @type {boolean}\n */\n public roundPixels: boolean;\n public _roundPixels: 0 | 1;\n\n public _lastUsed = 0;\n public _lastInstructionTick = -1;\n\n /**\n * The local bounds of the sprite.\n * @type {rendering.Bounds}\n */\n public bounds = new Bounds();\n /**\n * Checks if the object contains the given point.\n * @param point - The point to check\n */\n public containsPoint: (point: Point) => boolean;\n /**\n * Adds the bounds of this text to the bounds object.\n * @param bounds - The output bounds object.\n */\n public addBounds: (bounds: Bounds) => void;\n\n public canBundle = false;\n public readonly renderPipeId: string = 'customRender';\n\n /**\n * @param options - The options for the container.\n */\n constructor(options: RenderContainerOptions | RenderFunction)\n {\n if (typeof options === 'function')\n {\n options = { render: options };\n }\n\n const { render, ...rest } = options;\n\n super({\n label: 'RenderContainer',\n ...rest,\n });\n\n if (render) this.render = render;\n\n this.containsPoint = options.containsPoint ?? (() => false);\n this.addBounds = options.addBounds ?? (() => false);\n }\n\n /**\n * An overridable function that can be used to render the object using the current renderer.\n * @param _renderer - The current renderer\n */\n public render(_renderer: Renderer): void\n {\n // override me!\n }\n}\n"],"names":[],"mappings":";;;;AA0DO,MAAM,wBAAwB,SACrC,CAAA;AAAA;AAAA;AAAA;AAAA,EAkCI,YAAY,OACZ,EAAA;AACI,IAAI,IAAA,OAAO,YAAY,UACvB,EAAA;AACI,MAAU,OAAA,GAAA,EAAE,QAAQ,OAAQ,EAAA,CAAA;AAAA,KAChC;AAEA,IAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAS,GAAA,OAAA,CAAA;AAE5B,IAAM,KAAA,CAAA;AAAA,MACF,KAAO,EAAA,iBAAA;AAAA,MACP,GAAG,IAAA;AAAA,KACN,CAAA,CAAA;AA7CL,IAAA,IAAA,CAAO,OAAU,GAAA,KAAA,CAAA;AAQjB,IAAA,IAAA,CAAO,SAAY,GAAA,CAAA,CAAA;AACnB,IAAA,IAAA,CAAO,oBAAuB,GAAA,CAAA,CAAA,CAAA;AAM9B;AAAA;AAAA;AAAA;AAAA,IAAO,IAAA,CAAA,MAAA,GAAS,IAAI,MAAO,EAAA,CAAA;AAY3B,IAAA,IAAA,CAAO,SAAY,GAAA,KAAA,CAAA;AACnB,IAAA,IAAA,CAAgB,YAAuB,GAAA,cAAA,CAAA;AAmBnC,IAAI,IAAA,MAAA;AAAQ,MAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AAE1B,IAAK,IAAA,CAAA,aAAA,GAAgB,OAAQ,CAAA,aAAA,KAAkB,MAAM,KAAA,CAAA,CAAA;AACrD,IAAK,IAAA,CAAA,SAAA,GAAY,OAAQ,CAAA,SAAA,KAAc,MAAM,KAAA,CAAA,CAAA;AAAA,GACjD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,OAAO,SACd,EAAA;AAAA,GAEA;AACJ;;;;"}