1 line
3.6 KiB
Plaintext
1 line
3.6 KiB
Plaintext
{"version":3,"file":"View.mjs","sources":["../../../src/scene/view/View.ts"],"sourcesContent":["import { Bounds } from '../container/bounds/Bounds';\nimport { Container } from '../container/Container';\n\nimport type { PointData } from '../../maths/point/PointData';\nimport type { View } from '../../rendering/renderers/shared/view/View';\nimport type { BoundsData } from '../container/bounds/Bounds';\nimport type { DestroyOptions } from '../container/destroyTypes';\n\n/**\n * A ViewContainer is a type of container that represents a view.\n * This view can be a Sprite, a Graphics object, or any other object that can be rendered.\n * This class is abstract and should not be used directly.\n * @memberof scene\n */\nexport abstract class ViewContainer extends Container implements View\n{\n /** @private */\n public override readonly renderPipeId: string;\n /** @private */\n public readonly canBundle = true;\n /** @private */\n public override allowChildren = false;\n\n /** @private */\n public _roundPixels: 0 | 1 = 0;\n /** @private */\n public _lastUsed = 0;\n /** @private */\n public _lastInstructionTick = -1;\n\n protected _bounds: Bounds = new Bounds(0, 1, 0, 0);\n protected _boundsDirty = true;\n\n /**\n * The local bounds of the view.\n * @type {rendering.Bounds}\n */\n public abstract get bounds(): BoundsData;\n /** @private */\n public abstract addBounds(bounds: Bounds): void;\n /** @private */\n protected _updateBounds(): void\n {\n // override this\n }\n\n /**\n * Whether or not to round the x/y position of the sprite.\n * @type {boolean}\n */\n get roundPixels()\n {\n return !!this._roundPixels;\n }\n\n set roundPixels(value: boolean)\n {\n this._roundPixels = value ? 1 : 0;\n }\n\n /**\n * Checks if the object contains the given point.\n * @param point - The point to check\n */\n public containsPoint(point: PointData)\n {\n const bounds = this.bounds;\n const { x, y } = point;\n\n return (x >= bounds.minX\n && x <= bounds.maxX\n && y >= bounds.minY\n && y <= bounds.maxY);\n }\n\n /** @private */\n public abstract batched: boolean;\n\n /** @private */\n protected abstract onViewUpdate(): void;\n\n public override destroy(options?: DestroyOptions): void\n {\n super.destroy(options);\n\n this._bounds = null;\n }\n}\n"],"names":[],"mappings":";;;;AAcO,MAAe,sBAAsB,SAC5C,CAAA;AA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