sdfsdfs
This commit is contained in:
650
node_modules/pixi.js/lib/scene/container/Container.d.ts
generated
vendored
Normal file
650
node_modules/pixi.js/lib/scene/container/Container.d.ts
generated
vendored
Normal file
@@ -0,0 +1,650 @@
|
||||
import EventEmitter from 'eventemitter3';
|
||||
import { type ColorSource } from '../../color/Color';
|
||||
import { Matrix } from '../../maths/matrix/Matrix';
|
||||
import { ObservablePoint } from '../../maths/point/ObservablePoint';
|
||||
import { RenderGroup } from './RenderGroup';
|
||||
import type { Size } from '../../maths/misc/Size';
|
||||
import type { PointData } from '../../maths/point/PointData';
|
||||
import type { Rectangle } from '../../maths/shapes/Rectangle';
|
||||
import type { BLEND_MODES } from '../../rendering/renderers/shared/state/const';
|
||||
import type { Dict } from '../../utils/types';
|
||||
import type { Optional } from './container-mixins/measureMixin';
|
||||
import type { DestroyOptions } from './destroyTypes';
|
||||
export type ContainerChild = Container;
|
||||
export interface ContainerEvents<C extends ContainerChild> extends PixiMixins.ContainerEvents {
|
||||
added: [container: Container];
|
||||
childAdded: [child: C, container: Container, index: number];
|
||||
removed: [container: Container];
|
||||
childRemoved: [child: C, container: Container, index: number];
|
||||
destroyed: [container: Container];
|
||||
}
|
||||
type AnyEvent = {
|
||||
[K: ({} & string) | ({} & symbol)]: any;
|
||||
};
|
||||
export declare const UPDATE_COLOR = 1;
|
||||
export declare const UPDATE_BLEND = 2;
|
||||
export declare const UPDATE_VISIBLE = 4;
|
||||
export declare const UPDATE_TRANSFORM = 8;
|
||||
export interface UpdateTransformOptions {
|
||||
x: number;
|
||||
y: number;
|
||||
scaleX: number;
|
||||
scaleY: number;
|
||||
rotation: number;
|
||||
skewX: number;
|
||||
skewY: number;
|
||||
pivotX: number;
|
||||
pivotY: number;
|
||||
}
|
||||
/**
|
||||
* Constructor options used for `Container` instances.
|
||||
* ```js
|
||||
* const container = new Container({
|
||||
* position: new Point(100, 200),
|
||||
* scale: new Point(2, 2),
|
||||
* rotation: Math.PI / 2,
|
||||
* });
|
||||
* ```
|
||||
* @memberof scene
|
||||
* @see scene.Container
|
||||
*/
|
||||
export interface ContainerOptions<C extends ContainerChild = ContainerChild> extends PixiMixins.ContainerOptions {
|
||||
/** @see scene.Container#isRenderGroup */
|
||||
isRenderGroup?: boolean;
|
||||
/** @see scene.Container#blendMode */
|
||||
blendMode?: BLEND_MODES;
|
||||
/** @see scene.Container#tint */
|
||||
tint?: ColorSource;
|
||||
/** @see scene.Container#alpha */
|
||||
alpha?: number;
|
||||
/** @see scene.Container#angle */
|
||||
angle?: number;
|
||||
/** @see scene.Container#children */
|
||||
children?: C[];
|
||||
/** @see scene.Container#parent */
|
||||
parent?: Container;
|
||||
/** @see scene.Container#renderable */
|
||||
renderable?: boolean;
|
||||
/** @see scene.Container#rotation */
|
||||
rotation?: number;
|
||||
/** @see scene.Container#scale */
|
||||
scale?: PointData | number;
|
||||
/** @see scene.Container#pivot */
|
||||
pivot?: PointData | number;
|
||||
/** @see scene.Container#position */
|
||||
position?: PointData;
|
||||
/** @see scene.Container#skew */
|
||||
skew?: PointData;
|
||||
/** @see scene.Container#visible */
|
||||
visible?: boolean;
|
||||
/** @see scene.Container#x */
|
||||
x?: number;
|
||||
/** @see scene.Container#y */
|
||||
y?: number;
|
||||
/** @see scene.Container#boundArea */
|
||||
boundsArea?: Rectangle;
|
||||
}
|
||||
export interface Container<C extends ContainerChild> extends PixiMixins.Container<C>, EventEmitter<ContainerEvents<C> & AnyEvent> {
|
||||
}
|
||||
/**
|
||||
* Container is a general-purpose display object that holds children. It also adds built-in support for advanced
|
||||
* rendering features like masking and filtering.
|
||||
*
|
||||
* It is the base class of all display objects that act as a container for other objects, including Graphics
|
||||
* and Sprite.
|
||||
*
|
||||
* <details id="transforms">
|
||||
*
|
||||
* <summary>Transforms</summary>
|
||||
*
|
||||
* The [transform]{@link scene.Container#transform} of a display object describes the projection from its
|
||||
* local coordinate space to its parent's local coordinate space. The following properties are derived
|
||||
* from the transform:
|
||||
*
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Property</th>
|
||||
* <th>Description</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr>
|
||||
* <td>[pivot]{@link scene.Container#pivot}</td>
|
||||
* <td>
|
||||
* Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot
|
||||
* is equal to position, regardless of the other three transformations. In other words, It is the center of
|
||||
* rotation, scaling, and skewing.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[position]{@link scene.Container#position}</td>
|
||||
* <td>
|
||||
* Translation. This is the position of the [pivot]{@link scene.Container#pivot} in the parent's local
|
||||
* space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object
|
||||
* is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[scale]{@link scene.Container#scale}</td>
|
||||
* <td>
|
||||
* Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the
|
||||
* local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center
|
||||
* of scaling is the [pivot]{@link scene.Container#pivot}.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[rotation]{@link scene.Container#rotation}</td>
|
||||
* <td>
|
||||
* Rotation. This will rotate the display object's projection by this angle (in radians).
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[skew]{@link scene.Container#skew}</td>
|
||||
* <td>
|
||||
* <p>Skewing. This can be used to deform a rectangular display object into a parallelogram.</p>
|
||||
* <p>
|
||||
* In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be
|
||||
* thought of the net rotation applied to the coordinate axes (separately). For example, if "skew.x" is
|
||||
* ⍺ and "skew.y" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be
|
||||
* rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will
|
||||
* be rotated by an angle between ⍺ and β.
|
||||
* </p>
|
||||
* <p>
|
||||
* It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying
|
||||
* a rotation. Indeed, if "skew.x" = -ϴ and "skew.y" = ϴ, it will produce an equivalent of "rotation" = ϴ.
|
||||
* </p>
|
||||
* <p>
|
||||
* Another quite interesting observation is that "skew.x", "skew.y", rotation are commutative operations. Indeed,
|
||||
* because rotation is essentially a careful combination of the two.
|
||||
* </p>
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[angle]{@link scene.Container#angle}</td>
|
||||
* <td>Rotation. This is an alias for [rotation]{@link scene.Container#rotation}, but in degrees.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[x]{@link scene.Container#x}</td>
|
||||
* <td>Translation. This is an alias for position.x!</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[y]{@link scene.Container#y}</td>
|
||||
* <td>Translation. This is an alias for position.y!</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[width]{@link scene.Container#width}</td>
|
||||
* <td>
|
||||
* Implemented in [Container]{@link scene.Container}. Scaling. The width property calculates scale.x by dividing
|
||||
* the "requested" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there
|
||||
* is no concept of user-defined width.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>[height]{@link scene.Container#height}</td>
|
||||
* <td>
|
||||
* Implemented in [Container]{@link scene.Container}. Scaling. The height property calculates scale.y by dividing
|
||||
* the "requested" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there
|
||||
* is no concept of user-defined height.
|
||||
* </td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </details>
|
||||
*
|
||||
* <details id="alpha">
|
||||
* <summary>Alpha</summary>
|
||||
*
|
||||
* This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display
|
||||
* object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not
|
||||
* applied on any ancestor further up the chain).
|
||||
* </details>
|
||||
*
|
||||
* <details id="visible">
|
||||
* <summary>Renderable vs Visible</summary>
|
||||
*
|
||||
* The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the
|
||||
* screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display
|
||||
* object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not
|
||||
* be calculated.
|
||||
* ```ts
|
||||
* import { BlurFilter, Container, Graphics, Sprite } from 'pixi.js';
|
||||
*
|
||||
* const container = new Container();
|
||||
* const sprite = Sprite.from('https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png');
|
||||
*
|
||||
* sprite.width = 512;
|
||||
* sprite.height = 512;
|
||||
*
|
||||
* // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container
|
||||
* // is rendered.
|
||||
* container.addChild(sprite);
|
||||
*
|
||||
* // Blurs whatever is rendered by the container
|
||||
* container.filters = [new BlurFilter()];
|
||||
*
|
||||
* // Only the contents within a circle at the center should be rendered onto the screen.
|
||||
* container.mask = new Graphics()
|
||||
* .beginFill(0xffffff)
|
||||
* .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)
|
||||
* .endFill();
|
||||
* ```
|
||||
*
|
||||
* </details>
|
||||
*
|
||||
* <details id="renderGroup">
|
||||
* <summary>RenderGroup</summary>
|
||||
*
|
||||
* In PixiJS v8, containers can be set to operate in 'render group mode',
|
||||
* transforming them into entities akin to a stage in traditional rendering paradigms.
|
||||
* A render group is a root renderable entity, similar to a container,
|
||||
* but it's rendered in a separate pass with its own unique set of rendering instructions.
|
||||
* This approach enhances rendering efficiency and organization, particularly in complex scenes.
|
||||
*
|
||||
* You can enable render group mode on any container using container.enableRenderGroup()
|
||||
* or by initializing a new container with the render group property set to true (new Container({isRenderGroup: true})).
|
||||
* The method you choose depends on your specific use case and setup requirements.
|
||||
*
|
||||
* An important aspect of PixiJS’s rendering process is the automatic treatment of rendered scenes as render groups.
|
||||
* This conversion streamlines the rendering process, but understanding when and how this happens is crucial
|
||||
* to fully leverage its benefits.
|
||||
*
|
||||
* One of the key advantages of using render groups is the performance efficiency in moving them. Since transformations
|
||||
* are applied at the GPU level, moving a render group, even one with complex and numerous children,
|
||||
* doesn't require recalculating the rendering instructions or performing transformations on each child.
|
||||
* This makes operations like panning a large game world incredibly efficient.
|
||||
*
|
||||
* However, it's crucial to note that render groups do not batch together.
|
||||
* This means that turning every container into a render group could actually slow things down,
|
||||
* as each render group is processed separately. It's best to use render groups judiciously, at a broader level,
|
||||
* rather than on a per-child basis.
|
||||
* This approach ensures you get the performance benefits without overburdening the rendering process.
|
||||
*
|
||||
* RenderGroups maintain their own set of rendering instructions,
|
||||
* ensuring that changes or updates within a render group don't affect the rendering
|
||||
* instructions of its parent or other render groups.
|
||||
* This isolation ensures more stable and predictable rendering behavior.
|
||||
*
|
||||
* Additionally, renderGroups can be nested, allowing for powerful options in organizing different aspects of your scene.
|
||||
* This feature is particularly beneficial for separating complex game graphics from UI elements,
|
||||
* enabling intricate and efficient scene management in complex applications.
|
||||
*
|
||||
* This means that Containers have 3 levels of matrix to be mindful of:
|
||||
*
|
||||
* 1. localTransform, this is the transform of the container based on its own properties
|
||||
* 2. groupTransform, this it the transform of the container relative to the renderGroup it belongs too
|
||||
* 3. worldTransform, this is the transform of the container relative to the Scene being rendered
|
||||
* </details>
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class Container<C extends ContainerChild = ContainerChild> extends EventEmitter<ContainerEvents<C> & AnyEvent> {
|
||||
/**
|
||||
* Mixes all enumerable properties and methods from a source object to Container.
|
||||
* @param source - The source of properties and methods to mix in.
|
||||
*/
|
||||
static mixin(source: Dict<any>): void;
|
||||
/** unique id for this container */
|
||||
readonly uid: number;
|
||||
/** @private */
|
||||
_updateFlags: number;
|
||||
/** @private */
|
||||
renderGroup: RenderGroup;
|
||||
/** @private */
|
||||
parentRenderGroup: RenderGroup;
|
||||
/** @private */
|
||||
parentRenderGroupIndex: number;
|
||||
/** @private */
|
||||
didChange: boolean;
|
||||
/** @private */
|
||||
didViewUpdate: boolean;
|
||||
/** @private */
|
||||
relativeRenderGroupDepth: number;
|
||||
/**
|
||||
* The array of children of this container.
|
||||
* @readonly
|
||||
*/
|
||||
children: C[];
|
||||
/** The display object container that contains this display object. */
|
||||
parent: Container;
|
||||
/** @private */
|
||||
includeInBuild: boolean;
|
||||
/** @private */
|
||||
measurable: boolean;
|
||||
/** @private */
|
||||
isSimple: boolean;
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
updateTick: number;
|
||||
/**
|
||||
* Current transform of the object based on local factors: position, scale, other stuff.
|
||||
* @readonly
|
||||
*/
|
||||
localTransform: Matrix;
|
||||
/**
|
||||
* The relative group transform is a transform relative to the render group it belongs too. It will include all parent
|
||||
* transforms and up to the render group (think of it as kind of like a stage - but the stage can be nested).
|
||||
* If this container is is self a render group matrix will be relative to its parent render group
|
||||
* @readonly
|
||||
*/
|
||||
relativeGroupTransform: Matrix;
|
||||
/**
|
||||
* The group transform is a transform relative to the render group it belongs too.
|
||||
* If this container is render group then this will be an identity matrix. other wise it
|
||||
* will be the same as the relativeGroupTransform.
|
||||
* Use this value when actually rendering things to the screen
|
||||
* @readonly
|
||||
*/
|
||||
groupTransform: Matrix;
|
||||
private _worldTransform;
|
||||
/** If the object has been destroyed via destroy(). If true, it should not be used. */
|
||||
destroyed: boolean;
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_position: ObservablePoint;
|
||||
/**
|
||||
* The scale factor of the object.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_scale: ObservablePoint;
|
||||
/**
|
||||
* The pivot point of the container that it rotates around.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_pivot: ObservablePoint;
|
||||
/**
|
||||
* The skew amount, on the x and y axis.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_skew: ObservablePoint;
|
||||
/**
|
||||
* The X-coordinate value of the normalized local X axis,
|
||||
* the first column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_cx: number;
|
||||
/**
|
||||
* The Y-coordinate value of the normalized local X axis,
|
||||
* the first column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_sx: number;
|
||||
/**
|
||||
* The X-coordinate value of the normalized local Y axis,
|
||||
* the second column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_cy: number;
|
||||
/**
|
||||
* The Y-coordinate value of the normalized local Y axis,
|
||||
* the second column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
_sy: number;
|
||||
/**
|
||||
* The rotation amount.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
private _rotation;
|
||||
localColor: number;
|
||||
localAlpha: number;
|
||||
groupAlpha: number;
|
||||
groupColor: number;
|
||||
groupColorAlpha: number;
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
localBlendMode: BLEND_MODES;
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
groupBlendMode: BLEND_MODES;
|
||||
/**
|
||||
* This property holds three bits: culled, visible, renderable
|
||||
* the third bit represents culling (0 = culled, 1 = not culled) 0b100
|
||||
* the second bit represents visibility (0 = not visible, 1 = visible) 0b010
|
||||
* the first bit represents renderable (0 = not renderable, 1 = renderable) 0b001
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
localDisplayStatus: number;
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
globalDisplayStatus: number;
|
||||
readonly renderPipeId: string;
|
||||
/**
|
||||
* An optional bounds area for this container. Setting this rectangle will stop the renderer
|
||||
* from recursively measuring the bounds of each children and instead use this single boundArea.
|
||||
* This is great for optimisation! If for example you have a 1000 spinning particles and you know they all sit
|
||||
* within a specific bounds, then setting it will mean the renderer will not need to measure the
|
||||
* 1000 children to find the bounds. Instead it will just use the bounds you set.
|
||||
*/
|
||||
boundsArea: Rectangle;
|
||||
/**
|
||||
* A value that increments each time the containe is modified
|
||||
* eg children added, removed etc
|
||||
* @ignore
|
||||
*/
|
||||
_didContainerChangeTick: number;
|
||||
/**
|
||||
* A value that increments each time the container view is modified
|
||||
* eg texture swap, geometry change etc
|
||||
* @ignore
|
||||
*/
|
||||
_didViewChangeTick: number;
|
||||
/**
|
||||
* We now use the _didContainerChangeTick and _didViewChangeTick to track changes
|
||||
* @deprecated since 8.2.6
|
||||
* @ignore
|
||||
*/
|
||||
set _didChangeId(value: number);
|
||||
get _didChangeId(): number;
|
||||
/**
|
||||
* property that tracks if the container transform has changed
|
||||
* @ignore
|
||||
*/
|
||||
private _didLocalTransformChangeId;
|
||||
constructor(options?: ContainerOptions<C>);
|
||||
/**
|
||||
* Adds one or more children to the container.
|
||||
*
|
||||
* Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
|
||||
* @param {...Container} children - The Container(s) to add to the container
|
||||
* @returns {Container} - The first child that was added.
|
||||
*/
|
||||
addChild<U extends C[]>(...children: U): U[0];
|
||||
/**
|
||||
* Removes one or more children from the container.
|
||||
* @param {...Container} children - The Container(s) to remove
|
||||
* @returns {Container} The first child that was removed.
|
||||
*/
|
||||
removeChild<U extends C[]>(...children: U): U[0];
|
||||
/** @ignore */
|
||||
_onUpdate(point?: ObservablePoint): void;
|
||||
set isRenderGroup(value: boolean);
|
||||
/**
|
||||
* Returns true if this container is a render group.
|
||||
* This means that it will be rendered as a separate pass, with its own set of instructions
|
||||
*/
|
||||
get isRenderGroup(): boolean;
|
||||
/**
|
||||
* Calling this enables a render group for this container.
|
||||
* This means it will be rendered as a separate set of instructions.
|
||||
* The transform of the container will also be handled on the GPU rather than the CPU.
|
||||
*/
|
||||
enableRenderGroup(): void;
|
||||
/** This will disable the render group for this container. */
|
||||
disableRenderGroup(): void;
|
||||
/** @ignore */
|
||||
_updateIsSimple(): void;
|
||||
/**
|
||||
* Current transform of the object based on world (parent) factors.
|
||||
* @readonly
|
||||
*/
|
||||
get worldTransform(): Matrix;
|
||||
/**
|
||||
* The position of the container on the x axis relative to the local coordinates of the parent.
|
||||
* An alias to position.x
|
||||
*/
|
||||
get x(): number;
|
||||
set x(value: number);
|
||||
/**
|
||||
* The position of the container on the y axis relative to the local coordinates of the parent.
|
||||
* An alias to position.y
|
||||
*/
|
||||
get y(): number;
|
||||
set y(value: number);
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get position(): ObservablePoint;
|
||||
set position(value: PointData);
|
||||
/**
|
||||
* The rotation of the object in radians.
|
||||
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
|
||||
*/
|
||||
get rotation(): number;
|
||||
set rotation(value: number);
|
||||
/**
|
||||
* The angle of the object in degrees.
|
||||
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
|
||||
*/
|
||||
get angle(): number;
|
||||
set angle(value: number);
|
||||
/**
|
||||
* The center of rotation, scaling, and skewing for this display object in its local space. The `position`
|
||||
* is the projection of `pivot` in the parent's local space.
|
||||
*
|
||||
* By default, the pivot is the origin (0, 0).
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get pivot(): ObservablePoint;
|
||||
set pivot(value: PointData | number);
|
||||
/**
|
||||
* The skew factor for the object in radians.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get skew(): ObservablePoint;
|
||||
set skew(value: PointData);
|
||||
/**
|
||||
* The scale factors of this object along the local coordinate axes.
|
||||
*
|
||||
* The default scale is (1, 1).
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get scale(): ObservablePoint;
|
||||
set scale(value: PointData | number);
|
||||
/**
|
||||
* The width of the Container, setting this will actually modify the scale to achieve the value set.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get width(): number;
|
||||
set width(value: number);
|
||||
/**
|
||||
* The height of the Container, setting this will actually modify the scale to achieve the value set.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get height(): number;
|
||||
set height(value: number);
|
||||
/**
|
||||
* Retrieves the size of the container as a [Size]{@link Size} object.
|
||||
* This is faster than get the width and height separately.
|
||||
* @param out - Optional object to store the size in.
|
||||
* @returns - The size of the container.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getSize(out?: Size): Size;
|
||||
/**
|
||||
* Sets the size of the container to the specified width and height.
|
||||
* This is faster than setting the width and height separately.
|
||||
* @param value - This can be either a number or a [Size]{@link Size} object.
|
||||
* @param height - The height to set. Defaults to the value of `width` if not provided.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
setSize(value: number | Optional<Size, 'height'>, height?: number): void;
|
||||
/** Called when the skew or the rotation changes. */
|
||||
private _updateSkew;
|
||||
/**
|
||||
* Updates the transform properties of the container (accepts partial values).
|
||||
* @param {object} opts - The options for updating the transform.
|
||||
* @param {number} opts.x - The x position of the container.
|
||||
* @param {number} opts.y - The y position of the container.
|
||||
* @param {number} opts.scaleX - The scale factor on the x-axis.
|
||||
* @param {number} opts.scaleY - The scale factor on the y-axis.
|
||||
* @param {number} opts.rotation - The rotation of the container, in radians.
|
||||
* @param {number} opts.skewX - The skew factor on the x-axis.
|
||||
* @param {number} opts.skewY - The skew factor on the y-axis.
|
||||
* @param {number} opts.pivotX - The x coordinate of the pivot point.
|
||||
* @param {number} opts.pivotY - The y coordinate of the pivot point.
|
||||
*/
|
||||
updateTransform(opts: Partial<UpdateTransformOptions>): this;
|
||||
/**
|
||||
* Updates the local transform using the given matrix.
|
||||
* @param matrix - The matrix to use for updating the transform.
|
||||
*/
|
||||
setFromMatrix(matrix: Matrix): void;
|
||||
/** Updates the local transform. */
|
||||
updateLocalTransform(): void;
|
||||
set alpha(value: number);
|
||||
/** The opacity of the object. */
|
||||
get alpha(): number;
|
||||
set tint(value: ColorSource);
|
||||
/**
|
||||
* The tint applied to the sprite. This is a hex value.
|
||||
*
|
||||
* A value of 0xFFFFFF will remove any tint effect.
|
||||
* @default 0xFFFFFF
|
||||
*/
|
||||
get tint(): number;
|
||||
set blendMode(value: BLEND_MODES);
|
||||
/**
|
||||
* The blend mode to be applied to the sprite. Apply a value of `'normal'` to reset the blend mode.
|
||||
* @default 'normal'
|
||||
*/
|
||||
get blendMode(): BLEND_MODES;
|
||||
/** The visibility of the object. If false the object will not be drawn, and the transform will not be updated. */
|
||||
get visible(): boolean;
|
||||
set visible(value: boolean);
|
||||
/** @ignore */
|
||||
get culled(): boolean;
|
||||
/** @ignore */
|
||||
set culled(value: boolean);
|
||||
/** Can this object be rendered, if false the object will not be drawn but the transform will still be updated. */
|
||||
get renderable(): boolean;
|
||||
set renderable(value: boolean);
|
||||
/** Whether or not the object should be rendered. */
|
||||
get isRenderable(): boolean;
|
||||
/**
|
||||
* Removes all internal references and listeners as well as removes children from the display list.
|
||||
* Do not use a Container after calling `destroy`.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
|
||||
* method called as well. 'options' will be passed on to those calls.
|
||||
* @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites. If options.children
|
||||
* is set to true it should destroy the texture of the child sprite
|
||||
* @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true it should destroy the texture source of the child sprite
|
||||
* @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.
|
||||
* If options.children is set to true it should destroy the context of the child graphics
|
||||
*/
|
||||
destroy(options?: DestroyOptions): void;
|
||||
}
|
||||
export {};
|
785
node_modules/pixi.js/lib/scene/container/Container.js
generated
vendored
Normal file
785
node_modules/pixi.js/lib/scene/container/Container.js
generated
vendored
Normal file
@@ -0,0 +1,785 @@
|
||||
'use strict';
|
||||
|
||||
var EventEmitter = require('eventemitter3');
|
||||
var Color = require('../../color/Color.js');
|
||||
var cullingMixin = require('../../culling/cullingMixin.js');
|
||||
var Matrix = require('../../maths/matrix/Matrix.js');
|
||||
var _const = require('../../maths/misc/const.js');
|
||||
var ObservablePoint = require('../../maths/point/ObservablePoint.js');
|
||||
var uid = require('../../utils/data/uid.js');
|
||||
var deprecation = require('../../utils/logging/deprecation.js');
|
||||
var PoolGroup = require('../../utils/pool/PoolGroup.js');
|
||||
var childrenHelperMixin = require('./container-mixins/childrenHelperMixin.js');
|
||||
var effectsMixin = require('./container-mixins/effectsMixin.js');
|
||||
var findMixin = require('./container-mixins/findMixin.js');
|
||||
var measureMixin = require('./container-mixins/measureMixin.js');
|
||||
var onRenderMixin = require('./container-mixins/onRenderMixin.js');
|
||||
var sortMixin = require('./container-mixins/sortMixin.js');
|
||||
var toLocalGlobalMixin = require('./container-mixins/toLocalGlobalMixin.js');
|
||||
var RenderGroup = require('./RenderGroup.js');
|
||||
var assignWithIgnore = require('./utils/assignWithIgnore.js');
|
||||
|
||||
"use strict";
|
||||
const defaultSkew = new ObservablePoint.ObservablePoint(null);
|
||||
const defaultPivot = new ObservablePoint.ObservablePoint(null);
|
||||
const defaultScale = new ObservablePoint.ObservablePoint(null, 1, 1);
|
||||
const UPDATE_COLOR = 1;
|
||||
const UPDATE_BLEND = 2;
|
||||
const UPDATE_VISIBLE = 4;
|
||||
const UPDATE_TRANSFORM = 8;
|
||||
class Container extends EventEmitter {
|
||||
constructor(options = {}) {
|
||||
super();
|
||||
/** unique id for this container */
|
||||
this.uid = uid.uid("renderable");
|
||||
/** @private */
|
||||
this._updateFlags = 15;
|
||||
// the render group this container owns
|
||||
/** @private */
|
||||
this.renderGroup = null;
|
||||
// the render group this container belongs to
|
||||
/** @private */
|
||||
this.parentRenderGroup = null;
|
||||
// the index of the container in the render group
|
||||
/** @private */
|
||||
this.parentRenderGroupIndex = 0;
|
||||
// set to true if the container has changed. It is reset once the changes have been applied
|
||||
// by the transform system
|
||||
// its here to stop ensure that when things change, only one update gets registers with the transform system
|
||||
/** @private */
|
||||
this.didChange = false;
|
||||
// same as above, but for the renderable
|
||||
/** @private */
|
||||
this.didViewUpdate = false;
|
||||
// how deep is the container relative to its render group..
|
||||
// unless the element is the root render group - it will be relative to its parent
|
||||
/** @private */
|
||||
this.relativeRenderGroupDepth = 0;
|
||||
/**
|
||||
* The array of children of this container.
|
||||
* @readonly
|
||||
*/
|
||||
this.children = [];
|
||||
/** The display object container that contains this display object. */
|
||||
this.parent = null;
|
||||
// used internally for changing up the render order.. mainly for masks and filters
|
||||
// TODO setting this should cause a rebuild??
|
||||
/** @private */
|
||||
this.includeInBuild = true;
|
||||
/** @private */
|
||||
this.measurable = true;
|
||||
/** @private */
|
||||
this.isSimple = true;
|
||||
// / /////////////Transform related props//////////////
|
||||
// used by the transform system to check if a container needs to be updated that frame
|
||||
// if the tick matches the current transform system tick, it is not updated again
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.updateTick = -1;
|
||||
/**
|
||||
* Current transform of the object based on local factors: position, scale, other stuff.
|
||||
* @readonly
|
||||
*/
|
||||
this.localTransform = new Matrix.Matrix();
|
||||
/**
|
||||
* The relative group transform is a transform relative to the render group it belongs too. It will include all parent
|
||||
* transforms and up to the render group (think of it as kind of like a stage - but the stage can be nested).
|
||||
* If this container is is self a render group matrix will be relative to its parent render group
|
||||
* @readonly
|
||||
*/
|
||||
this.relativeGroupTransform = new Matrix.Matrix();
|
||||
/**
|
||||
* The group transform is a transform relative to the render group it belongs too.
|
||||
* If this container is render group then this will be an identity matrix. other wise it
|
||||
* will be the same as the relativeGroupTransform.
|
||||
* Use this value when actually rendering things to the screen
|
||||
* @readonly
|
||||
*/
|
||||
this.groupTransform = this.relativeGroupTransform;
|
||||
/** If the object has been destroyed via destroy(). If true, it should not be used. */
|
||||
this.destroyed = false;
|
||||
// transform data..
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._position = new ObservablePoint.ObservablePoint(this, 0, 0);
|
||||
/**
|
||||
* The scale factor of the object.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._scale = defaultScale;
|
||||
/**
|
||||
* The pivot point of the container that it rotates around.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._pivot = defaultPivot;
|
||||
/**
|
||||
* The skew amount, on the x and y axis.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._skew = defaultSkew;
|
||||
/**
|
||||
* The X-coordinate value of the normalized local X axis,
|
||||
* the first column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._cx = 1;
|
||||
/**
|
||||
* The Y-coordinate value of the normalized local X axis,
|
||||
* the first column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._sx = 0;
|
||||
/**
|
||||
* The X-coordinate value of the normalized local Y axis,
|
||||
* the second column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._cy = 0;
|
||||
/**
|
||||
* The Y-coordinate value of the normalized local Y axis,
|
||||
* the second column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._sy = 1;
|
||||
/**
|
||||
* The rotation amount.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._rotation = 0;
|
||||
// / COLOR related props //////////////
|
||||
// color stored as ABGR
|
||||
this.localColor = 16777215;
|
||||
this.localAlpha = 1;
|
||||
this.groupAlpha = 1;
|
||||
// A
|
||||
this.groupColor = 16777215;
|
||||
// BGR
|
||||
this.groupColorAlpha = 4294967295;
|
||||
// ABGR
|
||||
// / BLEND related props //////////////
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.localBlendMode = "inherit";
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.groupBlendMode = "normal";
|
||||
// / VISIBILITY related props //////////////
|
||||
// visibility
|
||||
// 0b11
|
||||
// first bit is visible, second bit is renderable
|
||||
/**
|
||||
* This property holds three bits: culled, visible, renderable
|
||||
* the third bit represents culling (0 = culled, 1 = not culled) 0b100
|
||||
* the second bit represents visibility (0 = not visible, 1 = visible) 0b010
|
||||
* the first bit represents renderable (0 = not renderable, 1 = renderable) 0b001
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.localDisplayStatus = 7;
|
||||
// 0b11 | 0b10 | 0b01 | 0b00
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.globalDisplayStatus = 7;
|
||||
/**
|
||||
* A value that increments each time the containe is modified
|
||||
* eg children added, removed etc
|
||||
* @ignore
|
||||
*/
|
||||
this._didContainerChangeTick = 0;
|
||||
/**
|
||||
* A value that increments each time the container view is modified
|
||||
* eg texture swap, geometry change etc
|
||||
* @ignore
|
||||
*/
|
||||
this._didViewChangeTick = 0;
|
||||
/**
|
||||
* property that tracks if the container transform has changed
|
||||
* @ignore
|
||||
*/
|
||||
this._didLocalTransformChangeId = -1;
|
||||
this.effects = [];
|
||||
assignWithIgnore.assignWithIgnore(this, options, {
|
||||
children: true,
|
||||
parent: true,
|
||||
effects: true
|
||||
});
|
||||
options.children?.forEach((child) => this.addChild(child));
|
||||
options.parent?.addChild(this);
|
||||
}
|
||||
/**
|
||||
* Mixes all enumerable properties and methods from a source object to Container.
|
||||
* @param source - The source of properties and methods to mix in.
|
||||
*/
|
||||
static mixin(source) {
|
||||
Object.defineProperties(Container.prototype, Object.getOwnPropertyDescriptors(source));
|
||||
}
|
||||
/**
|
||||
* We now use the _didContainerChangeTick and _didViewChangeTick to track changes
|
||||
* @deprecated since 8.2.6
|
||||
* @ignore
|
||||
*/
|
||||
set _didChangeId(value) {
|
||||
this._didViewChangeTick = value >> 12 & 4095;
|
||||
this._didContainerChangeTick = value & 4095;
|
||||
}
|
||||
get _didChangeId() {
|
||||
return this._didContainerChangeTick & 4095 | (this._didViewChangeTick & 4095) << 12;
|
||||
}
|
||||
/**
|
||||
* Adds one or more children to the container.
|
||||
*
|
||||
* Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
|
||||
* @param {...Container} children - The Container(s) to add to the container
|
||||
* @returns {Container} - The first child that was added.
|
||||
*/
|
||||
addChild(...children) {
|
||||
if (!this.allowChildren) {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "addChild: Only Containers will be allowed to add children in v8.0.0");
|
||||
}
|
||||
if (children.length > 1) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.addChild(children[i]);
|
||||
}
|
||||
return children[0];
|
||||
}
|
||||
const child = children[0];
|
||||
if (child.parent === this) {
|
||||
this.children.splice(this.children.indexOf(child), 1);
|
||||
this.children.push(child);
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
return child;
|
||||
}
|
||||
if (child.parent) {
|
||||
child.parent.removeChild(child);
|
||||
}
|
||||
this.children.push(child);
|
||||
if (this.sortableChildren)
|
||||
this.sortDirty = true;
|
||||
child.parent = this;
|
||||
child.didChange = true;
|
||||
child.didViewUpdate = false;
|
||||
child._updateFlags = 15;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.addChild(child);
|
||||
}
|
||||
this.emit("childAdded", child, this, this.children.length - 1);
|
||||
child.emit("added", this);
|
||||
this._didViewChangeTick++;
|
||||
if (child._zIndex !== 0) {
|
||||
child.depthOfChildModified();
|
||||
}
|
||||
return child;
|
||||
}
|
||||
/**
|
||||
* Removes one or more children from the container.
|
||||
* @param {...Container} children - The Container(s) to remove
|
||||
* @returns {Container} The first child that was removed.
|
||||
*/
|
||||
removeChild(...children) {
|
||||
if (children.length > 1) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.removeChild(children[i]);
|
||||
}
|
||||
return children[0];
|
||||
}
|
||||
const child = children[0];
|
||||
const index = this.children.indexOf(child);
|
||||
if (index > -1) {
|
||||
this._didViewChangeTick++;
|
||||
this.children.splice(index, 1);
|
||||
if (this.renderGroup) {
|
||||
this.renderGroup.removeChild(child);
|
||||
} else if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.removeChild(child);
|
||||
}
|
||||
child.parent = null;
|
||||
this.emit("childRemoved", child, this, index);
|
||||
child.emit("removed", this);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
/** @ignore */
|
||||
_onUpdate(point) {
|
||||
if (point) {
|
||||
if (point === this._skew) {
|
||||
this._updateSkew();
|
||||
}
|
||||
}
|
||||
this._didContainerChangeTick++;
|
||||
if (this.didChange)
|
||||
return;
|
||||
this.didChange = true;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.onChildUpdate(this);
|
||||
}
|
||||
}
|
||||
set isRenderGroup(value) {
|
||||
if (!!this.renderGroup === value)
|
||||
return;
|
||||
if (value) {
|
||||
this.enableRenderGroup();
|
||||
} else {
|
||||
this.disableRenderGroup();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns true if this container is a render group.
|
||||
* This means that it will be rendered as a separate pass, with its own set of instructions
|
||||
*/
|
||||
get isRenderGroup() {
|
||||
return !!this.renderGroup;
|
||||
}
|
||||
/**
|
||||
* Calling this enables a render group for this container.
|
||||
* This means it will be rendered as a separate set of instructions.
|
||||
* The transform of the container will also be handled on the GPU rather than the CPU.
|
||||
*/
|
||||
enableRenderGroup() {
|
||||
if (this.renderGroup)
|
||||
return;
|
||||
const parentRenderGroup = this.parentRenderGroup;
|
||||
parentRenderGroup?.removeChild(this);
|
||||
this.renderGroup = PoolGroup.BigPool.get(RenderGroup.RenderGroup, this);
|
||||
this.groupTransform = Matrix.Matrix.IDENTITY;
|
||||
parentRenderGroup?.addChild(this);
|
||||
this._updateIsSimple();
|
||||
}
|
||||
/** This will disable the render group for this container. */
|
||||
disableRenderGroup() {
|
||||
if (!this.renderGroup)
|
||||
return;
|
||||
const parentRenderGroup = this.parentRenderGroup;
|
||||
parentRenderGroup?.removeChild(this);
|
||||
PoolGroup.BigPool.return(this.renderGroup);
|
||||
this.renderGroup = null;
|
||||
this.groupTransform = this.relativeGroupTransform;
|
||||
parentRenderGroup?.addChild(this);
|
||||
this._updateIsSimple();
|
||||
}
|
||||
/** @ignore */
|
||||
_updateIsSimple() {
|
||||
this.isSimple = !this.renderGroup && this.effects.length === 0;
|
||||
}
|
||||
/**
|
||||
* Current transform of the object based on world (parent) factors.
|
||||
* @readonly
|
||||
*/
|
||||
get worldTransform() {
|
||||
this._worldTransform || (this._worldTransform = new Matrix.Matrix());
|
||||
if (this.renderGroup) {
|
||||
this._worldTransform.copyFrom(this.renderGroup.worldTransform);
|
||||
} else if (this.parentRenderGroup) {
|
||||
this._worldTransform.appendFrom(this.relativeGroupTransform, this.parentRenderGroup.worldTransform);
|
||||
}
|
||||
return this._worldTransform;
|
||||
}
|
||||
// / ////// transform related stuff
|
||||
/**
|
||||
* The position of the container on the x axis relative to the local coordinates of the parent.
|
||||
* An alias to position.x
|
||||
*/
|
||||
get x() {
|
||||
return this._position.x;
|
||||
}
|
||||
set x(value) {
|
||||
this._position.x = value;
|
||||
}
|
||||
/**
|
||||
* The position of the container on the y axis relative to the local coordinates of the parent.
|
||||
* An alias to position.y
|
||||
*/
|
||||
get y() {
|
||||
return this._position.y;
|
||||
}
|
||||
set y(value) {
|
||||
this._position.y = value;
|
||||
}
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get position() {
|
||||
return this._position;
|
||||
}
|
||||
set position(value) {
|
||||
this._position.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The rotation of the object in radians.
|
||||
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
|
||||
*/
|
||||
get rotation() {
|
||||
return this._rotation;
|
||||
}
|
||||
set rotation(value) {
|
||||
if (this._rotation !== value) {
|
||||
this._rotation = value;
|
||||
this._onUpdate(this._skew);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The angle of the object in degrees.
|
||||
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
|
||||
*/
|
||||
get angle() {
|
||||
return this.rotation * _const.RAD_TO_DEG;
|
||||
}
|
||||
set angle(value) {
|
||||
this.rotation = value * _const.DEG_TO_RAD;
|
||||
}
|
||||
/**
|
||||
* The center of rotation, scaling, and skewing for this display object in its local space. The `position`
|
||||
* is the projection of `pivot` in the parent's local space.
|
||||
*
|
||||
* By default, the pivot is the origin (0, 0).
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get pivot() {
|
||||
if (this._pivot === defaultPivot) {
|
||||
this._pivot = new ObservablePoint.ObservablePoint(this, 0, 0);
|
||||
}
|
||||
return this._pivot;
|
||||
}
|
||||
set pivot(value) {
|
||||
if (this._pivot === defaultPivot) {
|
||||
this._pivot = new ObservablePoint.ObservablePoint(this, 0, 0);
|
||||
}
|
||||
typeof value === "number" ? this._pivot.set(value) : this._pivot.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The skew factor for the object in radians.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get skew() {
|
||||
if (this._skew === defaultSkew) {
|
||||
this._skew = new ObservablePoint.ObservablePoint(this, 0, 0);
|
||||
}
|
||||
return this._skew;
|
||||
}
|
||||
set skew(value) {
|
||||
if (this._skew === defaultSkew) {
|
||||
this._skew = new ObservablePoint.ObservablePoint(this, 0, 0);
|
||||
}
|
||||
this._skew.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The scale factors of this object along the local coordinate axes.
|
||||
*
|
||||
* The default scale is (1, 1).
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get scale() {
|
||||
if (this._scale === defaultScale) {
|
||||
this._scale = new ObservablePoint.ObservablePoint(this, 1, 1);
|
||||
}
|
||||
return this._scale;
|
||||
}
|
||||
set scale(value) {
|
||||
if (this._scale === defaultScale) {
|
||||
this._scale = new ObservablePoint.ObservablePoint(this, 0, 0);
|
||||
}
|
||||
typeof value === "number" ? this._scale.set(value) : this._scale.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The width of the Container, setting this will actually modify the scale to achieve the value set.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get width() {
|
||||
return Math.abs(this.scale.x * this.getLocalBounds().width);
|
||||
}
|
||||
set width(value) {
|
||||
const localWidth = this.getLocalBounds().width;
|
||||
this._setWidth(value, localWidth);
|
||||
}
|
||||
/**
|
||||
* The height of the Container, setting this will actually modify the scale to achieve the value set.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get height() {
|
||||
return Math.abs(this.scale.y * this.getLocalBounds().height);
|
||||
}
|
||||
set height(value) {
|
||||
const localHeight = this.getLocalBounds().height;
|
||||
this._setHeight(value, localHeight);
|
||||
}
|
||||
/**
|
||||
* Retrieves the size of the container as a [Size]{@link Size} object.
|
||||
* This is faster than get the width and height separately.
|
||||
* @param out - Optional object to store the size in.
|
||||
* @returns - The size of the container.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getSize(out) {
|
||||
if (!out) {
|
||||
out = {};
|
||||
}
|
||||
const bounds = this.getLocalBounds();
|
||||
out.width = Math.abs(this.scale.x * bounds.width);
|
||||
out.height = Math.abs(this.scale.y * bounds.height);
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Sets the size of the container to the specified width and height.
|
||||
* This is faster than setting the width and height separately.
|
||||
* @param value - This can be either a number or a [Size]{@link Size} object.
|
||||
* @param height - The height to set. Defaults to the value of `width` if not provided.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
setSize(value, height) {
|
||||
const size = this.getLocalBounds();
|
||||
if (typeof value === "object") {
|
||||
height = value.height ?? value.width;
|
||||
value = value.width;
|
||||
} else {
|
||||
height ?? (height = value);
|
||||
}
|
||||
value !== void 0 && this._setWidth(value, size.width);
|
||||
height !== void 0 && this._setHeight(height, size.height);
|
||||
}
|
||||
/** Called when the skew or the rotation changes. */
|
||||
_updateSkew() {
|
||||
const rotation = this._rotation;
|
||||
const skew = this._skew;
|
||||
this._cx = Math.cos(rotation + skew._y);
|
||||
this._sx = Math.sin(rotation + skew._y);
|
||||
this._cy = -Math.sin(rotation - skew._x);
|
||||
this._sy = Math.cos(rotation - skew._x);
|
||||
}
|
||||
/**
|
||||
* Updates the transform properties of the container (accepts partial values).
|
||||
* @param {object} opts - The options for updating the transform.
|
||||
* @param {number} opts.x - The x position of the container.
|
||||
* @param {number} opts.y - The y position of the container.
|
||||
* @param {number} opts.scaleX - The scale factor on the x-axis.
|
||||
* @param {number} opts.scaleY - The scale factor on the y-axis.
|
||||
* @param {number} opts.rotation - The rotation of the container, in radians.
|
||||
* @param {number} opts.skewX - The skew factor on the x-axis.
|
||||
* @param {number} opts.skewY - The skew factor on the y-axis.
|
||||
* @param {number} opts.pivotX - The x coordinate of the pivot point.
|
||||
* @param {number} opts.pivotY - The y coordinate of the pivot point.
|
||||
*/
|
||||
updateTransform(opts) {
|
||||
this.position.set(
|
||||
typeof opts.x === "number" ? opts.x : this.position.x,
|
||||
typeof opts.y === "number" ? opts.y : this.position.y
|
||||
);
|
||||
this.scale.set(
|
||||
typeof opts.scaleX === "number" ? opts.scaleX || 1 : this.scale.x,
|
||||
typeof opts.scaleY === "number" ? opts.scaleY || 1 : this.scale.y
|
||||
);
|
||||
this.rotation = typeof opts.rotation === "number" ? opts.rotation : this.rotation;
|
||||
this.skew.set(
|
||||
typeof opts.skewX === "number" ? opts.skewX : this.skew.x,
|
||||
typeof opts.skewY === "number" ? opts.skewY : this.skew.y
|
||||
);
|
||||
this.pivot.set(
|
||||
typeof opts.pivotX === "number" ? opts.pivotX : this.pivot.x,
|
||||
typeof opts.pivotY === "number" ? opts.pivotY : this.pivot.y
|
||||
);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Updates the local transform using the given matrix.
|
||||
* @param matrix - The matrix to use for updating the transform.
|
||||
*/
|
||||
setFromMatrix(matrix) {
|
||||
matrix.decompose(this);
|
||||
}
|
||||
/** Updates the local transform. */
|
||||
updateLocalTransform() {
|
||||
const localTransformChangeId = this._didContainerChangeTick;
|
||||
if (this._didLocalTransformChangeId === localTransformChangeId)
|
||||
return;
|
||||
this._didLocalTransformChangeId = localTransformChangeId;
|
||||
const lt = this.localTransform;
|
||||
const scale = this._scale;
|
||||
const pivot = this._pivot;
|
||||
const position = this._position;
|
||||
const sx = scale._x;
|
||||
const sy = scale._y;
|
||||
const px = pivot._x;
|
||||
const py = pivot._y;
|
||||
lt.a = this._cx * sx;
|
||||
lt.b = this._sx * sx;
|
||||
lt.c = this._cy * sy;
|
||||
lt.d = this._sy * sy;
|
||||
lt.tx = position._x - (px * lt.a + py * lt.c);
|
||||
lt.ty = position._y - (px * lt.b + py * lt.d);
|
||||
}
|
||||
// / ///// color related stuff
|
||||
set alpha(value) {
|
||||
if (value === this.localAlpha)
|
||||
return;
|
||||
this.localAlpha = value;
|
||||
this._updateFlags |= UPDATE_COLOR;
|
||||
this._onUpdate();
|
||||
}
|
||||
/** The opacity of the object. */
|
||||
get alpha() {
|
||||
return this.localAlpha;
|
||||
}
|
||||
set tint(value) {
|
||||
const tempColor = Color.Color.shared.setValue(value ?? 16777215);
|
||||
const bgr = tempColor.toBgrNumber();
|
||||
if (bgr === this.localColor)
|
||||
return;
|
||||
this.localColor = bgr;
|
||||
this._updateFlags |= UPDATE_COLOR;
|
||||
this._onUpdate();
|
||||
}
|
||||
/**
|
||||
* The tint applied to the sprite. This is a hex value.
|
||||
*
|
||||
* A value of 0xFFFFFF will remove any tint effect.
|
||||
* @default 0xFFFFFF
|
||||
*/
|
||||
get tint() {
|
||||
const bgr = this.localColor;
|
||||
return ((bgr & 255) << 16) + (bgr & 65280) + (bgr >> 16 & 255);
|
||||
}
|
||||
// / //////////////// blend related stuff
|
||||
set blendMode(value) {
|
||||
if (this.localBlendMode === value)
|
||||
return;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateFlags |= UPDATE_BLEND;
|
||||
this.localBlendMode = value;
|
||||
this._onUpdate();
|
||||
}
|
||||
/**
|
||||
* The blend mode to be applied to the sprite. Apply a value of `'normal'` to reset the blend mode.
|
||||
* @default 'normal'
|
||||
*/
|
||||
get blendMode() {
|
||||
return this.localBlendMode;
|
||||
}
|
||||
// / ///////// VISIBILITY / RENDERABLE /////////////////
|
||||
/** The visibility of the object. If false the object will not be drawn, and the transform will not be updated. */
|
||||
get visible() {
|
||||
return !!(this.localDisplayStatus & 2);
|
||||
}
|
||||
set visible(value) {
|
||||
const valueNumber = value ? 2 : 0;
|
||||
if ((this.localDisplayStatus & 2) === valueNumber)
|
||||
return;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateFlags |= UPDATE_VISIBLE;
|
||||
this.localDisplayStatus ^= 2;
|
||||
this._onUpdate();
|
||||
}
|
||||
/** @ignore */
|
||||
get culled() {
|
||||
return !(this.localDisplayStatus & 4);
|
||||
}
|
||||
/** @ignore */
|
||||
set culled(value) {
|
||||
const valueNumber = value ? 0 : 4;
|
||||
if ((this.localDisplayStatus & 4) === valueNumber)
|
||||
return;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateFlags |= UPDATE_VISIBLE;
|
||||
this.localDisplayStatus ^= 4;
|
||||
this._onUpdate();
|
||||
}
|
||||
/** Can this object be rendered, if false the object will not be drawn but the transform will still be updated. */
|
||||
get renderable() {
|
||||
return !!(this.localDisplayStatus & 1);
|
||||
}
|
||||
set renderable(value) {
|
||||
const valueNumber = value ? 1 : 0;
|
||||
if ((this.localDisplayStatus & 1) === valueNumber)
|
||||
return;
|
||||
this._updateFlags |= UPDATE_VISIBLE;
|
||||
this.localDisplayStatus ^= 1;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._onUpdate();
|
||||
}
|
||||
/** Whether or not the object should be rendered. */
|
||||
get isRenderable() {
|
||||
return this.localDisplayStatus === 7 && this.groupAlpha > 0;
|
||||
}
|
||||
/**
|
||||
* Removes all internal references and listeners as well as removes children from the display list.
|
||||
* Do not use a Container after calling `destroy`.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
|
||||
* method called as well. 'options' will be passed on to those calls.
|
||||
* @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites. If options.children
|
||||
* is set to true it should destroy the texture of the child sprite
|
||||
* @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true it should destroy the texture source of the child sprite
|
||||
* @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.
|
||||
* If options.children is set to true it should destroy the context of the child graphics
|
||||
*/
|
||||
destroy(options = false) {
|
||||
if (this.destroyed)
|
||||
return;
|
||||
this.destroyed = true;
|
||||
const oldChildren = this.removeChildren(0, this.children.length);
|
||||
this.removeFromParent();
|
||||
this.parent = null;
|
||||
this._maskEffect = null;
|
||||
this._filterEffect = null;
|
||||
this.effects = null;
|
||||
this._position = null;
|
||||
this._scale = null;
|
||||
this._pivot = null;
|
||||
this._skew = null;
|
||||
this.emit("destroyed", this);
|
||||
this.removeAllListeners();
|
||||
const destroyChildren = typeof options === "boolean" ? options : options?.children;
|
||||
if (destroyChildren) {
|
||||
for (let i = 0; i < oldChildren.length; ++i) {
|
||||
oldChildren[i].destroy(options);
|
||||
}
|
||||
}
|
||||
this.renderGroup?.destroy();
|
||||
this.renderGroup = null;
|
||||
}
|
||||
}
|
||||
Container.mixin(childrenHelperMixin.childrenHelperMixin);
|
||||
Container.mixin(toLocalGlobalMixin.toLocalGlobalMixin);
|
||||
Container.mixin(onRenderMixin.onRenderMixin);
|
||||
Container.mixin(measureMixin.measureMixin);
|
||||
Container.mixin(effectsMixin.effectsMixin);
|
||||
Container.mixin(findMixin.findMixin);
|
||||
Container.mixin(sortMixin.sortMixin);
|
||||
Container.mixin(cullingMixin.cullingMixin);
|
||||
|
||||
exports.Container = Container;
|
||||
exports.UPDATE_BLEND = UPDATE_BLEND;
|
||||
exports.UPDATE_COLOR = UPDATE_COLOR;
|
||||
exports.UPDATE_TRANSFORM = UPDATE_TRANSFORM;
|
||||
exports.UPDATE_VISIBLE = UPDATE_VISIBLE;
|
||||
//# sourceMappingURL=Container.js.map
|
1
node_modules/pixi.js/lib/scene/container/Container.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/Container.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
779
node_modules/pixi.js/lib/scene/container/Container.mjs
generated
vendored
Normal file
779
node_modules/pixi.js/lib/scene/container/Container.mjs
generated
vendored
Normal file
@@ -0,0 +1,779 @@
|
||||
import EventEmitter from 'eventemitter3';
|
||||
import { Color } from '../../color/Color.mjs';
|
||||
import { cullingMixin } from '../../culling/cullingMixin.mjs';
|
||||
import { Matrix } from '../../maths/matrix/Matrix.mjs';
|
||||
import { RAD_TO_DEG, DEG_TO_RAD } from '../../maths/misc/const.mjs';
|
||||
import { ObservablePoint } from '../../maths/point/ObservablePoint.mjs';
|
||||
import { uid } from '../../utils/data/uid.mjs';
|
||||
import { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';
|
||||
import { BigPool } from '../../utils/pool/PoolGroup.mjs';
|
||||
import { childrenHelperMixin } from './container-mixins/childrenHelperMixin.mjs';
|
||||
import { effectsMixin } from './container-mixins/effectsMixin.mjs';
|
||||
import { findMixin } from './container-mixins/findMixin.mjs';
|
||||
import { measureMixin } from './container-mixins/measureMixin.mjs';
|
||||
import { onRenderMixin } from './container-mixins/onRenderMixin.mjs';
|
||||
import { sortMixin } from './container-mixins/sortMixin.mjs';
|
||||
import { toLocalGlobalMixin } from './container-mixins/toLocalGlobalMixin.mjs';
|
||||
import { RenderGroup } from './RenderGroup.mjs';
|
||||
import { assignWithIgnore } from './utils/assignWithIgnore.mjs';
|
||||
|
||||
"use strict";
|
||||
const defaultSkew = new ObservablePoint(null);
|
||||
const defaultPivot = new ObservablePoint(null);
|
||||
const defaultScale = new ObservablePoint(null, 1, 1);
|
||||
const UPDATE_COLOR = 1;
|
||||
const UPDATE_BLEND = 2;
|
||||
const UPDATE_VISIBLE = 4;
|
||||
const UPDATE_TRANSFORM = 8;
|
||||
class Container extends EventEmitter {
|
||||
constructor(options = {}) {
|
||||
super();
|
||||
/** unique id for this container */
|
||||
this.uid = uid("renderable");
|
||||
/** @private */
|
||||
this._updateFlags = 15;
|
||||
// the render group this container owns
|
||||
/** @private */
|
||||
this.renderGroup = null;
|
||||
// the render group this container belongs to
|
||||
/** @private */
|
||||
this.parentRenderGroup = null;
|
||||
// the index of the container in the render group
|
||||
/** @private */
|
||||
this.parentRenderGroupIndex = 0;
|
||||
// set to true if the container has changed. It is reset once the changes have been applied
|
||||
// by the transform system
|
||||
// its here to stop ensure that when things change, only one update gets registers with the transform system
|
||||
/** @private */
|
||||
this.didChange = false;
|
||||
// same as above, but for the renderable
|
||||
/** @private */
|
||||
this.didViewUpdate = false;
|
||||
// how deep is the container relative to its render group..
|
||||
// unless the element is the root render group - it will be relative to its parent
|
||||
/** @private */
|
||||
this.relativeRenderGroupDepth = 0;
|
||||
/**
|
||||
* The array of children of this container.
|
||||
* @readonly
|
||||
*/
|
||||
this.children = [];
|
||||
/** The display object container that contains this display object. */
|
||||
this.parent = null;
|
||||
// used internally for changing up the render order.. mainly for masks and filters
|
||||
// TODO setting this should cause a rebuild??
|
||||
/** @private */
|
||||
this.includeInBuild = true;
|
||||
/** @private */
|
||||
this.measurable = true;
|
||||
/** @private */
|
||||
this.isSimple = true;
|
||||
// / /////////////Transform related props//////////////
|
||||
// used by the transform system to check if a container needs to be updated that frame
|
||||
// if the tick matches the current transform system tick, it is not updated again
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.updateTick = -1;
|
||||
/**
|
||||
* Current transform of the object based on local factors: position, scale, other stuff.
|
||||
* @readonly
|
||||
*/
|
||||
this.localTransform = new Matrix();
|
||||
/**
|
||||
* The relative group transform is a transform relative to the render group it belongs too. It will include all parent
|
||||
* transforms and up to the render group (think of it as kind of like a stage - but the stage can be nested).
|
||||
* If this container is is self a render group matrix will be relative to its parent render group
|
||||
* @readonly
|
||||
*/
|
||||
this.relativeGroupTransform = new Matrix();
|
||||
/**
|
||||
* The group transform is a transform relative to the render group it belongs too.
|
||||
* If this container is render group then this will be an identity matrix. other wise it
|
||||
* will be the same as the relativeGroupTransform.
|
||||
* Use this value when actually rendering things to the screen
|
||||
* @readonly
|
||||
*/
|
||||
this.groupTransform = this.relativeGroupTransform;
|
||||
/** If the object has been destroyed via destroy(). If true, it should not be used. */
|
||||
this.destroyed = false;
|
||||
// transform data..
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._position = new ObservablePoint(this, 0, 0);
|
||||
/**
|
||||
* The scale factor of the object.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._scale = defaultScale;
|
||||
/**
|
||||
* The pivot point of the container that it rotates around.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._pivot = defaultPivot;
|
||||
/**
|
||||
* The skew amount, on the x and y axis.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._skew = defaultSkew;
|
||||
/**
|
||||
* The X-coordinate value of the normalized local X axis,
|
||||
* the first column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._cx = 1;
|
||||
/**
|
||||
* The Y-coordinate value of the normalized local X axis,
|
||||
* the first column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._sx = 0;
|
||||
/**
|
||||
* The X-coordinate value of the normalized local Y axis,
|
||||
* the second column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._cy = 0;
|
||||
/**
|
||||
* The Y-coordinate value of the normalized local Y axis,
|
||||
* the second column of the local transformation matrix without a scale.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._sy = 1;
|
||||
/**
|
||||
* The rotation amount.
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this._rotation = 0;
|
||||
// / COLOR related props //////////////
|
||||
// color stored as ABGR
|
||||
this.localColor = 16777215;
|
||||
this.localAlpha = 1;
|
||||
this.groupAlpha = 1;
|
||||
// A
|
||||
this.groupColor = 16777215;
|
||||
// BGR
|
||||
this.groupColorAlpha = 4294967295;
|
||||
// ABGR
|
||||
// / BLEND related props //////////////
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.localBlendMode = "inherit";
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.groupBlendMode = "normal";
|
||||
// / VISIBILITY related props //////////////
|
||||
// visibility
|
||||
// 0b11
|
||||
// first bit is visible, second bit is renderable
|
||||
/**
|
||||
* This property holds three bits: culled, visible, renderable
|
||||
* the third bit represents culling (0 = culled, 1 = not culled) 0b100
|
||||
* the second bit represents visibility (0 = not visible, 1 = visible) 0b010
|
||||
* the first bit represents renderable (0 = not renderable, 1 = renderable) 0b001
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.localDisplayStatus = 7;
|
||||
// 0b11 | 0b10 | 0b01 | 0b00
|
||||
/**
|
||||
* @internal
|
||||
* @ignore
|
||||
*/
|
||||
this.globalDisplayStatus = 7;
|
||||
/**
|
||||
* A value that increments each time the containe is modified
|
||||
* eg children added, removed etc
|
||||
* @ignore
|
||||
*/
|
||||
this._didContainerChangeTick = 0;
|
||||
/**
|
||||
* A value that increments each time the container view is modified
|
||||
* eg texture swap, geometry change etc
|
||||
* @ignore
|
||||
*/
|
||||
this._didViewChangeTick = 0;
|
||||
/**
|
||||
* property that tracks if the container transform has changed
|
||||
* @ignore
|
||||
*/
|
||||
this._didLocalTransformChangeId = -1;
|
||||
this.effects = [];
|
||||
assignWithIgnore(this, options, {
|
||||
children: true,
|
||||
parent: true,
|
||||
effects: true
|
||||
});
|
||||
options.children?.forEach((child) => this.addChild(child));
|
||||
options.parent?.addChild(this);
|
||||
}
|
||||
/**
|
||||
* Mixes all enumerable properties and methods from a source object to Container.
|
||||
* @param source - The source of properties and methods to mix in.
|
||||
*/
|
||||
static mixin(source) {
|
||||
Object.defineProperties(Container.prototype, Object.getOwnPropertyDescriptors(source));
|
||||
}
|
||||
/**
|
||||
* We now use the _didContainerChangeTick and _didViewChangeTick to track changes
|
||||
* @deprecated since 8.2.6
|
||||
* @ignore
|
||||
*/
|
||||
set _didChangeId(value) {
|
||||
this._didViewChangeTick = value >> 12 & 4095;
|
||||
this._didContainerChangeTick = value & 4095;
|
||||
}
|
||||
get _didChangeId() {
|
||||
return this._didContainerChangeTick & 4095 | (this._didViewChangeTick & 4095) << 12;
|
||||
}
|
||||
/**
|
||||
* Adds one or more children to the container.
|
||||
*
|
||||
* Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
|
||||
* @param {...Container} children - The Container(s) to add to the container
|
||||
* @returns {Container} - The first child that was added.
|
||||
*/
|
||||
addChild(...children) {
|
||||
if (!this.allowChildren) {
|
||||
deprecation(v8_0_0, "addChild: Only Containers will be allowed to add children in v8.0.0");
|
||||
}
|
||||
if (children.length > 1) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.addChild(children[i]);
|
||||
}
|
||||
return children[0];
|
||||
}
|
||||
const child = children[0];
|
||||
if (child.parent === this) {
|
||||
this.children.splice(this.children.indexOf(child), 1);
|
||||
this.children.push(child);
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
return child;
|
||||
}
|
||||
if (child.parent) {
|
||||
child.parent.removeChild(child);
|
||||
}
|
||||
this.children.push(child);
|
||||
if (this.sortableChildren)
|
||||
this.sortDirty = true;
|
||||
child.parent = this;
|
||||
child.didChange = true;
|
||||
child.didViewUpdate = false;
|
||||
child._updateFlags = 15;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.addChild(child);
|
||||
}
|
||||
this.emit("childAdded", child, this, this.children.length - 1);
|
||||
child.emit("added", this);
|
||||
this._didViewChangeTick++;
|
||||
if (child._zIndex !== 0) {
|
||||
child.depthOfChildModified();
|
||||
}
|
||||
return child;
|
||||
}
|
||||
/**
|
||||
* Removes one or more children from the container.
|
||||
* @param {...Container} children - The Container(s) to remove
|
||||
* @returns {Container} The first child that was removed.
|
||||
*/
|
||||
removeChild(...children) {
|
||||
if (children.length > 1) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.removeChild(children[i]);
|
||||
}
|
||||
return children[0];
|
||||
}
|
||||
const child = children[0];
|
||||
const index = this.children.indexOf(child);
|
||||
if (index > -1) {
|
||||
this._didViewChangeTick++;
|
||||
this.children.splice(index, 1);
|
||||
if (this.renderGroup) {
|
||||
this.renderGroup.removeChild(child);
|
||||
} else if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.removeChild(child);
|
||||
}
|
||||
child.parent = null;
|
||||
this.emit("childRemoved", child, this, index);
|
||||
child.emit("removed", this);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
/** @ignore */
|
||||
_onUpdate(point) {
|
||||
if (point) {
|
||||
if (point === this._skew) {
|
||||
this._updateSkew();
|
||||
}
|
||||
}
|
||||
this._didContainerChangeTick++;
|
||||
if (this.didChange)
|
||||
return;
|
||||
this.didChange = true;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.onChildUpdate(this);
|
||||
}
|
||||
}
|
||||
set isRenderGroup(value) {
|
||||
if (!!this.renderGroup === value)
|
||||
return;
|
||||
if (value) {
|
||||
this.enableRenderGroup();
|
||||
} else {
|
||||
this.disableRenderGroup();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns true if this container is a render group.
|
||||
* This means that it will be rendered as a separate pass, with its own set of instructions
|
||||
*/
|
||||
get isRenderGroup() {
|
||||
return !!this.renderGroup;
|
||||
}
|
||||
/**
|
||||
* Calling this enables a render group for this container.
|
||||
* This means it will be rendered as a separate set of instructions.
|
||||
* The transform of the container will also be handled on the GPU rather than the CPU.
|
||||
*/
|
||||
enableRenderGroup() {
|
||||
if (this.renderGroup)
|
||||
return;
|
||||
const parentRenderGroup = this.parentRenderGroup;
|
||||
parentRenderGroup?.removeChild(this);
|
||||
this.renderGroup = BigPool.get(RenderGroup, this);
|
||||
this.groupTransform = Matrix.IDENTITY;
|
||||
parentRenderGroup?.addChild(this);
|
||||
this._updateIsSimple();
|
||||
}
|
||||
/** This will disable the render group for this container. */
|
||||
disableRenderGroup() {
|
||||
if (!this.renderGroup)
|
||||
return;
|
||||
const parentRenderGroup = this.parentRenderGroup;
|
||||
parentRenderGroup?.removeChild(this);
|
||||
BigPool.return(this.renderGroup);
|
||||
this.renderGroup = null;
|
||||
this.groupTransform = this.relativeGroupTransform;
|
||||
parentRenderGroup?.addChild(this);
|
||||
this._updateIsSimple();
|
||||
}
|
||||
/** @ignore */
|
||||
_updateIsSimple() {
|
||||
this.isSimple = !this.renderGroup && this.effects.length === 0;
|
||||
}
|
||||
/**
|
||||
* Current transform of the object based on world (parent) factors.
|
||||
* @readonly
|
||||
*/
|
||||
get worldTransform() {
|
||||
this._worldTransform || (this._worldTransform = new Matrix());
|
||||
if (this.renderGroup) {
|
||||
this._worldTransform.copyFrom(this.renderGroup.worldTransform);
|
||||
} else if (this.parentRenderGroup) {
|
||||
this._worldTransform.appendFrom(this.relativeGroupTransform, this.parentRenderGroup.worldTransform);
|
||||
}
|
||||
return this._worldTransform;
|
||||
}
|
||||
// / ////// transform related stuff
|
||||
/**
|
||||
* The position of the container on the x axis relative to the local coordinates of the parent.
|
||||
* An alias to position.x
|
||||
*/
|
||||
get x() {
|
||||
return this._position.x;
|
||||
}
|
||||
set x(value) {
|
||||
this._position.x = value;
|
||||
}
|
||||
/**
|
||||
* The position of the container on the y axis relative to the local coordinates of the parent.
|
||||
* An alias to position.y
|
||||
*/
|
||||
get y() {
|
||||
return this._position.y;
|
||||
}
|
||||
set y(value) {
|
||||
this._position.y = value;
|
||||
}
|
||||
/**
|
||||
* The coordinate of the object relative to the local coordinates of the parent.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get position() {
|
||||
return this._position;
|
||||
}
|
||||
set position(value) {
|
||||
this._position.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The rotation of the object in radians.
|
||||
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
|
||||
*/
|
||||
get rotation() {
|
||||
return this._rotation;
|
||||
}
|
||||
set rotation(value) {
|
||||
if (this._rotation !== value) {
|
||||
this._rotation = value;
|
||||
this._onUpdate(this._skew);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The angle of the object in degrees.
|
||||
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
|
||||
*/
|
||||
get angle() {
|
||||
return this.rotation * RAD_TO_DEG;
|
||||
}
|
||||
set angle(value) {
|
||||
this.rotation = value * DEG_TO_RAD;
|
||||
}
|
||||
/**
|
||||
* The center of rotation, scaling, and skewing for this display object in its local space. The `position`
|
||||
* is the projection of `pivot` in the parent's local space.
|
||||
*
|
||||
* By default, the pivot is the origin (0, 0).
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get pivot() {
|
||||
if (this._pivot === defaultPivot) {
|
||||
this._pivot = new ObservablePoint(this, 0, 0);
|
||||
}
|
||||
return this._pivot;
|
||||
}
|
||||
set pivot(value) {
|
||||
if (this._pivot === defaultPivot) {
|
||||
this._pivot = new ObservablePoint(this, 0, 0);
|
||||
}
|
||||
typeof value === "number" ? this._pivot.set(value) : this._pivot.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The skew factor for the object in radians.
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get skew() {
|
||||
if (this._skew === defaultSkew) {
|
||||
this._skew = new ObservablePoint(this, 0, 0);
|
||||
}
|
||||
return this._skew;
|
||||
}
|
||||
set skew(value) {
|
||||
if (this._skew === defaultSkew) {
|
||||
this._skew = new ObservablePoint(this, 0, 0);
|
||||
}
|
||||
this._skew.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The scale factors of this object along the local coordinate axes.
|
||||
*
|
||||
* The default scale is (1, 1).
|
||||
* @since 4.0.0
|
||||
*/
|
||||
get scale() {
|
||||
if (this._scale === defaultScale) {
|
||||
this._scale = new ObservablePoint(this, 1, 1);
|
||||
}
|
||||
return this._scale;
|
||||
}
|
||||
set scale(value) {
|
||||
if (this._scale === defaultScale) {
|
||||
this._scale = new ObservablePoint(this, 0, 0);
|
||||
}
|
||||
typeof value === "number" ? this._scale.set(value) : this._scale.copyFrom(value);
|
||||
}
|
||||
/**
|
||||
* The width of the Container, setting this will actually modify the scale to achieve the value set.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get width() {
|
||||
return Math.abs(this.scale.x * this.getLocalBounds().width);
|
||||
}
|
||||
set width(value) {
|
||||
const localWidth = this.getLocalBounds().width;
|
||||
this._setWidth(value, localWidth);
|
||||
}
|
||||
/**
|
||||
* The height of the Container, setting this will actually modify the scale to achieve the value set.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get height() {
|
||||
return Math.abs(this.scale.y * this.getLocalBounds().height);
|
||||
}
|
||||
set height(value) {
|
||||
const localHeight = this.getLocalBounds().height;
|
||||
this._setHeight(value, localHeight);
|
||||
}
|
||||
/**
|
||||
* Retrieves the size of the container as a [Size]{@link Size} object.
|
||||
* This is faster than get the width and height separately.
|
||||
* @param out - Optional object to store the size in.
|
||||
* @returns - The size of the container.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getSize(out) {
|
||||
if (!out) {
|
||||
out = {};
|
||||
}
|
||||
const bounds = this.getLocalBounds();
|
||||
out.width = Math.abs(this.scale.x * bounds.width);
|
||||
out.height = Math.abs(this.scale.y * bounds.height);
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Sets the size of the container to the specified width and height.
|
||||
* This is faster than setting the width and height separately.
|
||||
* @param value - This can be either a number or a [Size]{@link Size} object.
|
||||
* @param height - The height to set. Defaults to the value of `width` if not provided.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
setSize(value, height) {
|
||||
const size = this.getLocalBounds();
|
||||
if (typeof value === "object") {
|
||||
height = value.height ?? value.width;
|
||||
value = value.width;
|
||||
} else {
|
||||
height ?? (height = value);
|
||||
}
|
||||
value !== void 0 && this._setWidth(value, size.width);
|
||||
height !== void 0 && this._setHeight(height, size.height);
|
||||
}
|
||||
/** Called when the skew or the rotation changes. */
|
||||
_updateSkew() {
|
||||
const rotation = this._rotation;
|
||||
const skew = this._skew;
|
||||
this._cx = Math.cos(rotation + skew._y);
|
||||
this._sx = Math.sin(rotation + skew._y);
|
||||
this._cy = -Math.sin(rotation - skew._x);
|
||||
this._sy = Math.cos(rotation - skew._x);
|
||||
}
|
||||
/**
|
||||
* Updates the transform properties of the container (accepts partial values).
|
||||
* @param {object} opts - The options for updating the transform.
|
||||
* @param {number} opts.x - The x position of the container.
|
||||
* @param {number} opts.y - The y position of the container.
|
||||
* @param {number} opts.scaleX - The scale factor on the x-axis.
|
||||
* @param {number} opts.scaleY - The scale factor on the y-axis.
|
||||
* @param {number} opts.rotation - The rotation of the container, in radians.
|
||||
* @param {number} opts.skewX - The skew factor on the x-axis.
|
||||
* @param {number} opts.skewY - The skew factor on the y-axis.
|
||||
* @param {number} opts.pivotX - The x coordinate of the pivot point.
|
||||
* @param {number} opts.pivotY - The y coordinate of the pivot point.
|
||||
*/
|
||||
updateTransform(opts) {
|
||||
this.position.set(
|
||||
typeof opts.x === "number" ? opts.x : this.position.x,
|
||||
typeof opts.y === "number" ? opts.y : this.position.y
|
||||
);
|
||||
this.scale.set(
|
||||
typeof opts.scaleX === "number" ? opts.scaleX || 1 : this.scale.x,
|
||||
typeof opts.scaleY === "number" ? opts.scaleY || 1 : this.scale.y
|
||||
);
|
||||
this.rotation = typeof opts.rotation === "number" ? opts.rotation : this.rotation;
|
||||
this.skew.set(
|
||||
typeof opts.skewX === "number" ? opts.skewX : this.skew.x,
|
||||
typeof opts.skewY === "number" ? opts.skewY : this.skew.y
|
||||
);
|
||||
this.pivot.set(
|
||||
typeof opts.pivotX === "number" ? opts.pivotX : this.pivot.x,
|
||||
typeof opts.pivotY === "number" ? opts.pivotY : this.pivot.y
|
||||
);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Updates the local transform using the given matrix.
|
||||
* @param matrix - The matrix to use for updating the transform.
|
||||
*/
|
||||
setFromMatrix(matrix) {
|
||||
matrix.decompose(this);
|
||||
}
|
||||
/** Updates the local transform. */
|
||||
updateLocalTransform() {
|
||||
const localTransformChangeId = this._didContainerChangeTick;
|
||||
if (this._didLocalTransformChangeId === localTransformChangeId)
|
||||
return;
|
||||
this._didLocalTransformChangeId = localTransformChangeId;
|
||||
const lt = this.localTransform;
|
||||
const scale = this._scale;
|
||||
const pivot = this._pivot;
|
||||
const position = this._position;
|
||||
const sx = scale._x;
|
||||
const sy = scale._y;
|
||||
const px = pivot._x;
|
||||
const py = pivot._y;
|
||||
lt.a = this._cx * sx;
|
||||
lt.b = this._sx * sx;
|
||||
lt.c = this._cy * sy;
|
||||
lt.d = this._sy * sy;
|
||||
lt.tx = position._x - (px * lt.a + py * lt.c);
|
||||
lt.ty = position._y - (px * lt.b + py * lt.d);
|
||||
}
|
||||
// / ///// color related stuff
|
||||
set alpha(value) {
|
||||
if (value === this.localAlpha)
|
||||
return;
|
||||
this.localAlpha = value;
|
||||
this._updateFlags |= UPDATE_COLOR;
|
||||
this._onUpdate();
|
||||
}
|
||||
/** The opacity of the object. */
|
||||
get alpha() {
|
||||
return this.localAlpha;
|
||||
}
|
||||
set tint(value) {
|
||||
const tempColor = Color.shared.setValue(value ?? 16777215);
|
||||
const bgr = tempColor.toBgrNumber();
|
||||
if (bgr === this.localColor)
|
||||
return;
|
||||
this.localColor = bgr;
|
||||
this._updateFlags |= UPDATE_COLOR;
|
||||
this._onUpdate();
|
||||
}
|
||||
/**
|
||||
* The tint applied to the sprite. This is a hex value.
|
||||
*
|
||||
* A value of 0xFFFFFF will remove any tint effect.
|
||||
* @default 0xFFFFFF
|
||||
*/
|
||||
get tint() {
|
||||
const bgr = this.localColor;
|
||||
return ((bgr & 255) << 16) + (bgr & 65280) + (bgr >> 16 & 255);
|
||||
}
|
||||
// / //////////////// blend related stuff
|
||||
set blendMode(value) {
|
||||
if (this.localBlendMode === value)
|
||||
return;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateFlags |= UPDATE_BLEND;
|
||||
this.localBlendMode = value;
|
||||
this._onUpdate();
|
||||
}
|
||||
/**
|
||||
* The blend mode to be applied to the sprite. Apply a value of `'normal'` to reset the blend mode.
|
||||
* @default 'normal'
|
||||
*/
|
||||
get blendMode() {
|
||||
return this.localBlendMode;
|
||||
}
|
||||
// / ///////// VISIBILITY / RENDERABLE /////////////////
|
||||
/** The visibility of the object. If false the object will not be drawn, and the transform will not be updated. */
|
||||
get visible() {
|
||||
return !!(this.localDisplayStatus & 2);
|
||||
}
|
||||
set visible(value) {
|
||||
const valueNumber = value ? 2 : 0;
|
||||
if ((this.localDisplayStatus & 2) === valueNumber)
|
||||
return;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateFlags |= UPDATE_VISIBLE;
|
||||
this.localDisplayStatus ^= 2;
|
||||
this._onUpdate();
|
||||
}
|
||||
/** @ignore */
|
||||
get culled() {
|
||||
return !(this.localDisplayStatus & 4);
|
||||
}
|
||||
/** @ignore */
|
||||
set culled(value) {
|
||||
const valueNumber = value ? 0 : 4;
|
||||
if ((this.localDisplayStatus & 4) === valueNumber)
|
||||
return;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateFlags |= UPDATE_VISIBLE;
|
||||
this.localDisplayStatus ^= 4;
|
||||
this._onUpdate();
|
||||
}
|
||||
/** Can this object be rendered, if false the object will not be drawn but the transform will still be updated. */
|
||||
get renderable() {
|
||||
return !!(this.localDisplayStatus & 1);
|
||||
}
|
||||
set renderable(value) {
|
||||
const valueNumber = value ? 1 : 0;
|
||||
if ((this.localDisplayStatus & 1) === valueNumber)
|
||||
return;
|
||||
this._updateFlags |= UPDATE_VISIBLE;
|
||||
this.localDisplayStatus ^= 1;
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._onUpdate();
|
||||
}
|
||||
/** Whether or not the object should be rendered. */
|
||||
get isRenderable() {
|
||||
return this.localDisplayStatus === 7 && this.groupAlpha > 0;
|
||||
}
|
||||
/**
|
||||
* Removes all internal references and listeners as well as removes children from the display list.
|
||||
* Do not use a Container after calling `destroy`.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
|
||||
* method called as well. 'options' will be passed on to those calls.
|
||||
* @param {boolean} [options.texture=false] - Only used for children with textures e.g. Sprites. If options.children
|
||||
* is set to true it should destroy the texture of the child sprite
|
||||
* @param {boolean} [options.textureSource=false] - Only used for children with textures e.g. Sprites.
|
||||
* If options.children is set to true it should destroy the texture source of the child sprite
|
||||
* @param {boolean} [options.context=false] - Only used for children with graphicsContexts e.g. Graphics.
|
||||
* If options.children is set to true it should destroy the context of the child graphics
|
||||
*/
|
||||
destroy(options = false) {
|
||||
if (this.destroyed)
|
||||
return;
|
||||
this.destroyed = true;
|
||||
const oldChildren = this.removeChildren(0, this.children.length);
|
||||
this.removeFromParent();
|
||||
this.parent = null;
|
||||
this._maskEffect = null;
|
||||
this._filterEffect = null;
|
||||
this.effects = null;
|
||||
this._position = null;
|
||||
this._scale = null;
|
||||
this._pivot = null;
|
||||
this._skew = null;
|
||||
this.emit("destroyed", this);
|
||||
this.removeAllListeners();
|
||||
const destroyChildren = typeof options === "boolean" ? options : options?.children;
|
||||
if (destroyChildren) {
|
||||
for (let i = 0; i < oldChildren.length; ++i) {
|
||||
oldChildren[i].destroy(options);
|
||||
}
|
||||
}
|
||||
this.renderGroup?.destroy();
|
||||
this.renderGroup = null;
|
||||
}
|
||||
}
|
||||
Container.mixin(childrenHelperMixin);
|
||||
Container.mixin(toLocalGlobalMixin);
|
||||
Container.mixin(onRenderMixin);
|
||||
Container.mixin(measureMixin);
|
||||
Container.mixin(effectsMixin);
|
||||
Container.mixin(findMixin);
|
||||
Container.mixin(sortMixin);
|
||||
Container.mixin(cullingMixin);
|
||||
|
||||
export { Container, UPDATE_BLEND, UPDATE_COLOR, UPDATE_TRANSFORM, UPDATE_VISIBLE };
|
||||
//# sourceMappingURL=Container.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/Container.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/Container.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
29
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.d.ts
generated
vendored
Normal file
29
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions';
|
||||
import type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';
|
||||
import type { InstructionPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';
|
||||
import type { Renderer } from '../../rendering/renderers/types';
|
||||
import type { RenderContainer } from './RenderContainer';
|
||||
/**
|
||||
* The CustomRenderPipe is a render pipe that allows for custom rendering logic for your renderable objects.
|
||||
* @example
|
||||
* import { RenderContainer } from 'pixi.js';
|
||||
*
|
||||
* const renderContainer = new RenderContainer(
|
||||
* (renderer) => {
|
||||
* renderer.clear({
|
||||
* clearColor: 'green', // clear the screen to green when rendering this item
|
||||
* });
|
||||
* })
|
||||
* @memberof rendering
|
||||
*/
|
||||
export declare class CustomRenderPipe implements InstructionPipe<RenderContainer> {
|
||||
static extension: {
|
||||
readonly type: readonly [ExtensionType.WebGLPipes, ExtensionType.WebGPUPipes, ExtensionType.CanvasPipes];
|
||||
readonly name: "customRender";
|
||||
};
|
||||
private _renderer;
|
||||
constructor(renderer: Renderer);
|
||||
addRenderable(container: RenderContainer, instructionSet: InstructionSet): void;
|
||||
execute(container: RenderContainer): void;
|
||||
destroy(): void;
|
||||
}
|
33
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.js
generated
vendored
Normal file
33
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../extensions/Extensions.js');
|
||||
|
||||
"use strict";
|
||||
class CustomRenderPipe {
|
||||
constructor(renderer) {
|
||||
this._renderer = renderer;
|
||||
}
|
||||
addRenderable(container, instructionSet) {
|
||||
this._renderer.renderPipes.batch.break(instructionSet);
|
||||
instructionSet.add(container);
|
||||
}
|
||||
execute(container) {
|
||||
if (!container.isRenderable)
|
||||
return;
|
||||
container.render(this._renderer);
|
||||
}
|
||||
destroy() {
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
CustomRenderPipe.extension = {
|
||||
type: [
|
||||
Extensions.ExtensionType.WebGLPipes,
|
||||
Extensions.ExtensionType.WebGPUPipes,
|
||||
Extensions.ExtensionType.CanvasPipes
|
||||
],
|
||||
name: "customRender"
|
||||
};
|
||||
|
||||
exports.CustomRenderPipe = CustomRenderPipe;
|
||||
//# sourceMappingURL=CustomRenderPipe.js.map
|
1
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CustomRenderPipe.js","sources":["../../../src/scene/container/CustomRenderPipe.ts"],"sourcesContent":["import { ExtensionType } from '../../extensions/Extensions';\n\nimport type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';\nimport type { InstructionPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';\nimport type { Renderer } from '../../rendering/renderers/types';\nimport type { RenderContainer } from './RenderContainer';\n\n/**\n * The CustomRenderPipe is a render pipe that allows for custom rendering logic for your renderable objects.\n * @example\n * import { RenderContainer } from 'pixi.js';\n *\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 * @memberof rendering\n */\nexport class CustomRenderPipe implements InstructionPipe<RenderContainer>\n{\n public static extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes,\n ],\n name: 'customRender',\n } as const;\n\n private _renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this._renderer = renderer;\n }\n\n public addRenderable(container: RenderContainer, instructionSet: InstructionSet): void\n {\n this._renderer.renderPipes.batch.break(instructionSet);\n\n instructionSet.add(container);\n }\n\n public execute(container: RenderContainer)\n {\n if (!container.isRenderable) return;\n\n container.render(this._renderer);\n }\n\n public destroy(): void\n {\n this._renderer = null;\n }\n}\n"],"names":["ExtensionType"],"mappings":";;;;;AAoBO,MAAM,gBACb,CAAA;AAAA,EAYI,YAAY,QACZ,EAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AAAA,GACrB;AAAA,EAEO,aAAA,CAAc,WAA4B,cACjD,EAAA;AACI,IAAA,IAAA,CAAK,SAAU,CAAA,WAAA,CAAY,KAAM,CAAA,KAAA,CAAM,cAAc,CAAA,CAAA;AAErD,IAAA,cAAA,CAAe,IAAI,SAAS,CAAA,CAAA;AAAA,GAChC;AAAA,EAEO,QAAQ,SACf,EAAA;AACI,IAAA,IAAI,CAAC,SAAU,CAAA,YAAA;AAAc,MAAA,OAAA;AAE7B,IAAU,SAAA,CAAA,MAAA,CAAO,KAAK,SAAS,CAAA,CAAA;AAAA,GACnC;AAAA,EAEO,OACP,GAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAAA,GACrB;AACJ,CAAA;AApCa,gBAAA,CAEK,SAAY,GAAA;AAAA,EACtB,IAAM,EAAA;AAAA,IACFA,wBAAc,CAAA,UAAA;AAAA,IACdA,wBAAc,CAAA,WAAA;AAAA,IACdA,wBAAc,CAAA,WAAA;AAAA,GAClB;AAAA,EACA,IAAM,EAAA,cAAA;AACV,CAAA;;;;"}
|
31
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.mjs
generated
vendored
Normal file
31
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.mjs
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions.mjs';
|
||||
|
||||
"use strict";
|
||||
class CustomRenderPipe {
|
||||
constructor(renderer) {
|
||||
this._renderer = renderer;
|
||||
}
|
||||
addRenderable(container, instructionSet) {
|
||||
this._renderer.renderPipes.batch.break(instructionSet);
|
||||
instructionSet.add(container);
|
||||
}
|
||||
execute(container) {
|
||||
if (!container.isRenderable)
|
||||
return;
|
||||
container.render(this._renderer);
|
||||
}
|
||||
destroy() {
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
CustomRenderPipe.extension = {
|
||||
type: [
|
||||
ExtensionType.WebGLPipes,
|
||||
ExtensionType.WebGPUPipes,
|
||||
ExtensionType.CanvasPipes
|
||||
],
|
||||
name: "customRender"
|
||||
};
|
||||
|
||||
export { CustomRenderPipe };
|
||||
//# sourceMappingURL=CustomRenderPipe.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/CustomRenderPipe.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CustomRenderPipe.mjs","sources":["../../../src/scene/container/CustomRenderPipe.ts"],"sourcesContent":["import { ExtensionType } from '../../extensions/Extensions';\n\nimport type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';\nimport type { InstructionPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';\nimport type { Renderer } from '../../rendering/renderers/types';\nimport type { RenderContainer } from './RenderContainer';\n\n/**\n * The CustomRenderPipe is a render pipe that allows for custom rendering logic for your renderable objects.\n * @example\n * import { RenderContainer } from 'pixi.js';\n *\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 * @memberof rendering\n */\nexport class CustomRenderPipe implements InstructionPipe<RenderContainer>\n{\n public static extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes,\n ],\n name: 'customRender',\n } as const;\n\n private _renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this._renderer = renderer;\n }\n\n public addRenderable(container: RenderContainer, instructionSet: InstructionSet): void\n {\n this._renderer.renderPipes.batch.break(instructionSet);\n\n instructionSet.add(container);\n }\n\n public execute(container: RenderContainer)\n {\n if (!container.isRenderable) return;\n\n container.render(this._renderer);\n }\n\n public destroy(): void\n {\n this._renderer = null;\n }\n}\n"],"names":[],"mappings":";;;AAoBO,MAAM,gBACb,CAAA;AAAA,EAYI,YAAY,QACZ,EAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AAAA,GACrB;AAAA,EAEO,aAAA,CAAc,WAA4B,cACjD,EAAA;AACI,IAAA,IAAA,CAAK,SAAU,CAAA,WAAA,CAAY,KAAM,CAAA,KAAA,CAAM,cAAc,CAAA,CAAA;AAErD,IAAA,cAAA,CAAe,IAAI,SAAS,CAAA,CAAA;AAAA,GAChC;AAAA,EAEO,QAAQ,SACf,EAAA;AACI,IAAA,IAAI,CAAC,SAAU,CAAA,YAAA;AAAc,MAAA,OAAA;AAE7B,IAAU,SAAA,CAAA,MAAA,CAAO,KAAK,SAAS,CAAA,CAAA;AAAA,GACnC;AAAA,EAEO,OACP,GAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAAA,GACrB;AACJ,CAAA;AApCa,gBAAA,CAEK,SAAY,GAAA;AAAA,EACtB,IAAM,EAAA;AAAA,IACF,aAAc,CAAA,UAAA;AAAA,IACd,aAAc,CAAA,WAAA;AAAA,IACd,aAAc,CAAA,WAAA;AAAA,GAClB;AAAA,EACA,IAAM,EAAA,cAAA;AACV,CAAA;;;;"}
|
20
node_modules/pixi.js/lib/scene/container/Effect.d.ts
generated
vendored
Normal file
20
node_modules/pixi.js/lib/scene/container/Effect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { Point } from '../../maths/point/Point';
|
||||
import type { PointData } from '../../maths/point/PointData';
|
||||
import type { Bounds } from './bounds/Bounds';
|
||||
import type { Container } from './Container';
|
||||
/**
|
||||
* An effect that can be applied to a container. This is used to create effects such as filters/masks etc.
|
||||
* @memberof rendering
|
||||
*/
|
||||
export interface Effect {
|
||||
pipe: string;
|
||||
priority: number;
|
||||
addBounds?(bounds: Bounds, skipUpdateTransform?: boolean): void;
|
||||
addLocalBounds?(bounds: Bounds, localRoot: Container): void;
|
||||
containsPoint?(point: PointData, hitTestFn: (container: Container, point: Point) => boolean): boolean;
|
||||
destroy(): void;
|
||||
}
|
||||
export interface EffectConstructor {
|
||||
new (options?: any): Effect;
|
||||
test?(options: any): boolean;
|
||||
}
|
4
node_modules/pixi.js/lib/scene/container/Effect.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/scene/container/Effect.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=Effect.js.map
|
1
node_modules/pixi.js/lib/scene/container/Effect.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/Effect.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Effect.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/scene/container/Effect.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/scene/container/Effect.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=Effect.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/Effect.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/Effect.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Effect.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
91
node_modules/pixi.js/lib/scene/container/RenderContainer.d.ts
generated
vendored
Normal file
91
node_modules/pixi.js/lib/scene/container/RenderContainer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import { Bounds, type BoundsData } from './bounds/Bounds';
|
||||
import { Container } from './Container';
|
||||
import type { Point } from '../../maths/point/Point';
|
||||
import type { Instruction } from '../../rendering/renderers/shared/instructions/Instruction';
|
||||
import type { View } from '../../rendering/renderers/shared/view/View';
|
||||
import type { Renderer } from '../../rendering/renderers/types';
|
||||
import type { ContainerOptions } from './Container';
|
||||
type RenderFunction = (renderer: Renderer) => void;
|
||||
/**
|
||||
* Options for the {@link scene.RenderContainer} constructor.
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface RenderContainerOptions extends ContainerOptions {
|
||||
/** the optional custom render function if you want to inject the function via the constructor */
|
||||
render?: RenderFunction;
|
||||
/** how to know if the custom render logic contains a point or not, used for interaction */
|
||||
containsPoint?: (point: Point) => boolean;
|
||||
/** how to add the bounds of this object when measuring */
|
||||
addBounds?: (bounds: BoundsData) => void;
|
||||
}
|
||||
/**
|
||||
* A container that allows for custom rendering logic. Its essentially calls the render function each frame
|
||||
* and allows for custom rendering logic - the render could be a WebGL renderer or WebGPU render or even a canvas render.
|
||||
* Its up to you to define the logic.
|
||||
*
|
||||
* This can be used in two ways, either by extending the class and overriding the render method,
|
||||
* or by passing a custom render function
|
||||
* @example
|
||||
* ```js
|
||||
* import { RenderContainer } from 'pixi.js';
|
||||
*
|
||||
* // extend the class
|
||||
* class MyRenderContainer extends RenderContainer
|
||||
* {
|
||||
* render(renderer)
|
||||
* {
|
||||
* renderer.clear({
|
||||
* clearColor: 'green', // clear the screen to green when rendering this item
|
||||
* });
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // override the render method
|
||||
* const renderContainer = new RenderContainer(
|
||||
* (renderer) => {
|
||||
* renderer.clear({
|
||||
* clearColor: 'green', // clear the screen to green when rendering this item
|
||||
* });
|
||||
* })
|
||||
* ```
|
||||
* @memberof scene
|
||||
* @extends scene.Container
|
||||
*/
|
||||
export declare class RenderContainer extends Container implements View, Instruction {
|
||||
batched: boolean;
|
||||
/**
|
||||
* Whether or not to round the x/y position of the sprite.
|
||||
* @type {boolean}
|
||||
*/
|
||||
roundPixels: boolean;
|
||||
_roundPixels: 0 | 1;
|
||||
_lastUsed: number;
|
||||
_lastInstructionTick: number;
|
||||
/**
|
||||
* The local bounds of the sprite.
|
||||
* @type {rendering.Bounds}
|
||||
*/
|
||||
bounds: Bounds;
|
||||
/**
|
||||
* Checks if the object contains the given point.
|
||||
* @param point - The point to check
|
||||
*/
|
||||
containsPoint: (point: Point) => boolean;
|
||||
/**
|
||||
* Adds the bounds of this text to the bounds object.
|
||||
* @param bounds - The output bounds object.
|
||||
*/
|
||||
addBounds: (bounds: Bounds) => void;
|
||||
canBundle: boolean;
|
||||
readonly renderPipeId: string;
|
||||
/**
|
||||
* @param options - The options for the container.
|
||||
*/
|
||||
constructor(options: RenderContainerOptions | RenderFunction);
|
||||
/**
|
||||
* An overridable function that can be used to render the object using the current renderer.
|
||||
* @param _renderer - The current renderer
|
||||
*/
|
||||
render(_renderer: Renderer): void;
|
||||
}
|
||||
export {};
|
44
node_modules/pixi.js/lib/scene/container/RenderContainer.js
generated
vendored
Normal file
44
node_modules/pixi.js/lib/scene/container/RenderContainer.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var Bounds = require('./bounds/Bounds.js');
|
||||
var Container = require('./Container.js');
|
||||
|
||||
"use strict";
|
||||
class RenderContainer extends Container.Container {
|
||||
/**
|
||||
* @param options - The options for the container.
|
||||
*/
|
||||
constructor(options) {
|
||||
if (typeof options === "function") {
|
||||
options = { render: options };
|
||||
}
|
||||
const { render, ...rest } = options;
|
||||
super({
|
||||
label: "RenderContainer",
|
||||
...rest
|
||||
});
|
||||
this.batched = false;
|
||||
this._lastUsed = 0;
|
||||
this._lastInstructionTick = -1;
|
||||
/**
|
||||
* The local bounds of the sprite.
|
||||
* @type {rendering.Bounds}
|
||||
*/
|
||||
this.bounds = new Bounds.Bounds();
|
||||
this.canBundle = false;
|
||||
this.renderPipeId = "customRender";
|
||||
if (render)
|
||||
this.render = render;
|
||||
this.containsPoint = options.containsPoint ?? (() => false);
|
||||
this.addBounds = options.addBounds ?? (() => false);
|
||||
}
|
||||
/**
|
||||
* An overridable function that can be used to render the object using the current renderer.
|
||||
* @param _renderer - The current renderer
|
||||
*/
|
||||
render(_renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
exports.RenderContainer = RenderContainer;
|
||||
//# sourceMappingURL=RenderContainer.js.map
|
1
node_modules/pixi.js/lib/scene/container/RenderContainer.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderContainer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RenderContainer.js","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":["Container","Bounds"],"mappings":";;;;;;AA0DO,MAAM,wBAAwBA,mBACrC,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,IAAIC,aAAO,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;;;;"}
|
42
node_modules/pixi.js/lib/scene/container/RenderContainer.mjs
generated
vendored
Normal file
42
node_modules/pixi.js/lib/scene/container/RenderContainer.mjs
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Bounds } from './bounds/Bounds.mjs';
|
||||
import { Container } from './Container.mjs';
|
||||
|
||||
"use strict";
|
||||
class RenderContainer extends Container {
|
||||
/**
|
||||
* @param options - The options for the container.
|
||||
*/
|
||||
constructor(options) {
|
||||
if (typeof options === "function") {
|
||||
options = { render: options };
|
||||
}
|
||||
const { render, ...rest } = options;
|
||||
super({
|
||||
label: "RenderContainer",
|
||||
...rest
|
||||
});
|
||||
this.batched = false;
|
||||
this._lastUsed = 0;
|
||||
this._lastInstructionTick = -1;
|
||||
/**
|
||||
* The local bounds of the sprite.
|
||||
* @type {rendering.Bounds}
|
||||
*/
|
||||
this.bounds = new Bounds();
|
||||
this.canBundle = false;
|
||||
this.renderPipeId = "customRender";
|
||||
if (render)
|
||||
this.render = render;
|
||||
this.containsPoint = options.containsPoint ?? (() => false);
|
||||
this.addBounds = options.addBounds ?? (() => false);
|
||||
}
|
||||
/**
|
||||
* An overridable function that can be used to render the object using the current renderer.
|
||||
* @param _renderer - The current renderer
|
||||
*/
|
||||
render(_renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
export { RenderContainer };
|
||||
//# sourceMappingURL=RenderContainer.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/RenderContainer.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderContainer.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"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;;;;"}
|
56
node_modules/pixi.js/lib/scene/container/RenderGroup.d.ts
generated
vendored
Normal file
56
node_modules/pixi.js/lib/scene/container/RenderGroup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Matrix } from '../../maths/matrix/Matrix';
|
||||
import { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';
|
||||
import type { Instruction } from '../../rendering/renderers/shared/instructions/Instruction';
|
||||
import type { Container } from './Container';
|
||||
/**
|
||||
* A RenderGroup is a class that is responsible for I generating a set of instructions that are used to render the
|
||||
* root container and its children. It also watches for any changes in that container or its children,
|
||||
* these changes are analysed and either the instruction set is rebuild or the instructions data is updated.
|
||||
* @memberof rendering
|
||||
*/
|
||||
export declare class RenderGroup implements Instruction {
|
||||
renderPipeId: string;
|
||||
root: Container;
|
||||
canBundle: boolean;
|
||||
renderGroupParent: RenderGroup;
|
||||
renderGroupChildren: RenderGroup[];
|
||||
worldTransform: Matrix;
|
||||
worldColorAlpha: number;
|
||||
worldColor: number;
|
||||
worldAlpha: number;
|
||||
readonly childrenToUpdate: Record<number, {
|
||||
list: Container[];
|
||||
index: number;
|
||||
}>;
|
||||
updateTick: number;
|
||||
readonly childrenRenderablesToUpdate: {
|
||||
list: Container[];
|
||||
index: number;
|
||||
};
|
||||
structureDidChange: boolean;
|
||||
instructionSet: InstructionSet;
|
||||
private readonly _onRenderContainers;
|
||||
init(root: Container): void;
|
||||
reset(): void;
|
||||
get localTransform(): Matrix;
|
||||
addRenderGroupChild(renderGroupChild: RenderGroup): void;
|
||||
private _removeRenderGroupChild;
|
||||
addChild(child: Container): void;
|
||||
removeChild(child: Container): void;
|
||||
removeChildren(children: Container[]): void;
|
||||
onChildUpdate(child: Container): void;
|
||||
updateRenderable(container: Container): void;
|
||||
onChildViewUpdate(child: Container): void;
|
||||
get isRenderable(): boolean;
|
||||
/**
|
||||
* adding a container to the onRender list will make sure the user function
|
||||
* passed in to the user defined 'onRender` callBack
|
||||
* @param container - the container to add to the onRender list
|
||||
*/
|
||||
addOnRender(container: Container): void;
|
||||
removeOnRender(container: Container): void;
|
||||
runOnRender(): void;
|
||||
destroy(): void;
|
||||
getChildren(out?: Container[]): Container[];
|
||||
private _getChildren;
|
||||
}
|
182
node_modules/pixi.js/lib/scene/container/RenderGroup.js
generated
vendored
Normal file
182
node_modules/pixi.js/lib/scene/container/RenderGroup.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../maths/matrix/Matrix.js');
|
||||
var InstructionSet = require('../../rendering/renderers/shared/instructions/InstructionSet.js');
|
||||
|
||||
"use strict";
|
||||
class RenderGroup {
|
||||
constructor() {
|
||||
this.renderPipeId = "renderGroup";
|
||||
this.root = null;
|
||||
this.canBundle = false;
|
||||
this.renderGroupParent = null;
|
||||
this.renderGroupChildren = [];
|
||||
this.worldTransform = new Matrix.Matrix();
|
||||
this.worldColorAlpha = 4294967295;
|
||||
this.worldColor = 16777215;
|
||||
this.worldAlpha = 1;
|
||||
// these updates are transform changes..
|
||||
this.childrenToUpdate = /* @__PURE__ */ Object.create(null);
|
||||
this.updateTick = 0;
|
||||
// these update are renderable changes..
|
||||
this.childrenRenderablesToUpdate = { list: [], index: 0 };
|
||||
// other
|
||||
this.structureDidChange = true;
|
||||
this.instructionSet = new InstructionSet.InstructionSet();
|
||||
this._onRenderContainers = [];
|
||||
}
|
||||
init(root) {
|
||||
this.root = root;
|
||||
if (root._onRender)
|
||||
this.addOnRender(root);
|
||||
root.didChange = true;
|
||||
const children = root.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.addChild(children[i]);
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
this.renderGroupChildren.length = 0;
|
||||
for (const i in this.childrenToUpdate) {
|
||||
const childrenAtDepth = this.childrenToUpdate[i];
|
||||
childrenAtDepth.list.fill(null);
|
||||
childrenAtDepth.index = 0;
|
||||
}
|
||||
this.childrenRenderablesToUpdate.index = 0;
|
||||
this.childrenRenderablesToUpdate.list.fill(null);
|
||||
this.root = null;
|
||||
this.updateTick = 0;
|
||||
this.structureDidChange = true;
|
||||
this._onRenderContainers.length = 0;
|
||||
this.renderGroupParent = null;
|
||||
}
|
||||
get localTransform() {
|
||||
return this.root.localTransform;
|
||||
}
|
||||
addRenderGroupChild(renderGroupChild) {
|
||||
if (renderGroupChild.renderGroupParent) {
|
||||
renderGroupChild.renderGroupParent._removeRenderGroupChild(renderGroupChild);
|
||||
}
|
||||
renderGroupChild.renderGroupParent = this;
|
||||
this.renderGroupChildren.push(renderGroupChild);
|
||||
}
|
||||
_removeRenderGroupChild(renderGroupChild) {
|
||||
const index = this.renderGroupChildren.indexOf(renderGroupChild);
|
||||
if (index > -1) {
|
||||
this.renderGroupChildren.splice(index, 1);
|
||||
}
|
||||
renderGroupChild.renderGroupParent = null;
|
||||
}
|
||||
addChild(child) {
|
||||
this.structureDidChange = true;
|
||||
child.parentRenderGroup = this;
|
||||
child.updateTick = -1;
|
||||
if (child.parent === this.root) {
|
||||
child.relativeRenderGroupDepth = 1;
|
||||
} else {
|
||||
child.relativeRenderGroupDepth = child.parent.relativeRenderGroupDepth + 1;
|
||||
}
|
||||
child.didChange = true;
|
||||
this.onChildUpdate(child);
|
||||
if (child.renderGroup) {
|
||||
this.addRenderGroupChild(child.renderGroup);
|
||||
return;
|
||||
}
|
||||
if (child._onRender)
|
||||
this.addOnRender(child);
|
||||
const children = child.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.addChild(children[i]);
|
||||
}
|
||||
}
|
||||
removeChild(child) {
|
||||
this.structureDidChange = true;
|
||||
if (child._onRender) {
|
||||
if (!child.renderGroup) {
|
||||
this.removeOnRender(child);
|
||||
}
|
||||
}
|
||||
child.parentRenderGroup = null;
|
||||
if (child.renderGroup) {
|
||||
this._removeRenderGroupChild(child.renderGroup);
|
||||
return;
|
||||
}
|
||||
const children = child.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.removeChild(children[i]);
|
||||
}
|
||||
}
|
||||
removeChildren(children) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.removeChild(children[i]);
|
||||
}
|
||||
}
|
||||
onChildUpdate(child) {
|
||||
let childrenToUpdate = this.childrenToUpdate[child.relativeRenderGroupDepth];
|
||||
if (!childrenToUpdate) {
|
||||
childrenToUpdate = this.childrenToUpdate[child.relativeRenderGroupDepth] = {
|
||||
index: 0,
|
||||
list: []
|
||||
};
|
||||
}
|
||||
childrenToUpdate.list[childrenToUpdate.index++] = child;
|
||||
}
|
||||
// SHOULD THIS BE HERE?
|
||||
updateRenderable(container) {
|
||||
if (container.globalDisplayStatus < 7)
|
||||
return;
|
||||
container.didViewUpdate = false;
|
||||
this.instructionSet.renderPipes[container.renderPipeId].updateRenderable(container);
|
||||
}
|
||||
onChildViewUpdate(child) {
|
||||
this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++] = child;
|
||||
}
|
||||
get isRenderable() {
|
||||
return this.root.localDisplayStatus === 7 && this.worldAlpha > 0;
|
||||
}
|
||||
/**
|
||||
* adding a container to the onRender list will make sure the user function
|
||||
* passed in to the user defined 'onRender` callBack
|
||||
* @param container - the container to add to the onRender list
|
||||
*/
|
||||
addOnRender(container) {
|
||||
this._onRenderContainers.push(container);
|
||||
}
|
||||
removeOnRender(container) {
|
||||
this._onRenderContainers.splice(this._onRenderContainers.indexOf(container), 1);
|
||||
}
|
||||
runOnRender() {
|
||||
for (let i = 0; i < this._onRenderContainers.length; i++) {
|
||||
this._onRenderContainers[i]._onRender();
|
||||
}
|
||||
}
|
||||
destroy() {
|
||||
this.renderGroupParent = null;
|
||||
this.root = null;
|
||||
this.childrenRenderablesToUpdate = null;
|
||||
this.childrenToUpdate = null;
|
||||
this.renderGroupChildren = null;
|
||||
this._onRenderContainers = null;
|
||||
this.instructionSet = null;
|
||||
}
|
||||
getChildren(out = []) {
|
||||
const children = this.root.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this._getChildren(children[i], out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
_getChildren(container, out = []) {
|
||||
out.push(container);
|
||||
if (container.renderGroup)
|
||||
return out;
|
||||
const children = container.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this._getChildren(children[i], out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
exports.RenderGroup = RenderGroup;
|
||||
//# sourceMappingURL=RenderGroup.js.map
|
1
node_modules/pixi.js/lib/scene/container/RenderGroup.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderGroup.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
180
node_modules/pixi.js/lib/scene/container/RenderGroup.mjs
generated
vendored
Normal file
180
node_modules/pixi.js/lib/scene/container/RenderGroup.mjs
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
import { Matrix } from '../../maths/matrix/Matrix.mjs';
|
||||
import { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet.mjs';
|
||||
|
||||
"use strict";
|
||||
class RenderGroup {
|
||||
constructor() {
|
||||
this.renderPipeId = "renderGroup";
|
||||
this.root = null;
|
||||
this.canBundle = false;
|
||||
this.renderGroupParent = null;
|
||||
this.renderGroupChildren = [];
|
||||
this.worldTransform = new Matrix();
|
||||
this.worldColorAlpha = 4294967295;
|
||||
this.worldColor = 16777215;
|
||||
this.worldAlpha = 1;
|
||||
// these updates are transform changes..
|
||||
this.childrenToUpdate = /* @__PURE__ */ Object.create(null);
|
||||
this.updateTick = 0;
|
||||
// these update are renderable changes..
|
||||
this.childrenRenderablesToUpdate = { list: [], index: 0 };
|
||||
// other
|
||||
this.structureDidChange = true;
|
||||
this.instructionSet = new InstructionSet();
|
||||
this._onRenderContainers = [];
|
||||
}
|
||||
init(root) {
|
||||
this.root = root;
|
||||
if (root._onRender)
|
||||
this.addOnRender(root);
|
||||
root.didChange = true;
|
||||
const children = root.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.addChild(children[i]);
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
this.renderGroupChildren.length = 0;
|
||||
for (const i in this.childrenToUpdate) {
|
||||
const childrenAtDepth = this.childrenToUpdate[i];
|
||||
childrenAtDepth.list.fill(null);
|
||||
childrenAtDepth.index = 0;
|
||||
}
|
||||
this.childrenRenderablesToUpdate.index = 0;
|
||||
this.childrenRenderablesToUpdate.list.fill(null);
|
||||
this.root = null;
|
||||
this.updateTick = 0;
|
||||
this.structureDidChange = true;
|
||||
this._onRenderContainers.length = 0;
|
||||
this.renderGroupParent = null;
|
||||
}
|
||||
get localTransform() {
|
||||
return this.root.localTransform;
|
||||
}
|
||||
addRenderGroupChild(renderGroupChild) {
|
||||
if (renderGroupChild.renderGroupParent) {
|
||||
renderGroupChild.renderGroupParent._removeRenderGroupChild(renderGroupChild);
|
||||
}
|
||||
renderGroupChild.renderGroupParent = this;
|
||||
this.renderGroupChildren.push(renderGroupChild);
|
||||
}
|
||||
_removeRenderGroupChild(renderGroupChild) {
|
||||
const index = this.renderGroupChildren.indexOf(renderGroupChild);
|
||||
if (index > -1) {
|
||||
this.renderGroupChildren.splice(index, 1);
|
||||
}
|
||||
renderGroupChild.renderGroupParent = null;
|
||||
}
|
||||
addChild(child) {
|
||||
this.structureDidChange = true;
|
||||
child.parentRenderGroup = this;
|
||||
child.updateTick = -1;
|
||||
if (child.parent === this.root) {
|
||||
child.relativeRenderGroupDepth = 1;
|
||||
} else {
|
||||
child.relativeRenderGroupDepth = child.parent.relativeRenderGroupDepth + 1;
|
||||
}
|
||||
child.didChange = true;
|
||||
this.onChildUpdate(child);
|
||||
if (child.renderGroup) {
|
||||
this.addRenderGroupChild(child.renderGroup);
|
||||
return;
|
||||
}
|
||||
if (child._onRender)
|
||||
this.addOnRender(child);
|
||||
const children = child.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.addChild(children[i]);
|
||||
}
|
||||
}
|
||||
removeChild(child) {
|
||||
this.structureDidChange = true;
|
||||
if (child._onRender) {
|
||||
if (!child.renderGroup) {
|
||||
this.removeOnRender(child);
|
||||
}
|
||||
}
|
||||
child.parentRenderGroup = null;
|
||||
if (child.renderGroup) {
|
||||
this._removeRenderGroupChild(child.renderGroup);
|
||||
return;
|
||||
}
|
||||
const children = child.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.removeChild(children[i]);
|
||||
}
|
||||
}
|
||||
removeChildren(children) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this.removeChild(children[i]);
|
||||
}
|
||||
}
|
||||
onChildUpdate(child) {
|
||||
let childrenToUpdate = this.childrenToUpdate[child.relativeRenderGroupDepth];
|
||||
if (!childrenToUpdate) {
|
||||
childrenToUpdate = this.childrenToUpdate[child.relativeRenderGroupDepth] = {
|
||||
index: 0,
|
||||
list: []
|
||||
};
|
||||
}
|
||||
childrenToUpdate.list[childrenToUpdate.index++] = child;
|
||||
}
|
||||
// SHOULD THIS BE HERE?
|
||||
updateRenderable(container) {
|
||||
if (container.globalDisplayStatus < 7)
|
||||
return;
|
||||
container.didViewUpdate = false;
|
||||
this.instructionSet.renderPipes[container.renderPipeId].updateRenderable(container);
|
||||
}
|
||||
onChildViewUpdate(child) {
|
||||
this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++] = child;
|
||||
}
|
||||
get isRenderable() {
|
||||
return this.root.localDisplayStatus === 7 && this.worldAlpha > 0;
|
||||
}
|
||||
/**
|
||||
* adding a container to the onRender list will make sure the user function
|
||||
* passed in to the user defined 'onRender` callBack
|
||||
* @param container - the container to add to the onRender list
|
||||
*/
|
||||
addOnRender(container) {
|
||||
this._onRenderContainers.push(container);
|
||||
}
|
||||
removeOnRender(container) {
|
||||
this._onRenderContainers.splice(this._onRenderContainers.indexOf(container), 1);
|
||||
}
|
||||
runOnRender() {
|
||||
for (let i = 0; i < this._onRenderContainers.length; i++) {
|
||||
this._onRenderContainers[i]._onRender();
|
||||
}
|
||||
}
|
||||
destroy() {
|
||||
this.renderGroupParent = null;
|
||||
this.root = null;
|
||||
this.childrenRenderablesToUpdate = null;
|
||||
this.childrenToUpdate = null;
|
||||
this.renderGroupChildren = null;
|
||||
this._onRenderContainers = null;
|
||||
this.instructionSet = null;
|
||||
}
|
||||
getChildren(out = []) {
|
||||
const children = this.root.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this._getChildren(children[i], out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
_getChildren(container, out = []) {
|
||||
out.push(container);
|
||||
if (container.renderGroup)
|
||||
return out;
|
||||
const children = container.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
this._getChildren(children[i], out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
export { RenderGroup };
|
||||
//# sourceMappingURL=RenderGroup.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/RenderGroup.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderGroup.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.d.ts
generated
vendored
Normal file
16
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions';
|
||||
import type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';
|
||||
import type { InstructionPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';
|
||||
import type { Renderer } from '../../rendering/renderers/types';
|
||||
import type { RenderGroup } from './RenderGroup';
|
||||
export declare class RenderGroupPipe implements InstructionPipe<RenderGroup> {
|
||||
static extension: {
|
||||
readonly type: readonly [ExtensionType.WebGLPipes, ExtensionType.WebGPUPipes, ExtensionType.CanvasPipes];
|
||||
readonly name: "renderGroup";
|
||||
};
|
||||
private _renderer;
|
||||
constructor(renderer: Renderer);
|
||||
addRenderGroup(renderGroup: RenderGroup, instructionSet: InstructionSet): void;
|
||||
execute(renderGroup: RenderGroup): void;
|
||||
destroy(): void;
|
||||
}
|
39
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.js
generated
vendored
Normal file
39
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../extensions/Extensions.js');
|
||||
var executeInstructions = require('./utils/executeInstructions.js');
|
||||
|
||||
"use strict";
|
||||
class RenderGroupPipe {
|
||||
constructor(renderer) {
|
||||
this._renderer = renderer;
|
||||
}
|
||||
addRenderGroup(renderGroup, instructionSet) {
|
||||
this._renderer.renderPipes.batch.break(instructionSet);
|
||||
instructionSet.add(renderGroup);
|
||||
}
|
||||
execute(renderGroup) {
|
||||
if (!renderGroup.isRenderable)
|
||||
return;
|
||||
this._renderer.globalUniforms.push({
|
||||
worldTransformMatrix: renderGroup.worldTransform,
|
||||
worldColor: renderGroup.worldColorAlpha
|
||||
});
|
||||
executeInstructions.executeInstructions(renderGroup, this._renderer.renderPipes);
|
||||
this._renderer.globalUniforms.pop();
|
||||
}
|
||||
destroy() {
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
RenderGroupPipe.extension = {
|
||||
type: [
|
||||
Extensions.ExtensionType.WebGLPipes,
|
||||
Extensions.ExtensionType.WebGPUPipes,
|
||||
Extensions.ExtensionType.CanvasPipes
|
||||
],
|
||||
name: "renderGroup"
|
||||
};
|
||||
|
||||
exports.RenderGroupPipe = RenderGroupPipe;
|
||||
//# sourceMappingURL=RenderGroupPipe.js.map
|
1
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RenderGroupPipe.js","sources":["../../../src/scene/container/RenderGroupPipe.ts"],"sourcesContent":["import { ExtensionType } from '../../extensions/Extensions';\nimport { executeInstructions } from './utils/executeInstructions';\n\nimport type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';\nimport type { InstructionPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';\nimport type { Renderer } from '../../rendering/renderers/types';\nimport type { RenderGroup } from './RenderGroup';\n\nexport class RenderGroupPipe implements InstructionPipe<RenderGroup>\n{\n public static extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes,\n ],\n name: 'renderGroup',\n } as const;\n\n private _renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this._renderer = renderer;\n }\n\n public addRenderGroup(renderGroup: RenderGroup, instructionSet: InstructionSet): void\n {\n this._renderer.renderPipes.batch.break(instructionSet);\n\n instructionSet.add(renderGroup);\n }\n\n public execute(renderGroup: RenderGroup)\n {\n if (!renderGroup.isRenderable) return;\n\n this._renderer.globalUniforms.push({\n worldTransformMatrix: renderGroup.worldTransform,\n worldColor: renderGroup.worldColorAlpha,\n });\n\n executeInstructions(renderGroup, this._renderer.renderPipes);\n\n this._renderer.globalUniforms.pop();\n\n // now render a quad..\n }\n\n public destroy(): void\n {\n this._renderer = null;\n }\n}\n"],"names":["executeInstructions","ExtensionType"],"mappings":";;;;;;AAQO,MAAM,eACb,CAAA;AAAA,EAYI,YAAY,QACZ,EAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AAAA,GACrB;AAAA,EAEO,cAAA,CAAe,aAA0B,cAChD,EAAA;AACI,IAAA,IAAA,CAAK,SAAU,CAAA,WAAA,CAAY,KAAM,CAAA,KAAA,CAAM,cAAc,CAAA,CAAA;AAErD,IAAA,cAAA,CAAe,IAAI,WAAW,CAAA,CAAA;AAAA,GAClC;AAAA,EAEO,QAAQ,WACf,EAAA;AACI,IAAA,IAAI,CAAC,WAAY,CAAA,YAAA;AAAc,MAAA,OAAA;AAE/B,IAAK,IAAA,CAAA,SAAA,CAAU,eAAe,IAAK,CAAA;AAAA,MAC/B,sBAAsB,WAAY,CAAA,cAAA;AAAA,MAClC,YAAY,WAAY,CAAA,eAAA;AAAA,KAC3B,CAAA,CAAA;AAED,IAAoBA,uCAAA,CAAA,WAAA,EAAa,IAAK,CAAA,SAAA,CAAU,WAAW,CAAA,CAAA;AAE3D,IAAK,IAAA,CAAA,SAAA,CAAU,eAAe,GAAI,EAAA,CAAA;AAAA,GAGtC;AAAA,EAEO,OACP,GAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAAA,GACrB;AACJ,CAAA;AA7Ca,eAAA,CAEK,SAAY,GAAA;AAAA,EACtB,IAAM,EAAA;AAAA,IACFC,wBAAc,CAAA,UAAA;AAAA,IACdA,wBAAc,CAAA,WAAA;AAAA,IACdA,wBAAc,CAAA,WAAA;AAAA,GAClB;AAAA,EACA,IAAM,EAAA,aAAA;AACV,CAAA;;;;"}
|
37
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.mjs
generated
vendored
Normal file
37
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.mjs
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions.mjs';
|
||||
import { executeInstructions } from './utils/executeInstructions.mjs';
|
||||
|
||||
"use strict";
|
||||
class RenderGroupPipe {
|
||||
constructor(renderer) {
|
||||
this._renderer = renderer;
|
||||
}
|
||||
addRenderGroup(renderGroup, instructionSet) {
|
||||
this._renderer.renderPipes.batch.break(instructionSet);
|
||||
instructionSet.add(renderGroup);
|
||||
}
|
||||
execute(renderGroup) {
|
||||
if (!renderGroup.isRenderable)
|
||||
return;
|
||||
this._renderer.globalUniforms.push({
|
||||
worldTransformMatrix: renderGroup.worldTransform,
|
||||
worldColor: renderGroup.worldColorAlpha
|
||||
});
|
||||
executeInstructions(renderGroup, this._renderer.renderPipes);
|
||||
this._renderer.globalUniforms.pop();
|
||||
}
|
||||
destroy() {
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
RenderGroupPipe.extension = {
|
||||
type: [
|
||||
ExtensionType.WebGLPipes,
|
||||
ExtensionType.WebGPUPipes,
|
||||
ExtensionType.CanvasPipes
|
||||
],
|
||||
name: "renderGroup"
|
||||
};
|
||||
|
||||
export { RenderGroupPipe };
|
||||
//# sourceMappingURL=RenderGroupPipe.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderGroupPipe.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RenderGroupPipe.mjs","sources":["../../../src/scene/container/RenderGroupPipe.ts"],"sourcesContent":["import { ExtensionType } from '../../extensions/Extensions';\nimport { executeInstructions } from './utils/executeInstructions';\n\nimport type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';\nimport type { InstructionPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';\nimport type { Renderer } from '../../rendering/renderers/types';\nimport type { RenderGroup } from './RenderGroup';\n\nexport class RenderGroupPipe implements InstructionPipe<RenderGroup>\n{\n public static extension = {\n type: [\n ExtensionType.WebGLPipes,\n ExtensionType.WebGPUPipes,\n ExtensionType.CanvasPipes,\n ],\n name: 'renderGroup',\n } as const;\n\n private _renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this._renderer = renderer;\n }\n\n public addRenderGroup(renderGroup: RenderGroup, instructionSet: InstructionSet): void\n {\n this._renderer.renderPipes.batch.break(instructionSet);\n\n instructionSet.add(renderGroup);\n }\n\n public execute(renderGroup: RenderGroup)\n {\n if (!renderGroup.isRenderable) return;\n\n this._renderer.globalUniforms.push({\n worldTransformMatrix: renderGroup.worldTransform,\n worldColor: renderGroup.worldColorAlpha,\n });\n\n executeInstructions(renderGroup, this._renderer.renderPipes);\n\n this._renderer.globalUniforms.pop();\n\n // now render a quad..\n }\n\n public destroy(): void\n {\n this._renderer = null;\n }\n}\n"],"names":[],"mappings":";;;;AAQO,MAAM,eACb,CAAA;AAAA,EAYI,YAAY,QACZ,EAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,QAAA,CAAA;AAAA,GACrB;AAAA,EAEO,cAAA,CAAe,aAA0B,cAChD,EAAA;AACI,IAAA,IAAA,CAAK,SAAU,CAAA,WAAA,CAAY,KAAM,CAAA,KAAA,CAAM,cAAc,CAAA,CAAA;AAErD,IAAA,cAAA,CAAe,IAAI,WAAW,CAAA,CAAA;AAAA,GAClC;AAAA,EAEO,QAAQ,WACf,EAAA;AACI,IAAA,IAAI,CAAC,WAAY,CAAA,YAAA;AAAc,MAAA,OAAA;AAE/B,IAAK,IAAA,CAAA,SAAA,CAAU,eAAe,IAAK,CAAA;AAAA,MAC/B,sBAAsB,WAAY,CAAA,cAAA;AAAA,MAClC,YAAY,WAAY,CAAA,eAAA;AAAA,KAC3B,CAAA,CAAA;AAED,IAAoB,mBAAA,CAAA,WAAA,EAAa,IAAK,CAAA,SAAA,CAAU,WAAW,CAAA,CAAA;AAE3D,IAAK,IAAA,CAAA,SAAA,CAAU,eAAe,GAAI,EAAA,CAAA;AAAA,GAGtC;AAAA,EAEO,OACP,GAAA;AACI,IAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAAA,GACrB;AACJ,CAAA;AA7Ca,eAAA,CAEK,SAAY,GAAA;AAAA,EACtB,IAAM,EAAA;AAAA,IACF,aAAc,CAAA,UAAA;AAAA,IACd,aAAc,CAAA,WAAA;AAAA,IACd,aAAc,CAAA,WAAA;AAAA,GAClB;AAAA,EACA,IAAM,EAAA,aAAA;AACV,CAAA;;;;"}
|
24
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.d.ts
generated
vendored
Normal file
24
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions';
|
||||
import { Matrix } from '../../maths/matrix/Matrix';
|
||||
import type { System } from '../../rendering/renderers/shared/system/System';
|
||||
import type { Renderer } from '../../rendering/renderers/types';
|
||||
import type { Container } from './Container';
|
||||
/**
|
||||
* The view system manages the main canvas that is attached to the DOM.
|
||||
* This main role is to deal with how the holding the view reference and dealing with how it is resized.
|
||||
* @memberof rendering
|
||||
*/
|
||||
export declare class RenderGroupSystem implements System {
|
||||
/** @ignore */
|
||||
static extension: {
|
||||
readonly type: readonly [ExtensionType.WebGLSystem, ExtensionType.WebGPUSystem, ExtensionType.CanvasSystem];
|
||||
readonly name: "renderGroup";
|
||||
};
|
||||
private readonly _renderer;
|
||||
constructor(renderer: Renderer);
|
||||
protected render({ container, transform }: {
|
||||
container: Container;
|
||||
transform: Matrix;
|
||||
}): void;
|
||||
destroy(): void;
|
||||
}
|
90
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.js
generated
vendored
Normal file
90
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../extensions/Extensions.js');
|
||||
var Matrix = require('../../maths/matrix/Matrix.js');
|
||||
var buildInstructions = require('./utils/buildInstructions.js');
|
||||
var clearList = require('./utils/clearList.js');
|
||||
var collectRenderGroups = require('./utils/collectRenderGroups.js');
|
||||
var executeInstructions = require('./utils/executeInstructions.js');
|
||||
var updateRenderGroupTransforms = require('./utils/updateRenderGroupTransforms.js');
|
||||
var validateRenderables = require('./utils/validateRenderables.js');
|
||||
|
||||
"use strict";
|
||||
const tempMatrix = new Matrix.Matrix();
|
||||
class RenderGroupSystem {
|
||||
constructor(renderer) {
|
||||
this._renderer = renderer;
|
||||
}
|
||||
render({ container, transform }) {
|
||||
container.isRenderGroup = true;
|
||||
const parent = container.parent;
|
||||
const renderGroupParent = container.renderGroup.renderGroupParent;
|
||||
container.parent = null;
|
||||
container.renderGroup.renderGroupParent = null;
|
||||
const renderer = this._renderer;
|
||||
const renderGroups = collectRenderGroups.collectRenderGroups(container.renderGroup, []);
|
||||
let originalLocalTransform = tempMatrix;
|
||||
if (transform) {
|
||||
originalLocalTransform = originalLocalTransform.copyFrom(container.renderGroup.localTransform);
|
||||
container.renderGroup.localTransform.copyFrom(transform);
|
||||
}
|
||||
const renderPipes = renderer.renderPipes;
|
||||
for (let i = 0; i < renderGroups.length; i++) {
|
||||
const renderGroup = renderGroups[i];
|
||||
renderGroup.runOnRender();
|
||||
renderGroup.instructionSet.renderPipes = renderPipes;
|
||||
if (!renderGroup.structureDidChange) {
|
||||
validateRenderables.validateRenderables(renderGroup, renderPipes);
|
||||
} else {
|
||||
clearList.clearList(renderGroup.childrenRenderablesToUpdate.list, 0);
|
||||
}
|
||||
updateRenderGroupTransforms.updateRenderGroupTransforms(renderGroup);
|
||||
if (renderGroup.structureDidChange) {
|
||||
renderGroup.structureDidChange = false;
|
||||
buildInstructions.buildInstructions(renderGroup, renderer);
|
||||
} else {
|
||||
updateRenderables(renderGroup);
|
||||
}
|
||||
renderGroup.childrenRenderablesToUpdate.index = 0;
|
||||
renderer.renderPipes.batch.upload(renderGroup.instructionSet);
|
||||
}
|
||||
renderer.globalUniforms.start({
|
||||
worldTransformMatrix: transform ? container.renderGroup.localTransform : container.renderGroup.worldTransform,
|
||||
worldColor: container.renderGroup.worldColorAlpha
|
||||
});
|
||||
executeInstructions.executeInstructions(container.renderGroup, renderPipes);
|
||||
if (renderPipes.uniformBatch) {
|
||||
renderPipes.uniformBatch.renderEnd();
|
||||
}
|
||||
if (transform) {
|
||||
container.renderGroup.localTransform.copyFrom(originalLocalTransform);
|
||||
}
|
||||
container.parent = parent;
|
||||
container.renderGroup.renderGroupParent = renderGroupParent;
|
||||
}
|
||||
destroy() {
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
RenderGroupSystem.extension = {
|
||||
type: [
|
||||
Extensions.ExtensionType.WebGLSystem,
|
||||
Extensions.ExtensionType.WebGPUSystem,
|
||||
Extensions.ExtensionType.CanvasSystem
|
||||
],
|
||||
name: "renderGroup"
|
||||
};
|
||||
function updateRenderables(renderGroup) {
|
||||
const { list, index } = renderGroup.childrenRenderablesToUpdate;
|
||||
for (let i = 0; i < index; i++) {
|
||||
const container = list[i];
|
||||
if (container.didViewUpdate) {
|
||||
renderGroup.updateRenderable(container);
|
||||
}
|
||||
}
|
||||
clearList.clearList(list, index);
|
||||
}
|
||||
|
||||
exports.RenderGroupSystem = RenderGroupSystem;
|
||||
//# sourceMappingURL=RenderGroupSystem.js.map
|
1
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
88
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.mjs
generated
vendored
Normal file
88
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.mjs
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions.mjs';
|
||||
import { Matrix } from '../../maths/matrix/Matrix.mjs';
|
||||
import { buildInstructions } from './utils/buildInstructions.mjs';
|
||||
import { clearList } from './utils/clearList.mjs';
|
||||
import { collectRenderGroups } from './utils/collectRenderGroups.mjs';
|
||||
import { executeInstructions } from './utils/executeInstructions.mjs';
|
||||
import { updateRenderGroupTransforms } from './utils/updateRenderGroupTransforms.mjs';
|
||||
import { validateRenderables } from './utils/validateRenderables.mjs';
|
||||
|
||||
"use strict";
|
||||
const tempMatrix = new Matrix();
|
||||
class RenderGroupSystem {
|
||||
constructor(renderer) {
|
||||
this._renderer = renderer;
|
||||
}
|
||||
render({ container, transform }) {
|
||||
container.isRenderGroup = true;
|
||||
const parent = container.parent;
|
||||
const renderGroupParent = container.renderGroup.renderGroupParent;
|
||||
container.parent = null;
|
||||
container.renderGroup.renderGroupParent = null;
|
||||
const renderer = this._renderer;
|
||||
const renderGroups = collectRenderGroups(container.renderGroup, []);
|
||||
let originalLocalTransform = tempMatrix;
|
||||
if (transform) {
|
||||
originalLocalTransform = originalLocalTransform.copyFrom(container.renderGroup.localTransform);
|
||||
container.renderGroup.localTransform.copyFrom(transform);
|
||||
}
|
||||
const renderPipes = renderer.renderPipes;
|
||||
for (let i = 0; i < renderGroups.length; i++) {
|
||||
const renderGroup = renderGroups[i];
|
||||
renderGroup.runOnRender();
|
||||
renderGroup.instructionSet.renderPipes = renderPipes;
|
||||
if (!renderGroup.structureDidChange) {
|
||||
validateRenderables(renderGroup, renderPipes);
|
||||
} else {
|
||||
clearList(renderGroup.childrenRenderablesToUpdate.list, 0);
|
||||
}
|
||||
updateRenderGroupTransforms(renderGroup);
|
||||
if (renderGroup.structureDidChange) {
|
||||
renderGroup.structureDidChange = false;
|
||||
buildInstructions(renderGroup, renderer);
|
||||
} else {
|
||||
updateRenderables(renderGroup);
|
||||
}
|
||||
renderGroup.childrenRenderablesToUpdate.index = 0;
|
||||
renderer.renderPipes.batch.upload(renderGroup.instructionSet);
|
||||
}
|
||||
renderer.globalUniforms.start({
|
||||
worldTransformMatrix: transform ? container.renderGroup.localTransform : container.renderGroup.worldTransform,
|
||||
worldColor: container.renderGroup.worldColorAlpha
|
||||
});
|
||||
executeInstructions(container.renderGroup, renderPipes);
|
||||
if (renderPipes.uniformBatch) {
|
||||
renderPipes.uniformBatch.renderEnd();
|
||||
}
|
||||
if (transform) {
|
||||
container.renderGroup.localTransform.copyFrom(originalLocalTransform);
|
||||
}
|
||||
container.parent = parent;
|
||||
container.renderGroup.renderGroupParent = renderGroupParent;
|
||||
}
|
||||
destroy() {
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
RenderGroupSystem.extension = {
|
||||
type: [
|
||||
ExtensionType.WebGLSystem,
|
||||
ExtensionType.WebGPUSystem,
|
||||
ExtensionType.CanvasSystem
|
||||
],
|
||||
name: "renderGroup"
|
||||
};
|
||||
function updateRenderables(renderGroup) {
|
||||
const { list, index } = renderGroup.childrenRenderablesToUpdate;
|
||||
for (let i = 0; i < index; i++) {
|
||||
const container = list[i];
|
||||
if (container.didViewUpdate) {
|
||||
renderGroup.updateRenderable(container);
|
||||
}
|
||||
}
|
||||
clearList(list, index);
|
||||
}
|
||||
|
||||
export { RenderGroupSystem };
|
||||
//# sourceMappingURL=RenderGroupSystem.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/RenderGroupSystem.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
145
node_modules/pixi.js/lib/scene/container/bounds/Bounds.d.ts
generated
vendored
Normal file
145
node_modules/pixi.js/lib/scene/container/bounds/Bounds.d.ts
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix';
|
||||
import { Rectangle } from '../../../maths/shapes/Rectangle';
|
||||
/**
|
||||
* Simple bounds implementation instead of more ambiguous [number, number, number, number]
|
||||
* @memberof rendering
|
||||
*/
|
||||
export interface BoundsData {
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
}
|
||||
/**
|
||||
* A representation of an AABB bounding box.
|
||||
* @memberof rendering
|
||||
*/
|
||||
export declare class Bounds {
|
||||
/** @default Infinity */
|
||||
minX: number;
|
||||
/** @default Infinity */
|
||||
minY: number;
|
||||
/** @default -Infinity */
|
||||
maxX: number;
|
||||
/** @default -Infinity */
|
||||
maxY: number;
|
||||
matrix: Matrix;
|
||||
private _rectangle;
|
||||
constructor(minX?: number, minY?: number, maxX?: number, maxY?: number);
|
||||
/**
|
||||
* Checks if bounds are empty.
|
||||
* @returns - True if empty.
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
/** The bounding rectangle of the bounds. */
|
||||
get rectangle(): Rectangle;
|
||||
/** Clears the bounds and resets. */
|
||||
clear(): this;
|
||||
/**
|
||||
* Sets the bounds.
|
||||
* @param x0 - left X of frame
|
||||
* @param y0 - top Y of frame
|
||||
* @param x1 - right X of frame
|
||||
* @param y1 - bottom Y of frame
|
||||
*/
|
||||
set(x0: number, y0: number, x1: number, y1: number): void;
|
||||
/**
|
||||
* Adds sprite frame
|
||||
* @param x0 - left X of frame
|
||||
* @param y0 - top Y of frame
|
||||
* @param x1 - right X of frame
|
||||
* @param y1 - bottom Y of frame
|
||||
* @param matrix
|
||||
*/
|
||||
addFrame(x0: number, y0: number, x1: number, y1: number, matrix?: Matrix): void;
|
||||
/**
|
||||
* Adds a rectangle to the bounds.
|
||||
* @param rect - The rectangle to be added.
|
||||
* @param matrix - The matrix to apply to the bounds.
|
||||
*/
|
||||
addRect(rect: Rectangle, matrix?: Matrix): void;
|
||||
/**
|
||||
* Adds other {@link Bounds}.
|
||||
* @param bounds - The Bounds to be added
|
||||
* @param matrix
|
||||
*/
|
||||
addBounds(bounds: BoundsData, matrix?: Matrix): void;
|
||||
/**
|
||||
* Adds other Bounds, masked with Bounds.
|
||||
* @param mask - The Bounds to be added.
|
||||
*/
|
||||
addBoundsMask(mask: Bounds): void;
|
||||
/**
|
||||
* Adds other Bounds, multiplied with matrix.
|
||||
* @param matrix - The matrix to apply to the bounds.
|
||||
*/
|
||||
applyMatrix(matrix: Matrix): void;
|
||||
/**
|
||||
* Resizes the bounds object to include the given rectangle.
|
||||
* @param rect - The rectangle to be included.
|
||||
*/
|
||||
fit(rect: Rectangle): this;
|
||||
/**
|
||||
* Resizes the bounds object to include the given bounds.
|
||||
* @param left - The left value of the bounds.
|
||||
* @param right - The right value of the bounds.
|
||||
* @param top - The top value of the bounds.
|
||||
* @param bottom - The bottom value of the bounds.
|
||||
*/
|
||||
fitBounds(left: number, right: number, top: number, bottom: number): this;
|
||||
/**
|
||||
* Pads bounds object, making it grow in all directions.
|
||||
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
||||
* @param paddingX - The horizontal padding amount.
|
||||
* @param paddingY - The vertical padding amount.
|
||||
*/
|
||||
pad(paddingX: number, paddingY?: number): this;
|
||||
/** Ceils the bounds. */
|
||||
ceil(): this;
|
||||
/** Clones the bounds. */
|
||||
clone(): Bounds;
|
||||
/**
|
||||
* Scales the bounds by the given values
|
||||
* @param x - The X value to scale by.
|
||||
* @param y - The Y value to scale by.
|
||||
*/
|
||||
scale(x: number, y?: number): this;
|
||||
/** the x value of the bounds. */
|
||||
get x(): number;
|
||||
set x(value: number);
|
||||
/** the y value of the bounds. */
|
||||
get y(): number;
|
||||
set y(value: number);
|
||||
/** the width value of the bounds. */
|
||||
get width(): number;
|
||||
set width(value: number);
|
||||
/** the height value of the bounds. */
|
||||
get height(): number;
|
||||
set height(value: number);
|
||||
/** the left value of the bounds. */
|
||||
get left(): number;
|
||||
/** the right value of the bounds. */
|
||||
get right(): number;
|
||||
/** the top value of the bounds. */
|
||||
get top(): number;
|
||||
/** the bottom value of the bounds. */
|
||||
get bottom(): number;
|
||||
/** Is the bounds positive. */
|
||||
get isPositive(): boolean;
|
||||
get isValid(): boolean;
|
||||
/**
|
||||
* Adds screen vertices from array
|
||||
* @param vertexData - calculated vertices
|
||||
* @param beginOffset - begin offset
|
||||
* @param endOffset - end offset, excluded
|
||||
* @param matrix
|
||||
*/
|
||||
addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number, matrix?: Matrix): void;
|
||||
/**
|
||||
* Checks if the point is contained within the bounds.
|
||||
* @param x - x coordinate
|
||||
* @param y - y coordinate
|
||||
*/
|
||||
containsPoint(x: number, y: number): boolean;
|
||||
toString(): string;
|
||||
}
|
371
node_modules/pixi.js/lib/scene/container/bounds/Bounds.js
generated
vendored
Normal file
371
node_modules/pixi.js/lib/scene/container/bounds/Bounds.js
generated
vendored
Normal file
@@ -0,0 +1,371 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var Rectangle = require('../../../maths/shapes/Rectangle.js');
|
||||
|
||||
"use strict";
|
||||
const defaultMatrix = new Matrix.Matrix();
|
||||
class Bounds {
|
||||
constructor(minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity) {
|
||||
/** @default Infinity */
|
||||
this.minX = Infinity;
|
||||
/** @default Infinity */
|
||||
this.minY = Infinity;
|
||||
/** @default -Infinity */
|
||||
this.maxX = -Infinity;
|
||||
/** @default -Infinity */
|
||||
this.maxY = -Infinity;
|
||||
this.matrix = defaultMatrix;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
/**
|
||||
* Checks if bounds are empty.
|
||||
* @returns - True if empty.
|
||||
*/
|
||||
isEmpty() {
|
||||
return this.minX > this.maxX || this.minY > this.maxY;
|
||||
}
|
||||
/** The bounding rectangle of the bounds. */
|
||||
get rectangle() {
|
||||
if (!this._rectangle) {
|
||||
this._rectangle = new Rectangle.Rectangle();
|
||||
}
|
||||
const rectangle = this._rectangle;
|
||||
if (this.minX > this.maxX || this.minY > this.maxY) {
|
||||
rectangle.x = 0;
|
||||
rectangle.y = 0;
|
||||
rectangle.width = 0;
|
||||
rectangle.height = 0;
|
||||
} else {
|
||||
rectangle.copyFromBounds(this);
|
||||
}
|
||||
return rectangle;
|
||||
}
|
||||
/** Clears the bounds and resets. */
|
||||
clear() {
|
||||
this.minX = Infinity;
|
||||
this.minY = Infinity;
|
||||
this.maxX = -Infinity;
|
||||
this.maxY = -Infinity;
|
||||
this.matrix = defaultMatrix;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets the bounds.
|
||||
* @param x0 - left X of frame
|
||||
* @param y0 - top Y of frame
|
||||
* @param x1 - right X of frame
|
||||
* @param y1 - bottom Y of frame
|
||||
*/
|
||||
set(x0, y0, x1, y1) {
|
||||
this.minX = x0;
|
||||
this.minY = y0;
|
||||
this.maxX = x1;
|
||||
this.maxY = y1;
|
||||
}
|
||||
/**
|
||||
* Adds sprite frame
|
||||
* @param x0 - left X of frame
|
||||
* @param y0 - top Y of frame
|
||||
* @param x1 - right X of frame
|
||||
* @param y1 - bottom Y of frame
|
||||
* @param matrix
|
||||
*/
|
||||
addFrame(x0, y0, x1, y1, matrix) {
|
||||
matrix || (matrix = this.matrix);
|
||||
const a = matrix.a;
|
||||
const b = matrix.b;
|
||||
const c = matrix.c;
|
||||
const d = matrix.d;
|
||||
const tx = matrix.tx;
|
||||
const ty = matrix.ty;
|
||||
let minX = this.minX;
|
||||
let minY = this.minY;
|
||||
let maxX = this.maxX;
|
||||
let maxY = this.maxY;
|
||||
let x = a * x0 + c * y0 + tx;
|
||||
let y = b * x0 + d * y0 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
x = a * x1 + c * y0 + tx;
|
||||
y = b * x1 + d * y0 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
x = a * x0 + c * y1 + tx;
|
||||
y = b * x0 + d * y1 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
x = a * x1 + c * y1 + tx;
|
||||
y = b * x1 + d * y1 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
/**
|
||||
* Adds a rectangle to the bounds.
|
||||
* @param rect - The rectangle to be added.
|
||||
* @param matrix - The matrix to apply to the bounds.
|
||||
*/
|
||||
addRect(rect, matrix) {
|
||||
this.addFrame(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, matrix);
|
||||
}
|
||||
/**
|
||||
* Adds other {@link Bounds}.
|
||||
* @param bounds - The Bounds to be added
|
||||
* @param matrix
|
||||
*/
|
||||
addBounds(bounds, matrix) {
|
||||
this.addFrame(bounds.minX, bounds.minY, bounds.maxX, bounds.maxY, matrix);
|
||||
}
|
||||
/**
|
||||
* Adds other Bounds, masked with Bounds.
|
||||
* @param mask - The Bounds to be added.
|
||||
*/
|
||||
addBoundsMask(mask) {
|
||||
this.minX = this.minX > mask.minX ? this.minX : mask.minX;
|
||||
this.minY = this.minY > mask.minY ? this.minY : mask.minY;
|
||||
this.maxX = this.maxX < mask.maxX ? this.maxX : mask.maxX;
|
||||
this.maxY = this.maxY < mask.maxY ? this.maxY : mask.maxY;
|
||||
}
|
||||
/**
|
||||
* Adds other Bounds, multiplied with matrix.
|
||||
* @param matrix - The matrix to apply to the bounds.
|
||||
*/
|
||||
applyMatrix(matrix) {
|
||||
const minX = this.minX;
|
||||
const minY = this.minY;
|
||||
const maxX = this.maxX;
|
||||
const maxY = this.maxY;
|
||||
const { a, b, c, d, tx, ty } = matrix;
|
||||
let x = a * minX + c * minY + tx;
|
||||
let y = b * minX + d * minY + ty;
|
||||
this.minX = x;
|
||||
this.minY = y;
|
||||
this.maxX = x;
|
||||
this.maxY = y;
|
||||
x = a * maxX + c * minY + tx;
|
||||
y = b * maxX + d * minY + ty;
|
||||
this.minX = x < this.minX ? x : this.minX;
|
||||
this.minY = y < this.minY ? y : this.minY;
|
||||
this.maxX = x > this.maxX ? x : this.maxX;
|
||||
this.maxY = y > this.maxY ? y : this.maxY;
|
||||
x = a * minX + c * maxY + tx;
|
||||
y = b * minX + d * maxY + ty;
|
||||
this.minX = x < this.minX ? x : this.minX;
|
||||
this.minY = y < this.minY ? y : this.minY;
|
||||
this.maxX = x > this.maxX ? x : this.maxX;
|
||||
this.maxY = y > this.maxY ? y : this.maxY;
|
||||
x = a * maxX + c * maxY + tx;
|
||||
y = b * maxX + d * maxY + ty;
|
||||
this.minX = x < this.minX ? x : this.minX;
|
||||
this.minY = y < this.minY ? y : this.minY;
|
||||
this.maxX = x > this.maxX ? x : this.maxX;
|
||||
this.maxY = y > this.maxY ? y : this.maxY;
|
||||
}
|
||||
/**
|
||||
* Resizes the bounds object to include the given rectangle.
|
||||
* @param rect - The rectangle to be included.
|
||||
*/
|
||||
fit(rect) {
|
||||
if (this.minX < rect.left)
|
||||
this.minX = rect.left;
|
||||
if (this.maxX > rect.right)
|
||||
this.maxX = rect.right;
|
||||
if (this.minY < rect.top)
|
||||
this.minY = rect.top;
|
||||
if (this.maxY > rect.bottom)
|
||||
this.maxY = rect.bottom;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Resizes the bounds object to include the given bounds.
|
||||
* @param left - The left value of the bounds.
|
||||
* @param right - The right value of the bounds.
|
||||
* @param top - The top value of the bounds.
|
||||
* @param bottom - The bottom value of the bounds.
|
||||
*/
|
||||
fitBounds(left, right, top, bottom) {
|
||||
if (this.minX < left)
|
||||
this.minX = left;
|
||||
if (this.maxX > right)
|
||||
this.maxX = right;
|
||||
if (this.minY < top)
|
||||
this.minY = top;
|
||||
if (this.maxY > bottom)
|
||||
this.maxY = bottom;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Pads bounds object, making it grow in all directions.
|
||||
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
||||
* @param paddingX - The horizontal padding amount.
|
||||
* @param paddingY - The vertical padding amount.
|
||||
*/
|
||||
pad(paddingX, paddingY = paddingX) {
|
||||
this.minX -= paddingX;
|
||||
this.maxX += paddingX;
|
||||
this.minY -= paddingY;
|
||||
this.maxY += paddingY;
|
||||
return this;
|
||||
}
|
||||
/** Ceils the bounds. */
|
||||
ceil() {
|
||||
this.minX = Math.floor(this.minX);
|
||||
this.minY = Math.floor(this.minY);
|
||||
this.maxX = Math.ceil(this.maxX);
|
||||
this.maxY = Math.ceil(this.maxY);
|
||||
return this;
|
||||
}
|
||||
/** Clones the bounds. */
|
||||
clone() {
|
||||
return new Bounds(this.minX, this.minY, this.maxX, this.maxY);
|
||||
}
|
||||
/**
|
||||
* Scales the bounds by the given values
|
||||
* @param x - The X value to scale by.
|
||||
* @param y - The Y value to scale by.
|
||||
*/
|
||||
scale(x, y = x) {
|
||||
this.minX *= x;
|
||||
this.minY *= y;
|
||||
this.maxX *= x;
|
||||
this.maxY *= y;
|
||||
return this;
|
||||
}
|
||||
/** the x value of the bounds. */
|
||||
get x() {
|
||||
return this.minX;
|
||||
}
|
||||
set x(value) {
|
||||
const width = this.maxX - this.minX;
|
||||
this.minX = value;
|
||||
this.maxX = value + width;
|
||||
}
|
||||
/** the y value of the bounds. */
|
||||
get y() {
|
||||
return this.minY;
|
||||
}
|
||||
set y(value) {
|
||||
const height = this.maxY - this.minY;
|
||||
this.minY = value;
|
||||
this.maxY = value + height;
|
||||
}
|
||||
/** the width value of the bounds. */
|
||||
get width() {
|
||||
return this.maxX - this.minX;
|
||||
}
|
||||
set width(value) {
|
||||
this.maxX = this.minX + value;
|
||||
}
|
||||
/** the height value of the bounds. */
|
||||
get height() {
|
||||
return this.maxY - this.minY;
|
||||
}
|
||||
set height(value) {
|
||||
this.maxY = this.minY + value;
|
||||
}
|
||||
/** the left value of the bounds. */
|
||||
get left() {
|
||||
return this.minX;
|
||||
}
|
||||
/** the right value of the bounds. */
|
||||
get right() {
|
||||
return this.maxX;
|
||||
}
|
||||
/** the top value of the bounds. */
|
||||
get top() {
|
||||
return this.minY;
|
||||
}
|
||||
/** the bottom value of the bounds. */
|
||||
get bottom() {
|
||||
return this.maxY;
|
||||
}
|
||||
/** Is the bounds positive. */
|
||||
get isPositive() {
|
||||
return this.maxX - this.minX > 0 && this.maxY - this.minY > 0;
|
||||
}
|
||||
get isValid() {
|
||||
return this.minX + this.minY !== Infinity;
|
||||
}
|
||||
/**
|
||||
* Adds screen vertices from array
|
||||
* @param vertexData - calculated vertices
|
||||
* @param beginOffset - begin offset
|
||||
* @param endOffset - end offset, excluded
|
||||
* @param matrix
|
||||
*/
|
||||
addVertexData(vertexData, beginOffset, endOffset, matrix) {
|
||||
let minX = this.minX;
|
||||
let minY = this.minY;
|
||||
let maxX = this.maxX;
|
||||
let maxY = this.maxY;
|
||||
matrix || (matrix = this.matrix);
|
||||
const a = matrix.a;
|
||||
const b = matrix.b;
|
||||
const c = matrix.c;
|
||||
const d = matrix.d;
|
||||
const tx = matrix.tx;
|
||||
const ty = matrix.ty;
|
||||
for (let i = beginOffset; i < endOffset; i += 2) {
|
||||
const localX = vertexData[i];
|
||||
const localY = vertexData[i + 1];
|
||||
const x = a * localX + c * localY + tx;
|
||||
const y = b * localX + d * localY + ty;
|
||||
minX = x < minX ? x : minX;
|
||||
minY = y < minY ? y : minY;
|
||||
maxX = x > maxX ? x : maxX;
|
||||
maxY = y > maxY ? y : maxY;
|
||||
}
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
/**
|
||||
* Checks if the point is contained within the bounds.
|
||||
* @param x - x coordinate
|
||||
* @param y - y coordinate
|
||||
*/
|
||||
containsPoint(x, y) {
|
||||
if (this.minX <= x && this.minY <= y && this.maxX >= x && this.maxY >= y) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Bounds = Bounds;
|
||||
//# sourceMappingURL=Bounds.js.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/Bounds.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/Bounds.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
369
node_modules/pixi.js/lib/scene/container/bounds/Bounds.mjs
generated
vendored
Normal file
369
node_modules/pixi.js/lib/scene/container/bounds/Bounds.mjs
generated
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { Rectangle } from '../../../maths/shapes/Rectangle.mjs';
|
||||
|
||||
"use strict";
|
||||
const defaultMatrix = new Matrix();
|
||||
class Bounds {
|
||||
constructor(minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity) {
|
||||
/** @default Infinity */
|
||||
this.minX = Infinity;
|
||||
/** @default Infinity */
|
||||
this.minY = Infinity;
|
||||
/** @default -Infinity */
|
||||
this.maxX = -Infinity;
|
||||
/** @default -Infinity */
|
||||
this.maxY = -Infinity;
|
||||
this.matrix = defaultMatrix;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
/**
|
||||
* Checks if bounds are empty.
|
||||
* @returns - True if empty.
|
||||
*/
|
||||
isEmpty() {
|
||||
return this.minX > this.maxX || this.minY > this.maxY;
|
||||
}
|
||||
/** The bounding rectangle of the bounds. */
|
||||
get rectangle() {
|
||||
if (!this._rectangle) {
|
||||
this._rectangle = new Rectangle();
|
||||
}
|
||||
const rectangle = this._rectangle;
|
||||
if (this.minX > this.maxX || this.minY > this.maxY) {
|
||||
rectangle.x = 0;
|
||||
rectangle.y = 0;
|
||||
rectangle.width = 0;
|
||||
rectangle.height = 0;
|
||||
} else {
|
||||
rectangle.copyFromBounds(this);
|
||||
}
|
||||
return rectangle;
|
||||
}
|
||||
/** Clears the bounds and resets. */
|
||||
clear() {
|
||||
this.minX = Infinity;
|
||||
this.minY = Infinity;
|
||||
this.maxX = -Infinity;
|
||||
this.maxY = -Infinity;
|
||||
this.matrix = defaultMatrix;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets the bounds.
|
||||
* @param x0 - left X of frame
|
||||
* @param y0 - top Y of frame
|
||||
* @param x1 - right X of frame
|
||||
* @param y1 - bottom Y of frame
|
||||
*/
|
||||
set(x0, y0, x1, y1) {
|
||||
this.minX = x0;
|
||||
this.minY = y0;
|
||||
this.maxX = x1;
|
||||
this.maxY = y1;
|
||||
}
|
||||
/**
|
||||
* Adds sprite frame
|
||||
* @param x0 - left X of frame
|
||||
* @param y0 - top Y of frame
|
||||
* @param x1 - right X of frame
|
||||
* @param y1 - bottom Y of frame
|
||||
* @param matrix
|
||||
*/
|
||||
addFrame(x0, y0, x1, y1, matrix) {
|
||||
matrix || (matrix = this.matrix);
|
||||
const a = matrix.a;
|
||||
const b = matrix.b;
|
||||
const c = matrix.c;
|
||||
const d = matrix.d;
|
||||
const tx = matrix.tx;
|
||||
const ty = matrix.ty;
|
||||
let minX = this.minX;
|
||||
let minY = this.minY;
|
||||
let maxX = this.maxX;
|
||||
let maxY = this.maxY;
|
||||
let x = a * x0 + c * y0 + tx;
|
||||
let y = b * x0 + d * y0 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
x = a * x1 + c * y0 + tx;
|
||||
y = b * x1 + d * y0 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
x = a * x0 + c * y1 + tx;
|
||||
y = b * x0 + d * y1 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
x = a * x1 + c * y1 + tx;
|
||||
y = b * x1 + d * y1 + ty;
|
||||
if (x < minX)
|
||||
minX = x;
|
||||
if (y < minY)
|
||||
minY = y;
|
||||
if (x > maxX)
|
||||
maxX = x;
|
||||
if (y > maxY)
|
||||
maxY = y;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
/**
|
||||
* Adds a rectangle to the bounds.
|
||||
* @param rect - The rectangle to be added.
|
||||
* @param matrix - The matrix to apply to the bounds.
|
||||
*/
|
||||
addRect(rect, matrix) {
|
||||
this.addFrame(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, matrix);
|
||||
}
|
||||
/**
|
||||
* Adds other {@link Bounds}.
|
||||
* @param bounds - The Bounds to be added
|
||||
* @param matrix
|
||||
*/
|
||||
addBounds(bounds, matrix) {
|
||||
this.addFrame(bounds.minX, bounds.minY, bounds.maxX, bounds.maxY, matrix);
|
||||
}
|
||||
/**
|
||||
* Adds other Bounds, masked with Bounds.
|
||||
* @param mask - The Bounds to be added.
|
||||
*/
|
||||
addBoundsMask(mask) {
|
||||
this.minX = this.minX > mask.minX ? this.minX : mask.minX;
|
||||
this.minY = this.minY > mask.minY ? this.minY : mask.minY;
|
||||
this.maxX = this.maxX < mask.maxX ? this.maxX : mask.maxX;
|
||||
this.maxY = this.maxY < mask.maxY ? this.maxY : mask.maxY;
|
||||
}
|
||||
/**
|
||||
* Adds other Bounds, multiplied with matrix.
|
||||
* @param matrix - The matrix to apply to the bounds.
|
||||
*/
|
||||
applyMatrix(matrix) {
|
||||
const minX = this.minX;
|
||||
const minY = this.minY;
|
||||
const maxX = this.maxX;
|
||||
const maxY = this.maxY;
|
||||
const { a, b, c, d, tx, ty } = matrix;
|
||||
let x = a * minX + c * minY + tx;
|
||||
let y = b * minX + d * minY + ty;
|
||||
this.minX = x;
|
||||
this.minY = y;
|
||||
this.maxX = x;
|
||||
this.maxY = y;
|
||||
x = a * maxX + c * minY + tx;
|
||||
y = b * maxX + d * minY + ty;
|
||||
this.minX = x < this.minX ? x : this.minX;
|
||||
this.minY = y < this.minY ? y : this.minY;
|
||||
this.maxX = x > this.maxX ? x : this.maxX;
|
||||
this.maxY = y > this.maxY ? y : this.maxY;
|
||||
x = a * minX + c * maxY + tx;
|
||||
y = b * minX + d * maxY + ty;
|
||||
this.minX = x < this.minX ? x : this.minX;
|
||||
this.minY = y < this.minY ? y : this.minY;
|
||||
this.maxX = x > this.maxX ? x : this.maxX;
|
||||
this.maxY = y > this.maxY ? y : this.maxY;
|
||||
x = a * maxX + c * maxY + tx;
|
||||
y = b * maxX + d * maxY + ty;
|
||||
this.minX = x < this.minX ? x : this.minX;
|
||||
this.minY = y < this.minY ? y : this.minY;
|
||||
this.maxX = x > this.maxX ? x : this.maxX;
|
||||
this.maxY = y > this.maxY ? y : this.maxY;
|
||||
}
|
||||
/**
|
||||
* Resizes the bounds object to include the given rectangle.
|
||||
* @param rect - The rectangle to be included.
|
||||
*/
|
||||
fit(rect) {
|
||||
if (this.minX < rect.left)
|
||||
this.minX = rect.left;
|
||||
if (this.maxX > rect.right)
|
||||
this.maxX = rect.right;
|
||||
if (this.minY < rect.top)
|
||||
this.minY = rect.top;
|
||||
if (this.maxY > rect.bottom)
|
||||
this.maxY = rect.bottom;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Resizes the bounds object to include the given bounds.
|
||||
* @param left - The left value of the bounds.
|
||||
* @param right - The right value of the bounds.
|
||||
* @param top - The top value of the bounds.
|
||||
* @param bottom - The bottom value of the bounds.
|
||||
*/
|
||||
fitBounds(left, right, top, bottom) {
|
||||
if (this.minX < left)
|
||||
this.minX = left;
|
||||
if (this.maxX > right)
|
||||
this.maxX = right;
|
||||
if (this.minY < top)
|
||||
this.minY = top;
|
||||
if (this.maxY > bottom)
|
||||
this.maxY = bottom;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Pads bounds object, making it grow in all directions.
|
||||
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
||||
* @param paddingX - The horizontal padding amount.
|
||||
* @param paddingY - The vertical padding amount.
|
||||
*/
|
||||
pad(paddingX, paddingY = paddingX) {
|
||||
this.minX -= paddingX;
|
||||
this.maxX += paddingX;
|
||||
this.minY -= paddingY;
|
||||
this.maxY += paddingY;
|
||||
return this;
|
||||
}
|
||||
/** Ceils the bounds. */
|
||||
ceil() {
|
||||
this.minX = Math.floor(this.minX);
|
||||
this.minY = Math.floor(this.minY);
|
||||
this.maxX = Math.ceil(this.maxX);
|
||||
this.maxY = Math.ceil(this.maxY);
|
||||
return this;
|
||||
}
|
||||
/** Clones the bounds. */
|
||||
clone() {
|
||||
return new Bounds(this.minX, this.minY, this.maxX, this.maxY);
|
||||
}
|
||||
/**
|
||||
* Scales the bounds by the given values
|
||||
* @param x - The X value to scale by.
|
||||
* @param y - The Y value to scale by.
|
||||
*/
|
||||
scale(x, y = x) {
|
||||
this.minX *= x;
|
||||
this.minY *= y;
|
||||
this.maxX *= x;
|
||||
this.maxY *= y;
|
||||
return this;
|
||||
}
|
||||
/** the x value of the bounds. */
|
||||
get x() {
|
||||
return this.minX;
|
||||
}
|
||||
set x(value) {
|
||||
const width = this.maxX - this.minX;
|
||||
this.minX = value;
|
||||
this.maxX = value + width;
|
||||
}
|
||||
/** the y value of the bounds. */
|
||||
get y() {
|
||||
return this.minY;
|
||||
}
|
||||
set y(value) {
|
||||
const height = this.maxY - this.minY;
|
||||
this.minY = value;
|
||||
this.maxY = value + height;
|
||||
}
|
||||
/** the width value of the bounds. */
|
||||
get width() {
|
||||
return this.maxX - this.minX;
|
||||
}
|
||||
set width(value) {
|
||||
this.maxX = this.minX + value;
|
||||
}
|
||||
/** the height value of the bounds. */
|
||||
get height() {
|
||||
return this.maxY - this.minY;
|
||||
}
|
||||
set height(value) {
|
||||
this.maxY = this.minY + value;
|
||||
}
|
||||
/** the left value of the bounds. */
|
||||
get left() {
|
||||
return this.minX;
|
||||
}
|
||||
/** the right value of the bounds. */
|
||||
get right() {
|
||||
return this.maxX;
|
||||
}
|
||||
/** the top value of the bounds. */
|
||||
get top() {
|
||||
return this.minY;
|
||||
}
|
||||
/** the bottom value of the bounds. */
|
||||
get bottom() {
|
||||
return this.maxY;
|
||||
}
|
||||
/** Is the bounds positive. */
|
||||
get isPositive() {
|
||||
return this.maxX - this.minX > 0 && this.maxY - this.minY > 0;
|
||||
}
|
||||
get isValid() {
|
||||
return this.minX + this.minY !== Infinity;
|
||||
}
|
||||
/**
|
||||
* Adds screen vertices from array
|
||||
* @param vertexData - calculated vertices
|
||||
* @param beginOffset - begin offset
|
||||
* @param endOffset - end offset, excluded
|
||||
* @param matrix
|
||||
*/
|
||||
addVertexData(vertexData, beginOffset, endOffset, matrix) {
|
||||
let minX = this.minX;
|
||||
let minY = this.minY;
|
||||
let maxX = this.maxX;
|
||||
let maxY = this.maxY;
|
||||
matrix || (matrix = this.matrix);
|
||||
const a = matrix.a;
|
||||
const b = matrix.b;
|
||||
const c = matrix.c;
|
||||
const d = matrix.d;
|
||||
const tx = matrix.tx;
|
||||
const ty = matrix.ty;
|
||||
for (let i = beginOffset; i < endOffset; i += 2) {
|
||||
const localX = vertexData[i];
|
||||
const localY = vertexData[i + 1];
|
||||
const x = a * localX + c * localY + tx;
|
||||
const y = b * localX + d * localY + ty;
|
||||
minX = x < minX ? x : minX;
|
||||
minY = y < minY ? y : minY;
|
||||
maxX = x > maxX ? x : maxX;
|
||||
maxY = y > maxY ? y : maxY;
|
||||
}
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
/**
|
||||
* Checks if the point is contained within the bounds.
|
||||
* @param x - x coordinate
|
||||
* @param y - y coordinate
|
||||
*/
|
||||
containsPoint(x, y) {
|
||||
if (this.minX <= x && this.minY <= y && this.maxX >= x && this.maxY >= y) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`;
|
||||
}
|
||||
}
|
||||
|
||||
export { Bounds };
|
||||
//# sourceMappingURL=Bounds.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/Bounds.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/Bounds.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.d.ts
generated
vendored
Normal file
13
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { Container } from '../Container';
|
||||
import type { Bounds } from './Bounds';
|
||||
/**
|
||||
* Does exactly the same as getGlobalBounds, but does instead makes use of transforming AABBs
|
||||
* of the various children within the scene graph. This is much faster, but less accurate.
|
||||
*
|
||||
* the result will never be smaller - only ever slightly larger (in most cases, it will be the same).
|
||||
* @param target - The target container to get the bounds from
|
||||
* @param bounds - The output bounds object.
|
||||
* @returns The bounds.
|
||||
*/
|
||||
export declare function getFastGlobalBounds(target: Container, bounds: Bounds): Bounds;
|
||||
export declare function _getGlobalBoundsRecursive(target: Container, bounds: Bounds): void;
|
73
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.js
generated
vendored
Normal file
73
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var matrixAndBoundsPool = require('./utils/matrixAndBoundsPool.js');
|
||||
|
||||
"use strict";
|
||||
const tempMatrix = new Matrix.Matrix();
|
||||
function getFastGlobalBounds(target, bounds) {
|
||||
bounds.clear();
|
||||
_getGlobalBoundsRecursive(target, bounds);
|
||||
if (!bounds.isValid) {
|
||||
bounds.set(0, 0, 0, 0);
|
||||
}
|
||||
if (!target.renderGroup) {
|
||||
bounds.applyMatrix(target.parentRenderGroup.worldTransform);
|
||||
} else {
|
||||
bounds.applyMatrix(target.renderGroup.localTransform);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
function _getGlobalBoundsRecursive(target, bounds) {
|
||||
if (target.localDisplayStatus !== 7 || !target.measurable) {
|
||||
return;
|
||||
}
|
||||
const manageEffects = !!target.effects.length;
|
||||
let localBounds = bounds;
|
||||
if (target.renderGroup || manageEffects) {
|
||||
localBounds = matrixAndBoundsPool.boundsPool.get().clear();
|
||||
}
|
||||
if (target.boundsArea) {
|
||||
bounds.addRect(target.boundsArea, target.worldTransform);
|
||||
} else {
|
||||
if (target.renderPipeId) {
|
||||
const viewBounds = target.bounds;
|
||||
localBounds.addFrame(
|
||||
viewBounds.minX,
|
||||
viewBounds.minY,
|
||||
viewBounds.maxX,
|
||||
viewBounds.maxY,
|
||||
target.groupTransform
|
||||
);
|
||||
}
|
||||
const children = target.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
_getGlobalBoundsRecursive(children[i], localBounds);
|
||||
}
|
||||
}
|
||||
if (manageEffects) {
|
||||
let advanced = false;
|
||||
for (let i = 0; i < target.effects.length; i++) {
|
||||
if (target.effects[i].addBounds) {
|
||||
if (!advanced) {
|
||||
advanced = true;
|
||||
localBounds.applyMatrix(target.parentRenderGroup.worldTransform);
|
||||
}
|
||||
target.effects[i].addBounds(localBounds, true);
|
||||
}
|
||||
}
|
||||
if (advanced) {
|
||||
localBounds.applyMatrix(target.parentRenderGroup.worldTransform.copyTo(tempMatrix).invert());
|
||||
bounds.addBounds(localBounds, target.relativeGroupTransform);
|
||||
}
|
||||
bounds.addBounds(localBounds);
|
||||
matrixAndBoundsPool.boundsPool.return(localBounds);
|
||||
} else if (target.renderGroup) {
|
||||
bounds.addBounds(localBounds, target.relativeGroupTransform);
|
||||
matrixAndBoundsPool.boundsPool.return(localBounds);
|
||||
}
|
||||
}
|
||||
|
||||
exports._getGlobalBoundsRecursive = _getGlobalBoundsRecursive;
|
||||
exports.getFastGlobalBounds = getFastGlobalBounds;
|
||||
//# sourceMappingURL=getFastGlobalBounds.js.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
70
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.mjs
generated
vendored
Normal file
70
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.mjs
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { boundsPool } from './utils/matrixAndBoundsPool.mjs';
|
||||
|
||||
"use strict";
|
||||
const tempMatrix = new Matrix();
|
||||
function getFastGlobalBounds(target, bounds) {
|
||||
bounds.clear();
|
||||
_getGlobalBoundsRecursive(target, bounds);
|
||||
if (!bounds.isValid) {
|
||||
bounds.set(0, 0, 0, 0);
|
||||
}
|
||||
if (!target.renderGroup) {
|
||||
bounds.applyMatrix(target.parentRenderGroup.worldTransform);
|
||||
} else {
|
||||
bounds.applyMatrix(target.renderGroup.localTransform);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
function _getGlobalBoundsRecursive(target, bounds) {
|
||||
if (target.localDisplayStatus !== 7 || !target.measurable) {
|
||||
return;
|
||||
}
|
||||
const manageEffects = !!target.effects.length;
|
||||
let localBounds = bounds;
|
||||
if (target.renderGroup || manageEffects) {
|
||||
localBounds = boundsPool.get().clear();
|
||||
}
|
||||
if (target.boundsArea) {
|
||||
bounds.addRect(target.boundsArea, target.worldTransform);
|
||||
} else {
|
||||
if (target.renderPipeId) {
|
||||
const viewBounds = target.bounds;
|
||||
localBounds.addFrame(
|
||||
viewBounds.minX,
|
||||
viewBounds.minY,
|
||||
viewBounds.maxX,
|
||||
viewBounds.maxY,
|
||||
target.groupTransform
|
||||
);
|
||||
}
|
||||
const children = target.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
_getGlobalBoundsRecursive(children[i], localBounds);
|
||||
}
|
||||
}
|
||||
if (manageEffects) {
|
||||
let advanced = false;
|
||||
for (let i = 0; i < target.effects.length; i++) {
|
||||
if (target.effects[i].addBounds) {
|
||||
if (!advanced) {
|
||||
advanced = true;
|
||||
localBounds.applyMatrix(target.parentRenderGroup.worldTransform);
|
||||
}
|
||||
target.effects[i].addBounds(localBounds, true);
|
||||
}
|
||||
}
|
||||
if (advanced) {
|
||||
localBounds.applyMatrix(target.parentRenderGroup.worldTransform.copyTo(tempMatrix).invert());
|
||||
bounds.addBounds(localBounds, target.relativeGroupTransform);
|
||||
}
|
||||
bounds.addBounds(localBounds);
|
||||
boundsPool.return(localBounds);
|
||||
} else if (target.renderGroup) {
|
||||
bounds.addBounds(localBounds, target.relativeGroupTransform);
|
||||
boundsPool.return(localBounds);
|
||||
}
|
||||
}
|
||||
|
||||
export { _getGlobalBoundsRecursive, getFastGlobalBounds };
|
||||
//# sourceMappingURL=getFastGlobalBounds.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getFastGlobalBounds.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix';
|
||||
import type { Container } from '../Container';
|
||||
import type { Bounds } from './Bounds';
|
||||
export declare function getGlobalBounds(target: Container, skipUpdateTransform: boolean, bounds: Bounds): Bounds;
|
||||
export declare function _getGlobalBounds(target: Container, bounds: Bounds, parentTransform: Matrix, skipUpdateTransform: boolean): void;
|
||||
export declare function updateTransformBackwards(target: Container, parentTransform: Matrix): Matrix;
|
81
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.js
generated
vendored
Normal file
81
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var matrixAndBoundsPool = require('./utils/matrixAndBoundsPool.js');
|
||||
|
||||
"use strict";
|
||||
function getGlobalBounds(target, skipUpdateTransform, bounds) {
|
||||
bounds.clear();
|
||||
let parentTransform;
|
||||
let pooledMatrix;
|
||||
if (target.parent) {
|
||||
if (!skipUpdateTransform) {
|
||||
pooledMatrix = matrixAndBoundsPool.matrixPool.get().identity();
|
||||
parentTransform = updateTransformBackwards(target, pooledMatrix);
|
||||
} else {
|
||||
parentTransform = target.parent.worldTransform;
|
||||
}
|
||||
} else {
|
||||
parentTransform = Matrix.Matrix.IDENTITY;
|
||||
}
|
||||
_getGlobalBounds(target, bounds, parentTransform, skipUpdateTransform);
|
||||
if (pooledMatrix) {
|
||||
matrixAndBoundsPool.matrixPool.return(pooledMatrix);
|
||||
}
|
||||
if (!bounds.isValid) {
|
||||
bounds.set(0, 0, 0, 0);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
function _getGlobalBounds(target, bounds, parentTransform, skipUpdateTransform) {
|
||||
if (!target.visible || !target.measurable)
|
||||
return;
|
||||
let worldTransform;
|
||||
if (!skipUpdateTransform) {
|
||||
target.updateLocalTransform();
|
||||
worldTransform = matrixAndBoundsPool.matrixPool.get();
|
||||
worldTransform.appendFrom(target.localTransform, parentTransform);
|
||||
} else {
|
||||
worldTransform = target.worldTransform;
|
||||
}
|
||||
const parentBounds = bounds;
|
||||
const preserveBounds = !!target.effects.length;
|
||||
if (preserveBounds) {
|
||||
bounds = matrixAndBoundsPool.boundsPool.get().clear();
|
||||
}
|
||||
if (target.boundsArea) {
|
||||
bounds.addRect(target.boundsArea, worldTransform);
|
||||
} else {
|
||||
if (target.addBounds) {
|
||||
bounds.matrix = worldTransform;
|
||||
target.addBounds(bounds);
|
||||
}
|
||||
for (let i = 0; i < target.children.length; i++) {
|
||||
_getGlobalBounds(target.children[i], bounds, worldTransform, skipUpdateTransform);
|
||||
}
|
||||
}
|
||||
if (preserveBounds) {
|
||||
for (let i = 0; i < target.effects.length; i++) {
|
||||
target.effects[i].addBounds?.(bounds);
|
||||
}
|
||||
parentBounds.addBounds(bounds, Matrix.Matrix.IDENTITY);
|
||||
matrixAndBoundsPool.boundsPool.return(bounds);
|
||||
}
|
||||
if (!skipUpdateTransform) {
|
||||
matrixAndBoundsPool.matrixPool.return(worldTransform);
|
||||
}
|
||||
}
|
||||
function updateTransformBackwards(target, parentTransform) {
|
||||
const parent = target.parent;
|
||||
if (parent) {
|
||||
updateTransformBackwards(parent, parentTransform);
|
||||
parent.updateLocalTransform();
|
||||
parentTransform.append(parent.localTransform);
|
||||
}
|
||||
return parentTransform;
|
||||
}
|
||||
|
||||
exports._getGlobalBounds = _getGlobalBounds;
|
||||
exports.getGlobalBounds = getGlobalBounds;
|
||||
exports.updateTransformBackwards = updateTransformBackwards;
|
||||
//# sourceMappingURL=getGlobalBounds.js.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
77
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.mjs
generated
vendored
Normal file
77
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.mjs
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { matrixPool, boundsPool } from './utils/matrixAndBoundsPool.mjs';
|
||||
|
||||
"use strict";
|
||||
function getGlobalBounds(target, skipUpdateTransform, bounds) {
|
||||
bounds.clear();
|
||||
let parentTransform;
|
||||
let pooledMatrix;
|
||||
if (target.parent) {
|
||||
if (!skipUpdateTransform) {
|
||||
pooledMatrix = matrixPool.get().identity();
|
||||
parentTransform = updateTransformBackwards(target, pooledMatrix);
|
||||
} else {
|
||||
parentTransform = target.parent.worldTransform;
|
||||
}
|
||||
} else {
|
||||
parentTransform = Matrix.IDENTITY;
|
||||
}
|
||||
_getGlobalBounds(target, bounds, parentTransform, skipUpdateTransform);
|
||||
if (pooledMatrix) {
|
||||
matrixPool.return(pooledMatrix);
|
||||
}
|
||||
if (!bounds.isValid) {
|
||||
bounds.set(0, 0, 0, 0);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
function _getGlobalBounds(target, bounds, parentTransform, skipUpdateTransform) {
|
||||
if (!target.visible || !target.measurable)
|
||||
return;
|
||||
let worldTransform;
|
||||
if (!skipUpdateTransform) {
|
||||
target.updateLocalTransform();
|
||||
worldTransform = matrixPool.get();
|
||||
worldTransform.appendFrom(target.localTransform, parentTransform);
|
||||
} else {
|
||||
worldTransform = target.worldTransform;
|
||||
}
|
||||
const parentBounds = bounds;
|
||||
const preserveBounds = !!target.effects.length;
|
||||
if (preserveBounds) {
|
||||
bounds = boundsPool.get().clear();
|
||||
}
|
||||
if (target.boundsArea) {
|
||||
bounds.addRect(target.boundsArea, worldTransform);
|
||||
} else {
|
||||
if (target.addBounds) {
|
||||
bounds.matrix = worldTransform;
|
||||
target.addBounds(bounds);
|
||||
}
|
||||
for (let i = 0; i < target.children.length; i++) {
|
||||
_getGlobalBounds(target.children[i], bounds, worldTransform, skipUpdateTransform);
|
||||
}
|
||||
}
|
||||
if (preserveBounds) {
|
||||
for (let i = 0; i < target.effects.length; i++) {
|
||||
target.effects[i].addBounds?.(bounds);
|
||||
}
|
||||
parentBounds.addBounds(bounds, Matrix.IDENTITY);
|
||||
boundsPool.return(bounds);
|
||||
}
|
||||
if (!skipUpdateTransform) {
|
||||
matrixPool.return(worldTransform);
|
||||
}
|
||||
}
|
||||
function updateTransformBackwards(target, parentTransform) {
|
||||
const parent = target.parent;
|
||||
if (parent) {
|
||||
updateTransformBackwards(parent, parentTransform);
|
||||
parent.updateLocalTransform();
|
||||
parentTransform.append(parent.localTransform);
|
||||
}
|
||||
return parentTransform;
|
||||
}
|
||||
|
||||
export { _getGlobalBounds, getGlobalBounds, updateTransformBackwards };
|
||||
//# sourceMappingURL=getGlobalBounds.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getGlobalBounds.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.d.ts
generated
vendored
Normal file
5
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix';
|
||||
import type { Container } from '../Container';
|
||||
import type { Bounds } from './Bounds';
|
||||
export declare function getLocalBounds(target: Container, bounds: Bounds, relativeMatrix?: Matrix): Bounds;
|
||||
export declare function getParent(target: Container, root: Container, matrix: Matrix): void;
|
71
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.js
generated
vendored
Normal file
71
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var warn = require('../../../utils/logging/warn.js');
|
||||
var matrixAndBoundsPool = require('./utils/matrixAndBoundsPool.js');
|
||||
|
||||
"use strict";
|
||||
function getLocalBounds(target, bounds, relativeMatrix) {
|
||||
bounds.clear();
|
||||
relativeMatrix || (relativeMatrix = Matrix.Matrix.IDENTITY);
|
||||
_getLocalBounds(target, bounds, relativeMatrix, target, true);
|
||||
if (!bounds.isValid) {
|
||||
bounds.set(0, 0, 0, 0);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
function _getLocalBounds(target, bounds, parentTransform, rootContainer, isRoot) {
|
||||
let relativeTransform;
|
||||
if (!isRoot) {
|
||||
if (!target.visible || !target.measurable)
|
||||
return;
|
||||
target.updateLocalTransform();
|
||||
const localTransform = target.localTransform;
|
||||
relativeTransform = matrixAndBoundsPool.matrixPool.get();
|
||||
relativeTransform.appendFrom(localTransform, parentTransform);
|
||||
} else {
|
||||
relativeTransform = matrixAndBoundsPool.matrixPool.get();
|
||||
relativeTransform = parentTransform.copyTo(relativeTransform);
|
||||
}
|
||||
const parentBounds = bounds;
|
||||
const preserveBounds = !!target.effects.length;
|
||||
if (preserveBounds) {
|
||||
bounds = matrixAndBoundsPool.boundsPool.get().clear();
|
||||
}
|
||||
if (target.boundsArea) {
|
||||
bounds.addRect(target.boundsArea, relativeTransform);
|
||||
} else {
|
||||
if (target.renderPipeId) {
|
||||
bounds.matrix = relativeTransform;
|
||||
target.addBounds(bounds);
|
||||
}
|
||||
const children = target.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
_getLocalBounds(children[i], bounds, relativeTransform, rootContainer, false);
|
||||
}
|
||||
}
|
||||
if (preserveBounds) {
|
||||
for (let i = 0; i < target.effects.length; i++) {
|
||||
target.effects[i].addLocalBounds?.(bounds, rootContainer);
|
||||
}
|
||||
parentBounds.addBounds(bounds, Matrix.Matrix.IDENTITY);
|
||||
matrixAndBoundsPool.boundsPool.return(bounds);
|
||||
}
|
||||
matrixAndBoundsPool.matrixPool.return(relativeTransform);
|
||||
}
|
||||
function getParent(target, root, matrix) {
|
||||
const parent = target.parent;
|
||||
if (!parent) {
|
||||
warn.warn("Item is not inside the root container");
|
||||
return;
|
||||
}
|
||||
if (parent !== root) {
|
||||
getParent(parent, root, matrix);
|
||||
parent.updateLocalTransform();
|
||||
matrix.append(parent.localTransform);
|
||||
}
|
||||
}
|
||||
|
||||
exports.getLocalBounds = getLocalBounds;
|
||||
exports.getParent = getParent;
|
||||
//# sourceMappingURL=getLocalBounds.js.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
68
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.mjs
generated
vendored
Normal file
68
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.mjs
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { warn } from '../../../utils/logging/warn.mjs';
|
||||
import { matrixPool, boundsPool } from './utils/matrixAndBoundsPool.mjs';
|
||||
|
||||
"use strict";
|
||||
function getLocalBounds(target, bounds, relativeMatrix) {
|
||||
bounds.clear();
|
||||
relativeMatrix || (relativeMatrix = Matrix.IDENTITY);
|
||||
_getLocalBounds(target, bounds, relativeMatrix, target, true);
|
||||
if (!bounds.isValid) {
|
||||
bounds.set(0, 0, 0, 0);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
function _getLocalBounds(target, bounds, parentTransform, rootContainer, isRoot) {
|
||||
let relativeTransform;
|
||||
if (!isRoot) {
|
||||
if (!target.visible || !target.measurable)
|
||||
return;
|
||||
target.updateLocalTransform();
|
||||
const localTransform = target.localTransform;
|
||||
relativeTransform = matrixPool.get();
|
||||
relativeTransform.appendFrom(localTransform, parentTransform);
|
||||
} else {
|
||||
relativeTransform = matrixPool.get();
|
||||
relativeTransform = parentTransform.copyTo(relativeTransform);
|
||||
}
|
||||
const parentBounds = bounds;
|
||||
const preserveBounds = !!target.effects.length;
|
||||
if (preserveBounds) {
|
||||
bounds = boundsPool.get().clear();
|
||||
}
|
||||
if (target.boundsArea) {
|
||||
bounds.addRect(target.boundsArea, relativeTransform);
|
||||
} else {
|
||||
if (target.renderPipeId) {
|
||||
bounds.matrix = relativeTransform;
|
||||
target.addBounds(bounds);
|
||||
}
|
||||
const children = target.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
_getLocalBounds(children[i], bounds, relativeTransform, rootContainer, false);
|
||||
}
|
||||
}
|
||||
if (preserveBounds) {
|
||||
for (let i = 0; i < target.effects.length; i++) {
|
||||
target.effects[i].addLocalBounds?.(bounds, rootContainer);
|
||||
}
|
||||
parentBounds.addBounds(bounds, Matrix.IDENTITY);
|
||||
boundsPool.return(bounds);
|
||||
}
|
||||
matrixPool.return(relativeTransform);
|
||||
}
|
||||
function getParent(target, root, matrix) {
|
||||
const parent = target.parent;
|
||||
if (!parent) {
|
||||
warn("Item is not inside the root container");
|
||||
return;
|
||||
}
|
||||
if (parent !== root) {
|
||||
getParent(parent, root, matrix);
|
||||
parent.updateLocalTransform();
|
||||
matrix.append(parent.localTransform);
|
||||
}
|
||||
}
|
||||
|
||||
export { getLocalBounds, getParent };
|
||||
//# sourceMappingURL=getLocalBounds.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getLocalBounds.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.d.ts
generated
vendored
Normal file
3
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Renderable } from '../../../rendering/renderers/shared/Renderable';
|
||||
import type { Bounds } from './Bounds';
|
||||
export declare function getGlobalRenderableBounds(renderables: Renderable[], bounds: Bounds): Bounds;
|
20
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.js
generated
vendored
Normal file
20
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function getGlobalRenderableBounds(renderables, bounds) {
|
||||
bounds.clear();
|
||||
const tempMatrix = bounds.matrix;
|
||||
for (let i = 0; i < renderables.length; i++) {
|
||||
const renderable = renderables[i];
|
||||
if (renderable.globalDisplayStatus < 7) {
|
||||
continue;
|
||||
}
|
||||
bounds.matrix = renderable.worldTransform;
|
||||
renderable.addBounds(bounds);
|
||||
}
|
||||
bounds.matrix = tempMatrix;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
exports.getGlobalRenderableBounds = getGlobalRenderableBounds;
|
||||
//# sourceMappingURL=getRenderableBounds.js.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getRenderableBounds.js","sources":["../../../../src/scene/container/bounds/getRenderableBounds.ts"],"sourcesContent":["import type { Renderable } from '../../../rendering/renderers/shared/Renderable';\nimport type { Bounds } from './Bounds';\n\nexport function getGlobalRenderableBounds(renderables: Renderable[], bounds: Bounds): Bounds\n{\n bounds.clear();\n\n // instead of copying the matrix each time we are assigning it in bounds\n // this is a performance hack :D\n // so we need to restore the matrix after we are done\n\n const tempMatrix = bounds.matrix;\n\n for (let i = 0; i < renderables.length; i++)\n {\n const renderable = renderables[i];\n\n if (renderable.globalDisplayStatus < 0b111)\n {\n continue;\n }\n\n bounds.matrix = renderable.worldTransform;\n renderable.addBounds(bounds);\n }\n\n bounds.matrix = tempMatrix;\n\n return bounds;\n}\n"],"names":[],"mappings":";;;AAGgB,SAAA,yBAAA,CAA0B,aAA2B,MACrE,EAAA;AACI,EAAA,MAAA,CAAO,KAAM,EAAA,CAAA;AAMb,EAAA,MAAM,aAAa,MAAO,CAAA,MAAA,CAAA;AAE1B,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,WAAA,CAAY,QAAQ,CACxC,EAAA,EAAA;AACI,IAAM,MAAA,UAAA,GAAa,YAAY,CAAC,CAAA,CAAA;AAEhC,IAAI,IAAA,UAAA,CAAW,sBAAsB,CACrC,EAAA;AACI,MAAA,SAAA;AAAA,KACJ;AAEA,IAAA,MAAA,CAAO,SAAS,UAAW,CAAA,cAAA,CAAA;AAC3B,IAAA,UAAA,CAAW,UAAU,MAAM,CAAA,CAAA;AAAA,GAC/B;AAEA,EAAA,MAAA,CAAO,MAAS,GAAA,UAAA,CAAA;AAEhB,EAAO,OAAA,MAAA,CAAA;AACX;;;;"}
|
18
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.mjs
generated
vendored
Normal file
18
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
function getGlobalRenderableBounds(renderables, bounds) {
|
||||
bounds.clear();
|
||||
const tempMatrix = bounds.matrix;
|
||||
for (let i = 0; i < renderables.length; i++) {
|
||||
const renderable = renderables[i];
|
||||
if (renderable.globalDisplayStatus < 7) {
|
||||
continue;
|
||||
}
|
||||
bounds.matrix = renderable.worldTransform;
|
||||
renderable.addBounds(bounds);
|
||||
}
|
||||
bounds.matrix = tempMatrix;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
export { getGlobalRenderableBounds };
|
||||
//# sourceMappingURL=getRenderableBounds.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getRenderableBounds.mjs","sources":["../../../../src/scene/container/bounds/getRenderableBounds.ts"],"sourcesContent":["import type { Renderable } from '../../../rendering/renderers/shared/Renderable';\nimport type { Bounds } from './Bounds';\n\nexport function getGlobalRenderableBounds(renderables: Renderable[], bounds: Bounds): Bounds\n{\n bounds.clear();\n\n // instead of copying the matrix each time we are assigning it in bounds\n // this is a performance hack :D\n // so we need to restore the matrix after we are done\n\n const tempMatrix = bounds.matrix;\n\n for (let i = 0; i < renderables.length; i++)\n {\n const renderable = renderables[i];\n\n if (renderable.globalDisplayStatus < 0b111)\n {\n continue;\n }\n\n bounds.matrix = renderable.worldTransform;\n renderable.addBounds(bounds);\n }\n\n bounds.matrix = tempMatrix;\n\n return bounds;\n}\n"],"names":[],"mappings":";AAGgB,SAAA,yBAAA,CAA0B,aAA2B,MACrE,EAAA;AACI,EAAA,MAAA,CAAO,KAAM,EAAA,CAAA;AAMb,EAAA,MAAM,aAAa,MAAO,CAAA,MAAA,CAAA;AAE1B,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,WAAA,CAAY,QAAQ,CACxC,EAAA,EAAA;AACI,IAAM,MAAA,UAAA,GAAa,YAAY,CAAC,CAAA,CAAA;AAEhC,IAAI,IAAA,UAAA,CAAW,sBAAsB,CACrC,EAAA;AACI,MAAA,SAAA;AAAA,KACJ;AAEA,IAAA,MAAA,CAAO,SAAS,UAAW,CAAA,cAAA,CAAA;AAC3B,IAAA,UAAA,CAAW,UAAU,MAAM,CAAA,CAAA;AAAA,GAC/B;AAEA,EAAA,MAAA,CAAO,MAAS,GAAA,UAAA,CAAA;AAEhB,EAAO,OAAA,MAAA,CAAA;AACX;;;;"}
|
9
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.d.ts
generated
vendored
Normal file
9
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Matrix } from '../../../../maths/matrix/Matrix';
|
||||
import { Pool } from '../../../../utils/pool/Pool';
|
||||
import { Bounds } from '../Bounds';
|
||||
import type { PoolItem } from '../../../../utils/pool/Pool';
|
||||
type MatrixPoolItem = Matrix & PoolItem;
|
||||
type BoundsPoolItem = Bounds & PoolItem;
|
||||
export declare const matrixPool: Pool<MatrixPoolItem>;
|
||||
export declare const boundsPool: Pool<BoundsPoolItem>;
|
||||
export {};
|
13
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.js
generated
vendored
Normal file
13
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../../maths/matrix/Matrix.js');
|
||||
var Pool = require('../../../../utils/pool/Pool.js');
|
||||
var Bounds = require('../Bounds.js');
|
||||
|
||||
"use strict";
|
||||
const matrixPool = new Pool.Pool(Matrix.Matrix);
|
||||
const boundsPool = new Pool.Pool(Bounds.Bounds);
|
||||
|
||||
exports.boundsPool = boundsPool;
|
||||
exports.matrixPool = matrixPool;
|
||||
//# sourceMappingURL=matrixAndBoundsPool.js.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"matrixAndBoundsPool.js","sources":["../../../../../src/scene/container/bounds/utils/matrixAndBoundsPool.ts"],"sourcesContent":["import { Matrix } from '../../../../maths/matrix/Matrix';\nimport { Pool } from '../../../../utils/pool/Pool';\nimport { Bounds } from '../Bounds';\n\nimport type { PoolItem } from '../../../../utils/pool/Pool';\n\ntype MatrixPoolItem = Matrix & PoolItem;\ntype BoundsPoolItem = Bounds & PoolItem;\nexport const matrixPool = new Pool<MatrixPoolItem>(Matrix);\nexport const boundsPool = new Pool<BoundsPoolItem>(Bounds);\n"],"names":["Pool","Matrix","Bounds"],"mappings":";;;;;;;AAQa,MAAA,UAAA,GAAa,IAAIA,SAAA,CAAqBC,aAAM,EAAA;AAC5C,MAAA,UAAA,GAAa,IAAID,SAAA,CAAqBE,aAAM;;;;;"}
|
10
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.mjs
generated
vendored
Normal file
10
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Matrix } from '../../../../maths/matrix/Matrix.mjs';
|
||||
import { Pool } from '../../../../utils/pool/Pool.mjs';
|
||||
import { Bounds } from '../Bounds.mjs';
|
||||
|
||||
"use strict";
|
||||
const matrixPool = new Pool(Matrix);
|
||||
const boundsPool = new Pool(Bounds);
|
||||
|
||||
export { boundsPool, matrixPool };
|
||||
//# sourceMappingURL=matrixAndBoundsPool.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/bounds/utils/matrixAndBoundsPool.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"matrixAndBoundsPool.mjs","sources":["../../../../../src/scene/container/bounds/utils/matrixAndBoundsPool.ts"],"sourcesContent":["import { Matrix } from '../../../../maths/matrix/Matrix';\nimport { Pool } from '../../../../utils/pool/Pool';\nimport { Bounds } from '../Bounds';\n\nimport type { PoolItem } from '../../../../utils/pool/Pool';\n\ntype MatrixPoolItem = Matrix & PoolItem;\ntype BoundsPoolItem = Bounds & PoolItem;\nexport const matrixPool = new Pool<MatrixPoolItem>(Matrix);\nexport const boundsPool = new Pool<BoundsPoolItem>(Bounds);\n"],"names":[],"mappings":";;;;;AAQa,MAAA,UAAA,GAAa,IAAI,IAAA,CAAqB,MAAM,EAAA;AAC5C,MAAA,UAAA,GAAa,IAAI,IAAA,CAAqB,MAAM;;;;"}
|
17
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts
generated
vendored
Normal file
17
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { Container, ContainerChild } from '../Container';
|
||||
export interface ChildrenHelperMixin<C = ContainerChild> {
|
||||
allowChildren: boolean;
|
||||
addChild<U extends C[]>(...children: U): U[0];
|
||||
removeChild<U extends C[]>(...children: U): U[0];
|
||||
removeChildren(beginIndex?: number, endIndex?: number): C[];
|
||||
removeChildAt<U extends C>(index: number): U;
|
||||
getChildAt<U extends C>(index: number): U;
|
||||
setChildIndex(child: C, index: number): void;
|
||||
getChildIndex(child: C): number;
|
||||
addChildAt<U extends C>(child: U, index: number): U;
|
||||
swapChildren<U extends C>(child: U, child2: U): void;
|
||||
removeFromParent(): void;
|
||||
reparentChild<U extends C[]>(...child: U): U[0];
|
||||
reparentChildAt<U extends C>(child: U, index: number): U;
|
||||
}
|
||||
export declare const childrenHelperMixin: Partial<Container>;
|
197
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.js
generated
vendored
Normal file
197
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
'use strict';
|
||||
|
||||
var removeItems = require('../../../utils/data/removeItems.js');
|
||||
var deprecation = require('../../../utils/logging/deprecation.js');
|
||||
|
||||
"use strict";
|
||||
const childrenHelperMixin = {
|
||||
allowChildren: true,
|
||||
/**
|
||||
* Removes all children from this container that are within the begin and end indexes.
|
||||
* @param beginIndex - The beginning position.
|
||||
* @param endIndex - The ending position. Default value is size of the container.
|
||||
* @returns - List of removed children
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
removeChildren(beginIndex = 0, endIndex) {
|
||||
const end = endIndex ?? this.children.length;
|
||||
const range = end - beginIndex;
|
||||
const removed = [];
|
||||
if (range > 0 && range <= end) {
|
||||
for (let i = end - 1; i >= beginIndex; i--) {
|
||||
const child = this.children[i];
|
||||
if (!child)
|
||||
continue;
|
||||
removed.push(child);
|
||||
child.parent = null;
|
||||
}
|
||||
removeItems.removeItems(this.children, beginIndex, end);
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.removeChildren(removed);
|
||||
}
|
||||
for (let i = 0; i < removed.length; ++i) {
|
||||
this.emit("childRemoved", removed[i], this, i);
|
||||
removed[i].emit("removed", this);
|
||||
}
|
||||
return removed;
|
||||
} else if (range === 0 && this.children.length === 0) {
|
||||
return removed;
|
||||
}
|
||||
throw new RangeError("removeChildren: numeric values are outside the acceptable range.");
|
||||
},
|
||||
/**
|
||||
* Removes a child from the specified index position.
|
||||
* @param index - The index to get the child from
|
||||
* @returns The child that was removed.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
removeChildAt(index) {
|
||||
const child = this.getChildAt(index);
|
||||
return this.removeChild(child);
|
||||
},
|
||||
/**
|
||||
* Returns the child at the specified index
|
||||
* @param index - The index to get the child at
|
||||
* @returns - The child at the given index, if any.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getChildAt(index) {
|
||||
if (index < 0 || index >= this.children.length) {
|
||||
throw new Error(`getChildAt: Index (${index}) does not exist.`);
|
||||
}
|
||||
return this.children[index];
|
||||
},
|
||||
/**
|
||||
* Changes the position of an existing child in the container container
|
||||
* @param child - The child Container instance for which you want to change the index number
|
||||
* @param index - The resulting index number for the child container
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
setChildIndex(child, index) {
|
||||
if (index < 0 || index >= this.children.length) {
|
||||
throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);
|
||||
}
|
||||
this.getChildIndex(child);
|
||||
this.addChildAt(child, index);
|
||||
},
|
||||
/**
|
||||
* Returns the index position of a child Container instance
|
||||
* @param child - The Container instance to identify
|
||||
* @returns - The index position of the child container to identify
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getChildIndex(child) {
|
||||
const index = this.children.indexOf(child);
|
||||
if (index === -1) {
|
||||
throw new Error("The supplied Container must be a child of the caller");
|
||||
}
|
||||
return index;
|
||||
},
|
||||
/**
|
||||
* Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown.
|
||||
* If the child is already in this container, it will be moved to the specified index.
|
||||
* @param {Container} child - The child to add.
|
||||
* @param {number} index - The absolute index where the child will be positioned at the end of the operation.
|
||||
* @returns {Container} The child that was added.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
addChildAt(child, index) {
|
||||
if (!this.allowChildren) {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "addChildAt: Only Containers will be allowed to add children in v8.0.0");
|
||||
}
|
||||
const { children } = this;
|
||||
if (index < 0 || index > children.length) {
|
||||
throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${children.length}`);
|
||||
}
|
||||
if (child.parent) {
|
||||
const currentIndex = child.parent.children.indexOf(child);
|
||||
if (child.parent === this && currentIndex === index) {
|
||||
return child;
|
||||
}
|
||||
if (currentIndex !== -1) {
|
||||
child.parent.children.splice(currentIndex, 1);
|
||||
}
|
||||
}
|
||||
if (index === children.length) {
|
||||
children.push(child);
|
||||
} else {
|
||||
children.splice(index, 0, child);
|
||||
}
|
||||
child.parent = this;
|
||||
child.didChange = true;
|
||||
child.didViewUpdate = false;
|
||||
child._updateFlags = 15;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.addChild(child);
|
||||
}
|
||||
if (this.sortableChildren)
|
||||
this.sortDirty = true;
|
||||
this.emit("childAdded", child, this, index);
|
||||
child.emit("added", this);
|
||||
return child;
|
||||
},
|
||||
/**
|
||||
* Swaps the position of 2 Containers within this container.
|
||||
* @param child - First container to swap
|
||||
* @param child2 - Second container to swap
|
||||
*/
|
||||
swapChildren(child, child2) {
|
||||
if (child === child2) {
|
||||
return;
|
||||
}
|
||||
const index1 = this.getChildIndex(child);
|
||||
const index2 = this.getChildIndex(child2);
|
||||
this.children[index1] = child2;
|
||||
this.children[index2] = child;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.structureDidChange = true;
|
||||
}
|
||||
this._didContainerChangeTick++;
|
||||
},
|
||||
/**
|
||||
* Remove the Container from its parent Container. If the Container has no parent, do nothing.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
removeFromParent() {
|
||||
this.parent?.removeChild(this);
|
||||
},
|
||||
/**
|
||||
* Reparent the child to this container, keeping the same worldTransform.
|
||||
* @param child - The child to reparent
|
||||
* @returns The first child that was reparented.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
reparentChild(...child) {
|
||||
if (child.length === 1) {
|
||||
return this.reparentChildAt(child[0], this.children.length);
|
||||
}
|
||||
child.forEach((c) => this.reparentChildAt(c, this.children.length));
|
||||
return child[0];
|
||||
},
|
||||
/**
|
||||
* Reparent the child to this container at the specified index, keeping the same worldTransform.
|
||||
* @param child - The child to reparent
|
||||
* @param index - The index to reparent the child to
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
reparentChildAt(child, index) {
|
||||
if (child.parent === this) {
|
||||
this.setChildIndex(child, index);
|
||||
return child;
|
||||
}
|
||||
const childMat = child.worldTransform.clone();
|
||||
child.removeFromParent();
|
||||
this.addChildAt(child, index);
|
||||
const newMatrix = this.worldTransform.clone();
|
||||
newMatrix.invert();
|
||||
childMat.prepend(newMatrix);
|
||||
child.setFromMatrix(childMat);
|
||||
return child;
|
||||
}
|
||||
};
|
||||
|
||||
exports.childrenHelperMixin = childrenHelperMixin;
|
||||
//# sourceMappingURL=childrenHelperMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
195
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.mjs
generated
vendored
Normal file
195
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
import { removeItems } from '../../../utils/data/removeItems.mjs';
|
||||
import { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';
|
||||
|
||||
"use strict";
|
||||
const childrenHelperMixin = {
|
||||
allowChildren: true,
|
||||
/**
|
||||
* Removes all children from this container that are within the begin and end indexes.
|
||||
* @param beginIndex - The beginning position.
|
||||
* @param endIndex - The ending position. Default value is size of the container.
|
||||
* @returns - List of removed children
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
removeChildren(beginIndex = 0, endIndex) {
|
||||
const end = endIndex ?? this.children.length;
|
||||
const range = end - beginIndex;
|
||||
const removed = [];
|
||||
if (range > 0 && range <= end) {
|
||||
for (let i = end - 1; i >= beginIndex; i--) {
|
||||
const child = this.children[i];
|
||||
if (!child)
|
||||
continue;
|
||||
removed.push(child);
|
||||
child.parent = null;
|
||||
}
|
||||
removeItems(this.children, beginIndex, end);
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.removeChildren(removed);
|
||||
}
|
||||
for (let i = 0; i < removed.length; ++i) {
|
||||
this.emit("childRemoved", removed[i], this, i);
|
||||
removed[i].emit("removed", this);
|
||||
}
|
||||
return removed;
|
||||
} else if (range === 0 && this.children.length === 0) {
|
||||
return removed;
|
||||
}
|
||||
throw new RangeError("removeChildren: numeric values are outside the acceptable range.");
|
||||
},
|
||||
/**
|
||||
* Removes a child from the specified index position.
|
||||
* @param index - The index to get the child from
|
||||
* @returns The child that was removed.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
removeChildAt(index) {
|
||||
const child = this.getChildAt(index);
|
||||
return this.removeChild(child);
|
||||
},
|
||||
/**
|
||||
* Returns the child at the specified index
|
||||
* @param index - The index to get the child at
|
||||
* @returns - The child at the given index, if any.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getChildAt(index) {
|
||||
if (index < 0 || index >= this.children.length) {
|
||||
throw new Error(`getChildAt: Index (${index}) does not exist.`);
|
||||
}
|
||||
return this.children[index];
|
||||
},
|
||||
/**
|
||||
* Changes the position of an existing child in the container container
|
||||
* @param child - The child Container instance for which you want to change the index number
|
||||
* @param index - The resulting index number for the child container
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
setChildIndex(child, index) {
|
||||
if (index < 0 || index >= this.children.length) {
|
||||
throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);
|
||||
}
|
||||
this.getChildIndex(child);
|
||||
this.addChildAt(child, index);
|
||||
},
|
||||
/**
|
||||
* Returns the index position of a child Container instance
|
||||
* @param child - The Container instance to identify
|
||||
* @returns - The index position of the child container to identify
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getChildIndex(child) {
|
||||
const index = this.children.indexOf(child);
|
||||
if (index === -1) {
|
||||
throw new Error("The supplied Container must be a child of the caller");
|
||||
}
|
||||
return index;
|
||||
},
|
||||
/**
|
||||
* Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown.
|
||||
* If the child is already in this container, it will be moved to the specified index.
|
||||
* @param {Container} child - The child to add.
|
||||
* @param {number} index - The absolute index where the child will be positioned at the end of the operation.
|
||||
* @returns {Container} The child that was added.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
addChildAt(child, index) {
|
||||
if (!this.allowChildren) {
|
||||
deprecation(v8_0_0, "addChildAt: Only Containers will be allowed to add children in v8.0.0");
|
||||
}
|
||||
const { children } = this;
|
||||
if (index < 0 || index > children.length) {
|
||||
throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${children.length}`);
|
||||
}
|
||||
if (child.parent) {
|
||||
const currentIndex = child.parent.children.indexOf(child);
|
||||
if (child.parent === this && currentIndex === index) {
|
||||
return child;
|
||||
}
|
||||
if (currentIndex !== -1) {
|
||||
child.parent.children.splice(currentIndex, 1);
|
||||
}
|
||||
}
|
||||
if (index === children.length) {
|
||||
children.push(child);
|
||||
} else {
|
||||
children.splice(index, 0, child);
|
||||
}
|
||||
child.parent = this;
|
||||
child.didChange = true;
|
||||
child.didViewUpdate = false;
|
||||
child._updateFlags = 15;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.addChild(child);
|
||||
}
|
||||
if (this.sortableChildren)
|
||||
this.sortDirty = true;
|
||||
this.emit("childAdded", child, this, index);
|
||||
child.emit("added", this);
|
||||
return child;
|
||||
},
|
||||
/**
|
||||
* Swaps the position of 2 Containers within this container.
|
||||
* @param child - First container to swap
|
||||
* @param child2 - Second container to swap
|
||||
*/
|
||||
swapChildren(child, child2) {
|
||||
if (child === child2) {
|
||||
return;
|
||||
}
|
||||
const index1 = this.getChildIndex(child);
|
||||
const index2 = this.getChildIndex(child2);
|
||||
this.children[index1] = child2;
|
||||
this.children[index2] = child;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.structureDidChange = true;
|
||||
}
|
||||
this._didContainerChangeTick++;
|
||||
},
|
||||
/**
|
||||
* Remove the Container from its parent Container. If the Container has no parent, do nothing.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
removeFromParent() {
|
||||
this.parent?.removeChild(this);
|
||||
},
|
||||
/**
|
||||
* Reparent the child to this container, keeping the same worldTransform.
|
||||
* @param child - The child to reparent
|
||||
* @returns The first child that was reparented.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
reparentChild(...child) {
|
||||
if (child.length === 1) {
|
||||
return this.reparentChildAt(child[0], this.children.length);
|
||||
}
|
||||
child.forEach((c) => this.reparentChildAt(c, this.children.length));
|
||||
return child[0];
|
||||
},
|
||||
/**
|
||||
* Reparent the child to this container at the specified index, keeping the same worldTransform.
|
||||
* @param child - The child to reparent
|
||||
* @param index - The index to reparent the child to
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
reparentChildAt(child, index) {
|
||||
if (child.parent === this) {
|
||||
this.setChildIndex(child, index);
|
||||
return child;
|
||||
}
|
||||
const childMat = child.worldTransform.clone();
|
||||
child.removeFromParent();
|
||||
this.addChildAt(child, index);
|
||||
const newMatrix = this.worldTransform.clone();
|
||||
newMatrix.invert();
|
||||
childMat.prepend(newMatrix);
|
||||
child.setFromMatrix(childMat);
|
||||
return child;
|
||||
}
|
||||
};
|
||||
|
||||
export { childrenHelperMixin };
|
||||
//# sourceMappingURL=childrenHelperMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/childrenHelperMixin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
19
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts
generated
vendored
Normal file
19
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { FilterEffect } from '../../../filters/FilterEffect';
|
||||
import type { Filter } from '../../../filters/Filter';
|
||||
import type { Rectangle } from '../../../maths/shapes/Rectangle';
|
||||
import type { MaskEffect } from '../../../rendering/mask/MaskEffectManager';
|
||||
import type { Container } from '../Container';
|
||||
import type { Effect } from '../Effect';
|
||||
export interface EffectsMixinConstructor {
|
||||
mask?: number | Container | null;
|
||||
filters?: Filter | Filter[];
|
||||
}
|
||||
export interface EffectsMixin extends Required<EffectsMixinConstructor> {
|
||||
_maskEffect?: MaskEffect;
|
||||
_filterEffect?: FilterEffect;
|
||||
filterArea?: Rectangle;
|
||||
effects?: Effect[];
|
||||
addEffect(effect: Effect): void;
|
||||
removeEffect(effect: Effect): void;
|
||||
}
|
||||
export declare const effectsMixin: Partial<Container>;
|
133
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.js
generated
vendored
Normal file
133
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
'use strict';
|
||||
|
||||
var FilterEffect = require('../../../filters/FilterEffect.js');
|
||||
var MaskEffectManager = require('../../../rendering/mask/MaskEffectManager.js');
|
||||
|
||||
"use strict";
|
||||
const effectsMixin = {
|
||||
_maskEffect: null,
|
||||
_filterEffect: null,
|
||||
/**
|
||||
* @todo Needs docs.
|
||||
* @memberof scene.Container#
|
||||
* @type {Array<Effect>}
|
||||
*/
|
||||
effects: [],
|
||||
/**
|
||||
* @todo Needs docs.
|
||||
* @param effect - The effect to add.
|
||||
* @memberof scene.Container#
|
||||
* @ignore
|
||||
*/
|
||||
addEffect(effect) {
|
||||
const index = this.effects.indexOf(effect);
|
||||
if (index !== -1)
|
||||
return;
|
||||
this.effects.push(effect);
|
||||
this.effects.sort((a, b) => a.priority - b.priority);
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateIsSimple();
|
||||
},
|
||||
/**
|
||||
* @todo Needs docs.
|
||||
* @param effect - The effect to remove.
|
||||
* @memberof scene.Container#
|
||||
* @ignore
|
||||
*/
|
||||
removeEffect(effect) {
|
||||
const index = this.effects.indexOf(effect);
|
||||
if (index === -1)
|
||||
return;
|
||||
this.effects.splice(index, 1);
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateIsSimple();
|
||||
},
|
||||
set mask(value) {
|
||||
const effect = this._maskEffect;
|
||||
if (effect?.mask === value)
|
||||
return;
|
||||
if (effect) {
|
||||
this.removeEffect(effect);
|
||||
MaskEffectManager.MaskEffectManager.returnMaskEffect(effect);
|
||||
this._maskEffect = null;
|
||||
}
|
||||
if (value === null || value === void 0)
|
||||
return;
|
||||
this._maskEffect = MaskEffectManager.MaskEffectManager.getMaskEffect(value);
|
||||
this.addEffect(this._maskEffect);
|
||||
},
|
||||
/**
|
||||
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an
|
||||
* object to the shape of the mask applied to it. In PixiJS a regular mask must be a
|
||||
* {@link Graphics} or a {@link Sprite} object. This allows for much faster masking in canvas as it
|
||||
* utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.
|
||||
* Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.
|
||||
* To remove a mask, set this property to `null`.
|
||||
*
|
||||
* For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
|
||||
* @example
|
||||
* import { Graphics, Sprite } from 'pixi.js';
|
||||
*
|
||||
* const graphics = new Graphics();
|
||||
* graphics.beginFill(0xFF3300);
|
||||
* graphics.drawRect(50, 250, 100, 100);
|
||||
* graphics.endFill();
|
||||
*
|
||||
* const sprite = new Sprite(texture);
|
||||
* sprite.mask = graphics;
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get mask() {
|
||||
return this._maskEffect?.mask;
|
||||
},
|
||||
set filters(value) {
|
||||
if (!Array.isArray(value) && value)
|
||||
value = [value];
|
||||
const effect = this._filterEffect || (this._filterEffect = new FilterEffect.FilterEffect());
|
||||
value = value;
|
||||
const hasFilters = value?.length > 0;
|
||||
const hadFilters = effect.filters?.length > 0;
|
||||
const didChange = hasFilters !== hadFilters;
|
||||
value = Array.isArray(value) ? value.slice(0) : value;
|
||||
effect.filters = Object.freeze(value);
|
||||
if (didChange) {
|
||||
if (hasFilters) {
|
||||
this.addEffect(effect);
|
||||
} else {
|
||||
this.removeEffect(effect);
|
||||
effect.filters = value ?? null;
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sets the filters for the displayObject.
|
||||
* IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.
|
||||
* To remove filters simply set this property to `'null'`.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get filters() {
|
||||
return this._filterEffect?.filters;
|
||||
},
|
||||
set filterArea(value) {
|
||||
this._filterEffect || (this._filterEffect = new FilterEffect.FilterEffect());
|
||||
this._filterEffect.filterArea = value;
|
||||
},
|
||||
/**
|
||||
* The area the filter is applied to. This is used as more of an optimization
|
||||
* rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.
|
||||
*
|
||||
* Also works as an interaction mask.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get filterArea() {
|
||||
return this._filterEffect?.filterArea;
|
||||
}
|
||||
};
|
||||
|
||||
exports.effectsMixin = effectsMixin;
|
||||
//# sourceMappingURL=effectsMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
131
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.mjs
generated
vendored
Normal file
131
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
import { FilterEffect } from '../../../filters/FilterEffect.mjs';
|
||||
import { MaskEffectManager } from '../../../rendering/mask/MaskEffectManager.mjs';
|
||||
|
||||
"use strict";
|
||||
const effectsMixin = {
|
||||
_maskEffect: null,
|
||||
_filterEffect: null,
|
||||
/**
|
||||
* @todo Needs docs.
|
||||
* @memberof scene.Container#
|
||||
* @type {Array<Effect>}
|
||||
*/
|
||||
effects: [],
|
||||
/**
|
||||
* @todo Needs docs.
|
||||
* @param effect - The effect to add.
|
||||
* @memberof scene.Container#
|
||||
* @ignore
|
||||
*/
|
||||
addEffect(effect) {
|
||||
const index = this.effects.indexOf(effect);
|
||||
if (index !== -1)
|
||||
return;
|
||||
this.effects.push(effect);
|
||||
this.effects.sort((a, b) => a.priority - b.priority);
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateIsSimple();
|
||||
},
|
||||
/**
|
||||
* @todo Needs docs.
|
||||
* @param effect - The effect to remove.
|
||||
* @memberof scene.Container#
|
||||
* @ignore
|
||||
*/
|
||||
removeEffect(effect) {
|
||||
const index = this.effects.indexOf(effect);
|
||||
if (index === -1)
|
||||
return;
|
||||
this.effects.splice(index, 1);
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
this._updateIsSimple();
|
||||
},
|
||||
set mask(value) {
|
||||
const effect = this._maskEffect;
|
||||
if (effect?.mask === value)
|
||||
return;
|
||||
if (effect) {
|
||||
this.removeEffect(effect);
|
||||
MaskEffectManager.returnMaskEffect(effect);
|
||||
this._maskEffect = null;
|
||||
}
|
||||
if (value === null || value === void 0)
|
||||
return;
|
||||
this._maskEffect = MaskEffectManager.getMaskEffect(value);
|
||||
this.addEffect(this._maskEffect);
|
||||
},
|
||||
/**
|
||||
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an
|
||||
* object to the shape of the mask applied to it. In PixiJS a regular mask must be a
|
||||
* {@link Graphics} or a {@link Sprite} object. This allows for much faster masking in canvas as it
|
||||
* utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.
|
||||
* Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.
|
||||
* To remove a mask, set this property to `null`.
|
||||
*
|
||||
* For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
|
||||
* @example
|
||||
* import { Graphics, Sprite } from 'pixi.js';
|
||||
*
|
||||
* const graphics = new Graphics();
|
||||
* graphics.beginFill(0xFF3300);
|
||||
* graphics.drawRect(50, 250, 100, 100);
|
||||
* graphics.endFill();
|
||||
*
|
||||
* const sprite = new Sprite(texture);
|
||||
* sprite.mask = graphics;
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get mask() {
|
||||
return this._maskEffect?.mask;
|
||||
},
|
||||
set filters(value) {
|
||||
if (!Array.isArray(value) && value)
|
||||
value = [value];
|
||||
const effect = this._filterEffect || (this._filterEffect = new FilterEffect());
|
||||
value = value;
|
||||
const hasFilters = value?.length > 0;
|
||||
const hadFilters = effect.filters?.length > 0;
|
||||
const didChange = hasFilters !== hadFilters;
|
||||
value = Array.isArray(value) ? value.slice(0) : value;
|
||||
effect.filters = Object.freeze(value);
|
||||
if (didChange) {
|
||||
if (hasFilters) {
|
||||
this.addEffect(effect);
|
||||
} else {
|
||||
this.removeEffect(effect);
|
||||
effect.filters = value ?? null;
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sets the filters for the displayObject.
|
||||
* IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.
|
||||
* To remove filters simply set this property to `'null'`.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get filters() {
|
||||
return this._filterEffect?.filters;
|
||||
},
|
||||
set filterArea(value) {
|
||||
this._filterEffect || (this._filterEffect = new FilterEffect());
|
||||
this._filterEffect.filterArea = value;
|
||||
},
|
||||
/**
|
||||
* The area the filter is applied to. This is used as more of an optimization
|
||||
* rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.
|
||||
*
|
||||
* Also works as an interaction mask.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get filterArea() {
|
||||
return this._filterEffect?.filterArea;
|
||||
}
|
||||
};
|
||||
|
||||
export { effectsMixin };
|
||||
//# sourceMappingURL=effectsMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts
generated
vendored
Normal file
15
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { Container } from '../Container';
|
||||
export interface FindMixinConstructor {
|
||||
label?: string;
|
||||
}
|
||||
export interface FindMixin extends Required<FindMixinConstructor> {
|
||||
/**
|
||||
* @deprecated since 8.0.0
|
||||
* @see Container#label
|
||||
*/
|
||||
name: string;
|
||||
getChildByName(label: RegExp | string, deep?: boolean): Container | null;
|
||||
getChildByLabel(label: RegExp | string, deep?: boolean): Container | null;
|
||||
getChildrenByLabel(label: RegExp | string, deep?: boolean, out?: Container[]): Container[];
|
||||
}
|
||||
export declare const findMixin: Partial<Container>;
|
93
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.js
generated
vendored
Normal file
93
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
'use strict';
|
||||
|
||||
var deprecation = require('../../../utils/logging/deprecation.js');
|
||||
|
||||
"use strict";
|
||||
const findMixin = {
|
||||
/**
|
||||
* The instance label of the object.
|
||||
* @memberof scene.Container#
|
||||
* @member {string} label
|
||||
*/
|
||||
label: null,
|
||||
/**
|
||||
* The instance name of the object.
|
||||
* @deprecated since 8.0.0
|
||||
* @see scene.Container#label
|
||||
* @member {string} name
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get name() {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "Container.name property has been removed, use Container.label instead");
|
||||
return this.label;
|
||||
},
|
||||
set name(value) {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "Container.name property has been removed, use Container.label instead");
|
||||
this.label = value;
|
||||
},
|
||||
/**
|
||||
* @method getChildByName
|
||||
* @deprecated since 8.0.0
|
||||
* @param {string} name - Instance name.
|
||||
* @param {boolean}[deep=false] - Whether to search recursively
|
||||
* @returns {Container} The child with the specified name.
|
||||
* @see scene.Container#getChildByLabel
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getChildByName(name, deep = false) {
|
||||
return this.getChildByLabel(name, deep);
|
||||
},
|
||||
/**
|
||||
* Returns the first child in the container with the specified label.
|
||||
*
|
||||
* Recursive searches are done in a pre-order traversal.
|
||||
* @memberof scene.Container#
|
||||
* @param {string|RegExp} label - Instance label.
|
||||
* @param {boolean}[deep=false] - Whether to search recursively
|
||||
* @returns {Container} The child with the specified label.
|
||||
*/
|
||||
getChildByLabel(label, deep = false) {
|
||||
const children = this.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
if (child.label === label || label instanceof RegExp && label.test(child.label))
|
||||
return child;
|
||||
}
|
||||
if (deep) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
const found = child.getChildByLabel(label, true);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
/**
|
||||
* Returns all children in the container with the specified label.
|
||||
* @memberof scene.Container#
|
||||
* @param {string|RegExp} label - Instance label.
|
||||
* @param {boolean}[deep=false] - Whether to search recursively
|
||||
* @param {Container[]} [out=[]] - The array to store matching children in.
|
||||
* @returns {Container[]} An array of children with the specified label.
|
||||
*/
|
||||
getChildrenByLabel(label, deep = false, out = []) {
|
||||
const children = this.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
if (child.label === label || label instanceof RegExp && label.test(child.label)) {
|
||||
out.push(child);
|
||||
}
|
||||
}
|
||||
if (deep) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
children[i].getChildrenByLabel(label, true, out);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
exports.findMixin = findMixin;
|
||||
//# sourceMappingURL=findMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
91
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.mjs
generated
vendored
Normal file
91
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import { deprecation, v8_0_0 } from '../../../utils/logging/deprecation.mjs';
|
||||
|
||||
"use strict";
|
||||
const findMixin = {
|
||||
/**
|
||||
* The instance label of the object.
|
||||
* @memberof scene.Container#
|
||||
* @member {string} label
|
||||
*/
|
||||
label: null,
|
||||
/**
|
||||
* The instance name of the object.
|
||||
* @deprecated since 8.0.0
|
||||
* @see scene.Container#label
|
||||
* @member {string} name
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get name() {
|
||||
deprecation(v8_0_0, "Container.name property has been removed, use Container.label instead");
|
||||
return this.label;
|
||||
},
|
||||
set name(value) {
|
||||
deprecation(v8_0_0, "Container.name property has been removed, use Container.label instead");
|
||||
this.label = value;
|
||||
},
|
||||
/**
|
||||
* @method getChildByName
|
||||
* @deprecated since 8.0.0
|
||||
* @param {string} name - Instance name.
|
||||
* @param {boolean}[deep=false] - Whether to search recursively
|
||||
* @returns {Container} The child with the specified name.
|
||||
* @see scene.Container#getChildByLabel
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getChildByName(name, deep = false) {
|
||||
return this.getChildByLabel(name, deep);
|
||||
},
|
||||
/**
|
||||
* Returns the first child in the container with the specified label.
|
||||
*
|
||||
* Recursive searches are done in a pre-order traversal.
|
||||
* @memberof scene.Container#
|
||||
* @param {string|RegExp} label - Instance label.
|
||||
* @param {boolean}[deep=false] - Whether to search recursively
|
||||
* @returns {Container} The child with the specified label.
|
||||
*/
|
||||
getChildByLabel(label, deep = false) {
|
||||
const children = this.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
if (child.label === label || label instanceof RegExp && label.test(child.label))
|
||||
return child;
|
||||
}
|
||||
if (deep) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
const found = child.getChildByLabel(label, true);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
/**
|
||||
* Returns all children in the container with the specified label.
|
||||
* @memberof scene.Container#
|
||||
* @param {string|RegExp} label - Instance label.
|
||||
* @param {boolean}[deep=false] - Whether to search recursively
|
||||
* @param {Container[]} [out=[]] - The array to store matching children in.
|
||||
* @returns {Container[]} An array of children with the specified label.
|
||||
*/
|
||||
getChildrenByLabel(label, deep = false, out = []) {
|
||||
const children = this.children;
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
if (child.label === label || label instanceof RegExp && label.test(child.label)) {
|
||||
out.push(child);
|
||||
}
|
||||
}
|
||||
if (deep) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
children[i].getChildrenByLabel(label, true, out);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
export { findMixin };
|
||||
//# sourceMappingURL=findMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/findMixin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
27
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.d.ts
generated
vendored
Normal file
27
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Bounds } from '../bounds/Bounds';
|
||||
import type { Size } from '../../../maths/misc/Size';
|
||||
import type { Container } from '../Container';
|
||||
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
export interface MeasureMixinConstructor {
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
export interface MeasureMixin extends Required<MeasureMixinConstructor> {
|
||||
getSize(out?: Size): Size;
|
||||
setSize(width: number, height?: number): void;
|
||||
setSize(value: Optional<Size, 'height'>): void;
|
||||
getLocalBounds(bounds?: Bounds): Bounds;
|
||||
getBounds(skipUpdate?: boolean, bounds?: Bounds): Bounds;
|
||||
_localBoundsCacheData: LocalBoundsCacheData;
|
||||
_localBoundsCacheId: number;
|
||||
_setWidth(width: number, localWidth: number): void;
|
||||
_setHeight(height: number, localHeight: number): void;
|
||||
}
|
||||
interface LocalBoundsCacheData {
|
||||
data: number[];
|
||||
index: number;
|
||||
didChange: boolean;
|
||||
localBounds: Bounds;
|
||||
}
|
||||
export declare const measureMixin: Partial<Container>;
|
||||
export {};
|
72
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.js
generated
vendored
Normal file
72
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var Bounds = require('../bounds/Bounds.js');
|
||||
var getGlobalBounds = require('../bounds/getGlobalBounds.js');
|
||||
var getLocalBounds = require('../bounds/getLocalBounds.js');
|
||||
var checkChildrenDidChange = require('../utils/checkChildrenDidChange.js');
|
||||
|
||||
"use strict";
|
||||
const tempMatrix = new Matrix.Matrix();
|
||||
const measureMixin = {
|
||||
_localBoundsCacheId: -1,
|
||||
_localBoundsCacheData: null,
|
||||
_setWidth(value, localWidth) {
|
||||
const sign = Math.sign(this.scale.x) || 1;
|
||||
if (localWidth !== 0) {
|
||||
this.scale.x = value / localWidth * sign;
|
||||
} else {
|
||||
this.scale.x = sign;
|
||||
}
|
||||
},
|
||||
_setHeight(value, localHeight) {
|
||||
const sign = Math.sign(this.scale.y) || 1;
|
||||
if (localHeight !== 0) {
|
||||
this.scale.y = value / localHeight * sign;
|
||||
} else {
|
||||
this.scale.y = sign;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Retrieves the local bounds of the container as a Bounds object.
|
||||
* @returns - The bounding area.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getLocalBounds() {
|
||||
if (!this._localBoundsCacheData) {
|
||||
this._localBoundsCacheData = {
|
||||
data: [],
|
||||
index: 1,
|
||||
didChange: false,
|
||||
localBounds: new Bounds.Bounds()
|
||||
};
|
||||
}
|
||||
const localBoundsCacheData = this._localBoundsCacheData;
|
||||
localBoundsCacheData.index = 1;
|
||||
localBoundsCacheData.didChange = false;
|
||||
if (localBoundsCacheData.data[0] !== this._didViewChangeTick) {
|
||||
localBoundsCacheData.didChange = true;
|
||||
localBoundsCacheData.data[0] = this._didViewChangeTick;
|
||||
}
|
||||
checkChildrenDidChange.checkChildrenDidChange(this, localBoundsCacheData);
|
||||
if (localBoundsCacheData.didChange) {
|
||||
getLocalBounds.getLocalBounds(this, localBoundsCacheData.localBounds, tempMatrix);
|
||||
}
|
||||
return localBoundsCacheData.localBounds;
|
||||
},
|
||||
/**
|
||||
* Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link Rectangle}.
|
||||
* @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from
|
||||
* being updated. This means the calculation returned MAY be out of date BUT will give you a
|
||||
* nice performance boost.
|
||||
* @param bounds - Optional bounds to store the result of the bounds calculation.
|
||||
* @returns - The minimum axis-aligned rectangle in world space that fits around this object.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getBounds(skipUpdate, bounds) {
|
||||
return getGlobalBounds.getGlobalBounds(this, skipUpdate, bounds || new Bounds.Bounds());
|
||||
}
|
||||
};
|
||||
|
||||
exports.measureMixin = measureMixin;
|
||||
//# sourceMappingURL=measureMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
70
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.mjs
generated
vendored
Normal file
70
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { Bounds } from '../bounds/Bounds.mjs';
|
||||
import { getGlobalBounds } from '../bounds/getGlobalBounds.mjs';
|
||||
import { getLocalBounds } from '../bounds/getLocalBounds.mjs';
|
||||
import { checkChildrenDidChange } from '../utils/checkChildrenDidChange.mjs';
|
||||
|
||||
"use strict";
|
||||
const tempMatrix = new Matrix();
|
||||
const measureMixin = {
|
||||
_localBoundsCacheId: -1,
|
||||
_localBoundsCacheData: null,
|
||||
_setWidth(value, localWidth) {
|
||||
const sign = Math.sign(this.scale.x) || 1;
|
||||
if (localWidth !== 0) {
|
||||
this.scale.x = value / localWidth * sign;
|
||||
} else {
|
||||
this.scale.x = sign;
|
||||
}
|
||||
},
|
||||
_setHeight(value, localHeight) {
|
||||
const sign = Math.sign(this.scale.y) || 1;
|
||||
if (localHeight !== 0) {
|
||||
this.scale.y = value / localHeight * sign;
|
||||
} else {
|
||||
this.scale.y = sign;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Retrieves the local bounds of the container as a Bounds object.
|
||||
* @returns - The bounding area.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getLocalBounds() {
|
||||
if (!this._localBoundsCacheData) {
|
||||
this._localBoundsCacheData = {
|
||||
data: [],
|
||||
index: 1,
|
||||
didChange: false,
|
||||
localBounds: new Bounds()
|
||||
};
|
||||
}
|
||||
const localBoundsCacheData = this._localBoundsCacheData;
|
||||
localBoundsCacheData.index = 1;
|
||||
localBoundsCacheData.didChange = false;
|
||||
if (localBoundsCacheData.data[0] !== this._didViewChangeTick) {
|
||||
localBoundsCacheData.didChange = true;
|
||||
localBoundsCacheData.data[0] = this._didViewChangeTick;
|
||||
}
|
||||
checkChildrenDidChange(this, localBoundsCacheData);
|
||||
if (localBoundsCacheData.didChange) {
|
||||
getLocalBounds(this, localBoundsCacheData.localBounds, tempMatrix);
|
||||
}
|
||||
return localBoundsCacheData.localBounds;
|
||||
},
|
||||
/**
|
||||
* Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link Rectangle}.
|
||||
* @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from
|
||||
* being updated. This means the calculation returned MAY be out of date BUT will give you a
|
||||
* nice performance boost.
|
||||
* @param bounds - Optional bounds to store the result of the bounds calculation.
|
||||
* @returns - The minimum axis-aligned rectangle in world space that fits around this object.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getBounds(skipUpdate, bounds) {
|
||||
return getGlobalBounds(this, skipUpdate, bounds || new Bounds());
|
||||
}
|
||||
};
|
||||
|
||||
export { measureMixin };
|
||||
//# sourceMappingURL=measureMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/measureMixin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.d.ts
generated
vendored
Normal file
8
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { Container } from '../Container';
|
||||
export interface OnRenderMixinConstructor {
|
||||
onRender?: (() => void | null);
|
||||
}
|
||||
export interface OnRenderMixin extends Required<OnRenderMixinConstructor> {
|
||||
_onRender: (() => void) | null;
|
||||
}
|
||||
export declare const onRenderMixin: Partial<Container>;
|
39
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.js
generated
vendored
Normal file
39
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const onRenderMixin = {
|
||||
_onRender: null,
|
||||
set onRender(func) {
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (!func) {
|
||||
if (this._onRender) {
|
||||
renderGroup?.removeOnRender(this);
|
||||
}
|
||||
this._onRender = null;
|
||||
return;
|
||||
}
|
||||
if (!this._onRender) {
|
||||
renderGroup?.addOnRender(this);
|
||||
}
|
||||
this._onRender = func;
|
||||
},
|
||||
/**
|
||||
* This callback is used when the container is rendered. This is where you should add your custom
|
||||
* logic that is needed to be run every frame.
|
||||
*
|
||||
* In v7 many users used `updateTransform` for this, however the way v8 renders objects is different
|
||||
* and "updateTransform" is no longer called every frame
|
||||
* @example
|
||||
* const container = new Container();
|
||||
* container.onRender = () => {
|
||||
* container.rotation += 0.01;
|
||||
* };
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get onRender() {
|
||||
return this._onRender;
|
||||
}
|
||||
};
|
||||
|
||||
exports.onRenderMixin = onRenderMixin;
|
||||
//# sourceMappingURL=onRenderMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"onRenderMixin.js","sources":["../../../../src/scene/container/container-mixins/onRenderMixin.ts"],"sourcesContent":["import type { Container } from '../Container';\n\nexport interface OnRenderMixinConstructor\n{\n onRender?: (() => void | null);\n}\nexport interface OnRenderMixin extends Required<OnRenderMixinConstructor>\n{\n _onRender: (() => void) | null;\n}\n\nexport const onRenderMixin: Partial<Container> = {\n _onRender: null,\n\n set onRender(func: () => void)\n {\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n\n if (!func)\n {\n if (this._onRender)\n {\n renderGroup?.removeOnRender(this);\n }\n\n this._onRender = null;\n\n return;\n }\n\n if (!this._onRender)\n {\n renderGroup?.addOnRender(this);\n }\n\n this._onRender = func;\n },\n\n /**\n * This callback is used when the container is rendered. This is where you should add your custom\n * logic that is needed to be run every frame.\n *\n * In v7 many users used `updateTransform` for this, however the way v8 renders objects is different\n * and \"updateTransform\" is no longer called every frame\n * @example\n * const container = new Container();\n * container.onRender = () => {\n * container.rotation += 0.01;\n * };\n * @memberof scene.Container#\n */\n get onRender(): () => void\n {\n return this._onRender;\n }\n} as Container;\n"],"names":[],"mappings":";;;AAWO,MAAM,aAAoC,GAAA;AAAA,EAC7C,SAAW,EAAA,IAAA;AAAA,EAEX,IAAI,SAAS,IACb,EAAA;AACI,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,IAAe,IAAK,CAAA,iBAAA,CAAA;AAE7C,IAAA,IAAI,CAAC,IACL,EAAA;AACI,MAAA,IAAI,KAAK,SACT,EAAA;AACI,QAAA,WAAA,EAAa,eAAe,IAAI,CAAA,CAAA;AAAA,OACpC;AAEA,MAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAEjB,MAAA,OAAA;AAAA,KACJ;AAEA,IAAI,IAAA,CAAC,KAAK,SACV,EAAA;AACI,MAAA,WAAA,EAAa,YAAY,IAAI,CAAA,CAAA;AAAA,KACjC;AAEA,IAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAAA,GACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,IAAI,QACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GAChB;AACJ;;;;"}
|
37
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.mjs
generated
vendored
Normal file
37
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
const onRenderMixin = {
|
||||
_onRender: null,
|
||||
set onRender(func) {
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (!func) {
|
||||
if (this._onRender) {
|
||||
renderGroup?.removeOnRender(this);
|
||||
}
|
||||
this._onRender = null;
|
||||
return;
|
||||
}
|
||||
if (!this._onRender) {
|
||||
renderGroup?.addOnRender(this);
|
||||
}
|
||||
this._onRender = func;
|
||||
},
|
||||
/**
|
||||
* This callback is used when the container is rendered. This is where you should add your custom
|
||||
* logic that is needed to be run every frame.
|
||||
*
|
||||
* In v7 many users used `updateTransform` for this, however the way v8 renders objects is different
|
||||
* and "updateTransform" is no longer called every frame
|
||||
* @example
|
||||
* const container = new Container();
|
||||
* container.onRender = () => {
|
||||
* container.rotation += 0.01;
|
||||
* };
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get onRender() {
|
||||
return this._onRender;
|
||||
}
|
||||
};
|
||||
|
||||
export { onRenderMixin };
|
||||
//# sourceMappingURL=onRenderMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/onRenderMixin.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"onRenderMixin.mjs","sources":["../../../../src/scene/container/container-mixins/onRenderMixin.ts"],"sourcesContent":["import type { Container } from '../Container';\n\nexport interface OnRenderMixinConstructor\n{\n onRender?: (() => void | null);\n}\nexport interface OnRenderMixin extends Required<OnRenderMixinConstructor>\n{\n _onRender: (() => void) | null;\n}\n\nexport const onRenderMixin: Partial<Container> = {\n _onRender: null,\n\n set onRender(func: () => void)\n {\n const renderGroup = this.renderGroup || this.parentRenderGroup;\n\n if (!func)\n {\n if (this._onRender)\n {\n renderGroup?.removeOnRender(this);\n }\n\n this._onRender = null;\n\n return;\n }\n\n if (!this._onRender)\n {\n renderGroup?.addOnRender(this);\n }\n\n this._onRender = func;\n },\n\n /**\n * This callback is used when the container is rendered. This is where you should add your custom\n * logic that is needed to be run every frame.\n *\n * In v7 many users used `updateTransform` for this, however the way v8 renders objects is different\n * and \"updateTransform\" is no longer called every frame\n * @example\n * const container = new Container();\n * container.onRender = () => {\n * container.rotation += 0.01;\n * };\n * @memberof scene.Container#\n */\n get onRender(): () => void\n {\n return this._onRender;\n }\n} as Container;\n"],"names":[],"mappings":";AAWO,MAAM,aAAoC,GAAA;AAAA,EAC7C,SAAW,EAAA,IAAA;AAAA,EAEX,IAAI,SAAS,IACb,EAAA;AACI,IAAM,MAAA,WAAA,GAAc,IAAK,CAAA,WAAA,IAAe,IAAK,CAAA,iBAAA,CAAA;AAE7C,IAAA,IAAI,CAAC,IACL,EAAA;AACI,MAAA,IAAI,KAAK,SACT,EAAA;AACI,QAAA,WAAA,EAAa,eAAe,IAAI,CAAA,CAAA;AAAA,OACpC;AAEA,MAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAEjB,MAAA,OAAA;AAAA,KACJ;AAEA,IAAI,IAAA,CAAC,KAAK,SACV,EAAA;AACI,MAAA,WAAA,EAAa,YAAY,IAAI,CAAA,CAAA;AAAA,KACjC;AAEA,IAAA,IAAA,CAAK,SAAY,GAAA,IAAA,CAAA;AAAA,GACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,IAAI,QACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GAChB;AACJ;;;;"}
|
12
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts
generated
vendored
Normal file
12
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Container } from '../Container';
|
||||
export interface SortMixinConstructor {
|
||||
zIndex?: number;
|
||||
sortDirty?: boolean;
|
||||
sortableChildren?: boolean;
|
||||
}
|
||||
export interface SortMixin extends Required<SortMixinConstructor> {
|
||||
_zIndex: number;
|
||||
sortChildren: () => void;
|
||||
depthOfChildModified: () => void;
|
||||
}
|
||||
export declare const sortMixin: Partial<Container>;
|
71
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.js
generated
vendored
Normal file
71
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const sortMixin = {
|
||||
_zIndex: 0,
|
||||
/**
|
||||
* Should children be sorted by zIndex at the next render call.
|
||||
*
|
||||
* Will get automatically set to true if a new child is added, or if a child's zIndex changes.
|
||||
* @type {boolean}
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
sortDirty: false,
|
||||
/**
|
||||
* If set to true, the container will sort its children by `zIndex` value
|
||||
* when the next render is called, or manually if `sortChildren()` is called.
|
||||
*
|
||||
* This actually changes the order of elements in the array, so should be treated
|
||||
* as a basic solution that is not performant compared to other solutions,
|
||||
* such as {@link https://github.com/pixijs/layers PixiJS Layers}
|
||||
*
|
||||
* Also be aware of that this may not work nicely with the `addChildAt()` function,
|
||||
* as the `zIndex` sorting may cause the child to automatically sorted to another position.
|
||||
* @type {boolean}
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
sortableChildren: false,
|
||||
/**
|
||||
* The zIndex of the container.
|
||||
*
|
||||
* Setting this value, will automatically set the parent to be sortable. Children will be automatically
|
||||
* sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
|
||||
* and thus rendered on top of other display objects within the same container.
|
||||
* @see scene.Container#sortableChildren
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get zIndex() {
|
||||
return this._zIndex;
|
||||
},
|
||||
set zIndex(value) {
|
||||
if (this._zIndex === value)
|
||||
return;
|
||||
this._zIndex = value;
|
||||
this.depthOfChildModified();
|
||||
},
|
||||
depthOfChildModified() {
|
||||
if (this.parent) {
|
||||
this.parent.sortableChildren = true;
|
||||
this.parent.sortDirty = true;
|
||||
}
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sorts children by zIndex.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
sortChildren() {
|
||||
if (!this.sortDirty)
|
||||
return;
|
||||
this.sortDirty = false;
|
||||
this.children.sort(sortChildren);
|
||||
}
|
||||
};
|
||||
function sortChildren(a, b) {
|
||||
return a._zIndex - b._zIndex;
|
||||
}
|
||||
|
||||
exports.sortMixin = sortMixin;
|
||||
//# sourceMappingURL=sortMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sortMixin.js","sources":["../../../../src/scene/container/container-mixins/sortMixin.ts"],"sourcesContent":["import type { Container } from '../Container';\n\nexport interface SortMixinConstructor\n{\n zIndex?: number;\n sortDirty?: boolean;\n sortableChildren?: boolean;\n}\nexport interface SortMixin extends Required<SortMixinConstructor>\n{\n _zIndex: number;\n\n sortChildren: () => void;\n depthOfChildModified: () => void;\n}\n\nexport const sortMixin: Partial<Container> = {\n _zIndex: 0,\n /**\n * Should children be sorted by zIndex at the next render call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n * @type {boolean}\n * @memberof scene.Container#\n */\n sortDirty: false,\n /**\n * If set to true, the container will sort its children by `zIndex` value\n * when the next render 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 * @type {boolean}\n * @memberof scene.Container#\n */\n sortableChildren: false,\n\n /**\n * The zIndex of the container.\n *\n * Setting this value, will automatically set the parent to be sortable. Children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see scene.Container#sortableChildren\n * @memberof scene.Container#\n */\n get zIndex()\n {\n return this._zIndex;\n },\n\n set zIndex(value: number)\n {\n if (this._zIndex === value) return;\n\n this._zIndex = value;\n\n this.depthOfChildModified();\n },\n\n depthOfChildModified()\n {\n if (this.parent)\n {\n this.parent.sortableChildren = true;\n this.parent.sortDirty = true;\n }\n\n if (this.parentRenderGroup)\n {\n this.parentRenderGroup.structureDidChange = true;\n }\n },\n\n /**\n * Sorts children by zIndex.\n * @memberof scene.Container#\n */\n sortChildren()\n {\n if (!this.sortDirty) return;\n\n this.sortDirty = false;\n\n this.children.sort(sortChildren);\n },\n} as Container;\n\nfunction sortChildren(a: Container, b: Container): number\n{\n return a._zIndex - b._zIndex;\n}\n"],"names":[],"mappings":";;;AAgBO,MAAM,SAAgC,GAAA;AAAA,EACzC,OAAS,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQT,SAAW,EAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcX,gBAAkB,EAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlB,IAAI,MACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GAChB;AAAA,EAEA,IAAI,OAAO,KACX,EAAA;AACI,IAAA,IAAI,KAAK,OAAY,KAAA,KAAA;AAAO,MAAA,OAAA;AAE5B,IAAA,IAAA,CAAK,OAAU,GAAA,KAAA,CAAA;AAEf,IAAA,IAAA,CAAK,oBAAqB,EAAA,CAAA;AAAA,GAC9B;AAAA,EAEA,oBACA,GAAA;AACI,IAAA,IAAI,KAAK,MACT,EAAA;AACI,MAAA,IAAA,CAAK,OAAO,gBAAmB,GAAA,IAAA,CAAA;AAC/B,MAAA,IAAA,CAAK,OAAO,SAAY,GAAA,IAAA,CAAA;AAAA,KAC5B;AAEA,IAAA,IAAI,KAAK,iBACT,EAAA;AACI,MAAA,IAAA,CAAK,kBAAkB,kBAAqB,GAAA,IAAA,CAAA;AAAA,KAChD;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YACA,GAAA;AACI,IAAA,IAAI,CAAC,IAAK,CAAA,SAAA;AAAW,MAAA,OAAA;AAErB,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA,CAAA;AAEjB,IAAK,IAAA,CAAA,QAAA,CAAS,KAAK,YAAY,CAAA,CAAA;AAAA,GACnC;AACJ,EAAA;AAEA,SAAS,YAAA,CAAa,GAAc,CACpC,EAAA;AACI,EAAO,OAAA,CAAA,CAAE,UAAU,CAAE,CAAA,OAAA,CAAA;AACzB;;;;"}
|
69
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.mjs
generated
vendored
Normal file
69
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
const sortMixin = {
|
||||
_zIndex: 0,
|
||||
/**
|
||||
* Should children be sorted by zIndex at the next render call.
|
||||
*
|
||||
* Will get automatically set to true if a new child is added, or if a child's zIndex changes.
|
||||
* @type {boolean}
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
sortDirty: false,
|
||||
/**
|
||||
* If set to true, the container will sort its children by `zIndex` value
|
||||
* when the next render is called, or manually if `sortChildren()` is called.
|
||||
*
|
||||
* This actually changes the order of elements in the array, so should be treated
|
||||
* as a basic solution that is not performant compared to other solutions,
|
||||
* such as {@link https://github.com/pixijs/layers PixiJS Layers}
|
||||
*
|
||||
* Also be aware of that this may not work nicely with the `addChildAt()` function,
|
||||
* as the `zIndex` sorting may cause the child to automatically sorted to another position.
|
||||
* @type {boolean}
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
sortableChildren: false,
|
||||
/**
|
||||
* The zIndex of the container.
|
||||
*
|
||||
* Setting this value, will automatically set the parent to be sortable. Children will be automatically
|
||||
* sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
|
||||
* and thus rendered on top of other display objects within the same container.
|
||||
* @see scene.Container#sortableChildren
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
get zIndex() {
|
||||
return this._zIndex;
|
||||
},
|
||||
set zIndex(value) {
|
||||
if (this._zIndex === value)
|
||||
return;
|
||||
this._zIndex = value;
|
||||
this.depthOfChildModified();
|
||||
},
|
||||
depthOfChildModified() {
|
||||
if (this.parent) {
|
||||
this.parent.sortableChildren = true;
|
||||
this.parent.sortDirty = true;
|
||||
}
|
||||
if (this.parentRenderGroup) {
|
||||
this.parentRenderGroup.structureDidChange = true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sorts children by zIndex.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
sortChildren() {
|
||||
if (!this.sortDirty)
|
||||
return;
|
||||
this.sortDirty = false;
|
||||
this.children.sort(sortChildren);
|
||||
}
|
||||
};
|
||||
function sortChildren(a, b) {
|
||||
return a._zIndex - b._zIndex;
|
||||
}
|
||||
|
||||
export { sortMixin };
|
||||
//# sourceMappingURL=sortMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/sortMixin.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sortMixin.mjs","sources":["../../../../src/scene/container/container-mixins/sortMixin.ts"],"sourcesContent":["import type { Container } from '../Container';\n\nexport interface SortMixinConstructor\n{\n zIndex?: number;\n sortDirty?: boolean;\n sortableChildren?: boolean;\n}\nexport interface SortMixin extends Required<SortMixinConstructor>\n{\n _zIndex: number;\n\n sortChildren: () => void;\n depthOfChildModified: () => void;\n}\n\nexport const sortMixin: Partial<Container> = {\n _zIndex: 0,\n /**\n * Should children be sorted by zIndex at the next render call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n * @type {boolean}\n * @memberof scene.Container#\n */\n sortDirty: false,\n /**\n * If set to true, the container will sort its children by `zIndex` value\n * when the next render 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 * @type {boolean}\n * @memberof scene.Container#\n */\n sortableChildren: false,\n\n /**\n * The zIndex of the container.\n *\n * Setting this value, will automatically set the parent to be sortable. Children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see scene.Container#sortableChildren\n * @memberof scene.Container#\n */\n get zIndex()\n {\n return this._zIndex;\n },\n\n set zIndex(value: number)\n {\n if (this._zIndex === value) return;\n\n this._zIndex = value;\n\n this.depthOfChildModified();\n },\n\n depthOfChildModified()\n {\n if (this.parent)\n {\n this.parent.sortableChildren = true;\n this.parent.sortDirty = true;\n }\n\n if (this.parentRenderGroup)\n {\n this.parentRenderGroup.structureDidChange = true;\n }\n },\n\n /**\n * Sorts children by zIndex.\n * @memberof scene.Container#\n */\n sortChildren()\n {\n if (!this.sortDirty) return;\n\n this.sortDirty = false;\n\n this.children.sort(sortChildren);\n },\n} as Container;\n\nfunction sortChildren(a: Container, b: Container): number\n{\n return a._zIndex - b._zIndex;\n}\n"],"names":[],"mappings":";AAgBO,MAAM,SAAgC,GAAA;AAAA,EACzC,OAAS,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQT,SAAW,EAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcX,gBAAkB,EAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlB,IAAI,MACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GAChB;AAAA,EAEA,IAAI,OAAO,KACX,EAAA;AACI,IAAA,IAAI,KAAK,OAAY,KAAA,KAAA;AAAO,MAAA,OAAA;AAE5B,IAAA,IAAA,CAAK,OAAU,GAAA,KAAA,CAAA;AAEf,IAAA,IAAA,CAAK,oBAAqB,EAAA,CAAA;AAAA,GAC9B;AAAA,EAEA,oBACA,GAAA;AACI,IAAA,IAAI,KAAK,MACT,EAAA;AACI,MAAA,IAAA,CAAK,OAAO,gBAAmB,GAAA,IAAA,CAAA;AAC/B,MAAA,IAAA,CAAK,OAAO,SAAY,GAAA,IAAA,CAAA;AAAA,KAC5B;AAEA,IAAA,IAAI,KAAK,iBACT,EAAA;AACI,MAAA,IAAA,CAAK,kBAAkB,kBAAqB,GAAA,IAAA,CAAA;AAAA,KAChD;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YACA,GAAA;AACI,IAAA,IAAI,CAAC,IAAK,CAAA,SAAA;AAAW,MAAA,OAAA;AAErB,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA,CAAA;AAEjB,IAAK,IAAA,CAAA,QAAA,CAAS,KAAK,YAAY,CAAA,CAAA;AAAA,GACnC;AACJ,EAAA;AAEA,SAAS,YAAA,CAAa,GAAc,CACpC,EAAA;AACI,EAAO,OAAA,CAAA,CAAE,UAAU,CAAE,CAAA,OAAA,CAAA;AACzB;;;;"}
|
9
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.d.ts
generated
vendored
Normal file
9
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Point } from '../../../maths/point/Point';
|
||||
import type { PointData } from '../../../maths/point/PointData';
|
||||
import type { Container } from '../Container';
|
||||
export interface ToLocalGlobalMixin {
|
||||
getGlobalPosition(point?: Point, skipUpdate?: boolean): Point;
|
||||
toGlobal<P extends PointData = Point>(position: PointData, point?: P, skipUpdate?: boolean): P;
|
||||
toLocal<P extends PointData = Point>(position: PointData, from?: Container, point?: P, skipUpdate?: boolean): P;
|
||||
}
|
||||
export declare const toLocalGlobalMixin: Partial<Container>;
|
68
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.js
generated
vendored
Normal file
68
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var Point = require('../../../maths/point/Point.js');
|
||||
var getGlobalBounds = require('../bounds/getGlobalBounds.js');
|
||||
|
||||
"use strict";
|
||||
const toLocalGlobalMixin = {
|
||||
/**
|
||||
* Returns the global position of the container.
|
||||
* @param point - The optional point to write the global value to.
|
||||
* @param skipUpdate - Should we skip the update transform.
|
||||
* @returns - The updated point.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getGlobalPosition(point = new Point.Point(), skipUpdate = false) {
|
||||
if (this.parent) {
|
||||
this.parent.toGlobal(this._position, point, skipUpdate);
|
||||
} else {
|
||||
point.x = this._position.x;
|
||||
point.y = this._position.y;
|
||||
}
|
||||
return point;
|
||||
},
|
||||
/**
|
||||
* Calculates the global position of the container.
|
||||
* @param position - The world origin to calculate from.
|
||||
* @param point - A Point object in which to store the value, optional
|
||||
* (otherwise will create a new Point).
|
||||
* @param skipUpdate - Should we skip the update transform.
|
||||
* @returns - A point object representing the position of this object.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
toGlobal(position, point, skipUpdate = false) {
|
||||
if (!skipUpdate) {
|
||||
this.updateLocalTransform();
|
||||
const globalMatrix = getGlobalBounds.updateTransformBackwards(this, new Matrix.Matrix());
|
||||
globalMatrix.append(this.localTransform);
|
||||
return globalMatrix.apply(position, point);
|
||||
}
|
||||
return this.worldTransform.apply(position, point);
|
||||
},
|
||||
/**
|
||||
* Calculates the local position of the container relative to another point.
|
||||
* @param position - The world origin to calculate from.
|
||||
* @param from - The Container to calculate the global position from.
|
||||
* @param point - A Point object in which to store the value, optional
|
||||
* (otherwise will create a new Point).
|
||||
* @param skipUpdate - Should we skip the update transform
|
||||
* @returns - A point object representing the position of this object
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
toLocal(position, from, point, skipUpdate) {
|
||||
if (from) {
|
||||
position = from.toGlobal(position, point, skipUpdate);
|
||||
}
|
||||
if (!skipUpdate) {
|
||||
this.updateLocalTransform();
|
||||
const globalMatrix = getGlobalBounds.updateTransformBackwards(this, new Matrix.Matrix());
|
||||
globalMatrix.append(this.localTransform);
|
||||
return globalMatrix.applyInverse(position, point);
|
||||
}
|
||||
return this.worldTransform.applyInverse(position, point);
|
||||
}
|
||||
};
|
||||
|
||||
exports.toLocalGlobalMixin = toLocalGlobalMixin;
|
||||
//# sourceMappingURL=toLocalGlobalMixin.js.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.mjs
generated
vendored
Normal file
66
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.mjs
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { Point } from '../../../maths/point/Point.mjs';
|
||||
import { updateTransformBackwards } from '../bounds/getGlobalBounds.mjs';
|
||||
|
||||
"use strict";
|
||||
const toLocalGlobalMixin = {
|
||||
/**
|
||||
* Returns the global position of the container.
|
||||
* @param point - The optional point to write the global value to.
|
||||
* @param skipUpdate - Should we skip the update transform.
|
||||
* @returns - The updated point.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
getGlobalPosition(point = new Point(), skipUpdate = false) {
|
||||
if (this.parent) {
|
||||
this.parent.toGlobal(this._position, point, skipUpdate);
|
||||
} else {
|
||||
point.x = this._position.x;
|
||||
point.y = this._position.y;
|
||||
}
|
||||
return point;
|
||||
},
|
||||
/**
|
||||
* Calculates the global position of the container.
|
||||
* @param position - The world origin to calculate from.
|
||||
* @param point - A Point object in which to store the value, optional
|
||||
* (otherwise will create a new Point).
|
||||
* @param skipUpdate - Should we skip the update transform.
|
||||
* @returns - A point object representing the position of this object.
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
toGlobal(position, point, skipUpdate = false) {
|
||||
if (!skipUpdate) {
|
||||
this.updateLocalTransform();
|
||||
const globalMatrix = updateTransformBackwards(this, new Matrix());
|
||||
globalMatrix.append(this.localTransform);
|
||||
return globalMatrix.apply(position, point);
|
||||
}
|
||||
return this.worldTransform.apply(position, point);
|
||||
},
|
||||
/**
|
||||
* Calculates the local position of the container relative to another point.
|
||||
* @param position - The world origin to calculate from.
|
||||
* @param from - The Container to calculate the global position from.
|
||||
* @param point - A Point object in which to store the value, optional
|
||||
* (otherwise will create a new Point).
|
||||
* @param skipUpdate - Should we skip the update transform
|
||||
* @returns - A point object representing the position of this object
|
||||
* @memberof scene.Container#
|
||||
*/
|
||||
toLocal(position, from, point, skipUpdate) {
|
||||
if (from) {
|
||||
position = from.toGlobal(position, point, skipUpdate);
|
||||
}
|
||||
if (!skipUpdate) {
|
||||
this.updateLocalTransform();
|
||||
const globalMatrix = updateTransformBackwards(this, new Matrix());
|
||||
globalMatrix.append(this.localTransform);
|
||||
return globalMatrix.applyInverse(position, point);
|
||||
}
|
||||
return this.worldTransform.applyInverse(position, point);
|
||||
}
|
||||
};
|
||||
|
||||
export { toLocalGlobalMixin };
|
||||
//# sourceMappingURL=toLocalGlobalMixin.mjs.map
|
1
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/container/container-mixins/toLocalGlobalMixin.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user