This commit is contained in:
2025-01-04 00:34:03 +01:00
parent 41829408dc
commit 0ca14bbc19
18111 changed files with 1871397 additions and 0 deletions

21
resources/app/node_modules/@pixi/display/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013-2023 Mathew Groves, Chad Engler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

180
resources/app/node_modules/@pixi/display/lib/Bounds.js generated vendored Normal file
View File

@@ -0,0 +1,180 @@
"use strict";
var core = require("@pixi/core");
class Bounds {
constructor() {
this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
}
/**
* Checks if bounds are empty.
* @returns - True if empty.
*/
isEmpty() {
return this.minX > this.maxX || this.minY > this.maxY;
}
/** Clears the bounds and resets. */
clear() {
this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0;
}
/**
* Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
* It is not guaranteed that it will return tempRect
* @param rect - Temporary object will be used if AABB is not empty
* @returns - A rectangle of the bounds
*/
getRectangle(rect) {
return this.minX > this.maxX || this.minY > this.maxY ? core.Rectangle.EMPTY : (rect = rect || new core.Rectangle(0, 0, 1, 1), rect.x = this.minX, rect.y = this.minY, rect.width = this.maxX - this.minX, rect.height = this.maxY - this.minY, rect);
}
/**
* This function should be inlined when its possible.
* @param point - The point to add.
*/
addPoint(point) {
this.minX = Math.min(this.minX, point.x), this.maxX = Math.max(this.maxX, point.x), this.minY = Math.min(this.minY, point.y), this.maxY = Math.max(this.maxY, point.y);
}
/**
* Adds a point, after transformed. This should be inlined when its possible.
* @param matrix
* @param point
*/
addPointMatrix(matrix, point) {
const { a, b, c, d, tx, ty } = matrix, x = a * point.x + c * point.y + tx, y = b * point.x + d * point.y + ty;
this.minX = Math.min(this.minX, x), this.maxX = Math.max(this.maxX, x), this.minY = Math.min(this.minY, y), this.maxY = Math.max(this.maxY, y);
}
/**
* Adds a quad, not transformed
* @param vertices - The verts to add.
*/
addQuad(vertices) {
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY, x = vertices[0], y = vertices[1];
minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = vertices[2], y = vertices[3], minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = vertices[4], y = vertices[5], minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = vertices[6], y = vertices[7], 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;
}
/**
* Adds sprite frame, transformed.
* @param transform - transform to apply
* @param x0 - left X of frame
* @param y0 - top Y of frame
* @param x1 - right X of frame
* @param y1 - bottom Y of frame
*/
addFrame(transform, x0, y0, x1, y1) {
this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);
}
/**
* Adds sprite frame, multiplied by matrix
* @param matrix - matrix to apply
* @param x0 - left X of frame
* @param y0 - top Y of frame
* @param x1 - right X of frame
* @param y1 - bottom Y of frame
*/
addFrameMatrix(matrix, x0, y0, x1, y1) {
const a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty;
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY, x = a * x0 + c * y0 + tx, y = b * x0 + d * y0 + ty;
minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = a * x1 + c * y0 + tx, y = b * x1 + d * y0 + ty, minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = a * x0 + c * y1 + tx, y = b * x0 + d * y1 + ty, minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = a * x1 + c * y1 + tx, y = b * x1 + d * y1 + 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;
}
/**
* Adds screen vertices from array
* @param vertexData - calculated vertices
* @param beginOffset - begin offset
* @param endOffset - end offset, excluded
*/
addVertexData(vertexData, beginOffset, endOffset) {
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
for (let i = beginOffset; i < endOffset; i += 2) {
const x = vertexData[i], y = vertexData[i + 1];
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;
}
/**
* Add an array of mesh vertices
* @param transform - mesh transform
* @param vertices - mesh coordinates in array
* @param beginOffset - begin offset
* @param endOffset - end offset, excluded
*/
addVertices(transform, vertices, beginOffset, endOffset) {
this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);
}
/**
* Add an array of mesh vertices.
* @param matrix - mesh matrix
* @param vertices - mesh coordinates in array
* @param beginOffset - begin offset
* @param endOffset - end offset, excluded
* @param padX - x padding
* @param padY - y padding
*/
addVerticesMatrix(matrix, vertices, beginOffset, endOffset, padX = 0, padY = padX) {
const a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty;
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
for (let i = beginOffset; i < endOffset; i += 2) {
const rawX = vertices[i], rawY = vertices[i + 1], x = a * rawX + c * rawY + tx, y = d * rawY + b * rawX + ty;
minX = Math.min(minX, x - padX), maxX = Math.max(maxX, x + padX), minY = Math.min(minY, y - padY), maxY = Math.max(maxY, y + padY);
}
this.minX = minX, this.minY = minY, this.maxX = maxX, this.maxY = maxY;
}
/**
* Adds other {@link PIXI.Bounds}.
* @param bounds - The Bounds to be added
*/
addBounds(bounds) {
const minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
this.minX = bounds.minX < minX ? bounds.minX : minX, this.minY = bounds.minY < minY ? bounds.minY : minY, this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX, this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
}
/**
* Adds other Bounds, masked with Bounds.
* @param bounds - The Bounds to be added.
* @param mask - TODO
*/
addBoundsMask(bounds, mask) {
const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX, _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY, _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX, _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;
if (_minX <= _maxX && _minY <= _maxY) {
const minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX, this.minY = _minY < minY ? _minY : minY, this.maxX = _maxX > maxX ? _maxX : maxX, this.maxY = _maxY > maxY ? _maxY : maxY;
}
}
/**
* Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.
* @param bounds - other bounds
* @param matrix - multiplicator
*/
addBoundsMatrix(bounds, matrix) {
this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);
}
/**
* Adds other Bounds, masked with Rectangle.
* @param bounds - TODO
* @param area - TODO
*/
addBoundsArea(bounds, area) {
const _minX = bounds.minX > area.x ? bounds.minX : area.x, _minY = bounds.minY > area.y ? bounds.minY : area.y, _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : area.x + area.width, _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : area.y + area.height;
if (_minX <= _maxX && _minY <= _maxY) {
const minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX, this.minY = _minY < minY ? _minY : minY, this.maxX = _maxX > maxX ? _maxX : maxX, this.maxY = _maxY > maxY ? _maxY : maxY;
}
}
/**
* 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 = 0, paddingY = paddingX) {
this.isEmpty() || (this.minX -= paddingX, this.maxX += paddingX, this.minY -= paddingY, this.maxY += paddingY);
}
/**
* Adds padded frame. (x0, y0) should be strictly less than (x1, y1)
* @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 padX - padding X
* @param padY - padding Y
*/
addFramePad(x0, y0, x1, y1, padX, padY) {
x0 -= padX, y0 -= padY, x1 += padX, y1 += padY, this.minX = this.minX < x0 ? this.minX : x0, this.maxX = this.maxX > x1 ? this.maxX : x1, this.minY = this.minY < y0 ? this.minY : y0, this.maxY = this.maxY > y1 ? this.maxY : y1;
}
}
exports.Bounds = Bounds;
//# sourceMappingURL=Bounds.js.map

File diff suppressed because one or more lines are too long

181
resources/app/node_modules/@pixi/display/lib/Bounds.mjs generated vendored Normal file
View File

@@ -0,0 +1,181 @@
import { Rectangle } from "@pixi/core";
class Bounds {
constructor() {
this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
}
/**
* Checks if bounds are empty.
* @returns - True if empty.
*/
isEmpty() {
return this.minX > this.maxX || this.minY > this.maxY;
}
/** Clears the bounds and resets. */
clear() {
this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0;
}
/**
* Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
* It is not guaranteed that it will return tempRect
* @param rect - Temporary object will be used if AABB is not empty
* @returns - A rectangle of the bounds
*/
getRectangle(rect) {
return this.minX > this.maxX || this.minY > this.maxY ? Rectangle.EMPTY : (rect = rect || new Rectangle(0, 0, 1, 1), rect.x = this.minX, rect.y = this.minY, rect.width = this.maxX - this.minX, rect.height = this.maxY - this.minY, rect);
}
/**
* This function should be inlined when its possible.
* @param point - The point to add.
*/
addPoint(point) {
this.minX = Math.min(this.minX, point.x), this.maxX = Math.max(this.maxX, point.x), this.minY = Math.min(this.minY, point.y), this.maxY = Math.max(this.maxY, point.y);
}
/**
* Adds a point, after transformed. This should be inlined when its possible.
* @param matrix
* @param point
*/
addPointMatrix(matrix, point) {
const { a, b, c, d, tx, ty } = matrix, x = a * point.x + c * point.y + tx, y = b * point.x + d * point.y + ty;
this.minX = Math.min(this.minX, x), this.maxX = Math.max(this.maxX, x), this.minY = Math.min(this.minY, y), this.maxY = Math.max(this.maxY, y);
}
/**
* Adds a quad, not transformed
* @param vertices - The verts to add.
*/
addQuad(vertices) {
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY, x = vertices[0], y = vertices[1];
minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = vertices[2], y = vertices[3], minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = vertices[4], y = vertices[5], minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = vertices[6], y = vertices[7], 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;
}
/**
* Adds sprite frame, transformed.
* @param transform - transform to apply
* @param x0 - left X of frame
* @param y0 - top Y of frame
* @param x1 - right X of frame
* @param y1 - bottom Y of frame
*/
addFrame(transform, x0, y0, x1, y1) {
this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);
}
/**
* Adds sprite frame, multiplied by matrix
* @param matrix - matrix to apply
* @param x0 - left X of frame
* @param y0 - top Y of frame
* @param x1 - right X of frame
* @param y1 - bottom Y of frame
*/
addFrameMatrix(matrix, x0, y0, x1, y1) {
const a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty;
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY, x = a * x0 + c * y0 + tx, y = b * x0 + d * y0 + ty;
minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = a * x1 + c * y0 + tx, y = b * x1 + d * y0 + ty, minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = a * x0 + c * y1 + tx, y = b * x0 + d * y1 + ty, minX = x < minX ? x : minX, minY = y < minY ? y : minY, maxX = x > maxX ? x : maxX, maxY = y > maxY ? y : maxY, x = a * x1 + c * y1 + tx, y = b * x1 + d * y1 + 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;
}
/**
* Adds screen vertices from array
* @param vertexData - calculated vertices
* @param beginOffset - begin offset
* @param endOffset - end offset, excluded
*/
addVertexData(vertexData, beginOffset, endOffset) {
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
for (let i = beginOffset; i < endOffset; i += 2) {
const x = vertexData[i], y = vertexData[i + 1];
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;
}
/**
* Add an array of mesh vertices
* @param transform - mesh transform
* @param vertices - mesh coordinates in array
* @param beginOffset - begin offset
* @param endOffset - end offset, excluded
*/
addVertices(transform, vertices, beginOffset, endOffset) {
this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);
}
/**
* Add an array of mesh vertices.
* @param matrix - mesh matrix
* @param vertices - mesh coordinates in array
* @param beginOffset - begin offset
* @param endOffset - end offset, excluded
* @param padX - x padding
* @param padY - y padding
*/
addVerticesMatrix(matrix, vertices, beginOffset, endOffset, padX = 0, padY = padX) {
const a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty;
let minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
for (let i = beginOffset; i < endOffset; i += 2) {
const rawX = vertices[i], rawY = vertices[i + 1], x = a * rawX + c * rawY + tx, y = d * rawY + b * rawX + ty;
minX = Math.min(minX, x - padX), maxX = Math.max(maxX, x + padX), minY = Math.min(minY, y - padY), maxY = Math.max(maxY, y + padY);
}
this.minX = minX, this.minY = minY, this.maxX = maxX, this.maxY = maxY;
}
/**
* Adds other {@link PIXI.Bounds}.
* @param bounds - The Bounds to be added
*/
addBounds(bounds) {
const minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
this.minX = bounds.minX < minX ? bounds.minX : minX, this.minY = bounds.minY < minY ? bounds.minY : minY, this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX, this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
}
/**
* Adds other Bounds, masked with Bounds.
* @param bounds - The Bounds to be added.
* @param mask - TODO
*/
addBoundsMask(bounds, mask) {
const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX, _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY, _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX, _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;
if (_minX <= _maxX && _minY <= _maxY) {
const minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX, this.minY = _minY < minY ? _minY : minY, this.maxX = _maxX > maxX ? _maxX : maxX, this.maxY = _maxY > maxY ? _maxY : maxY;
}
}
/**
* Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.
* @param bounds - other bounds
* @param matrix - multiplicator
*/
addBoundsMatrix(bounds, matrix) {
this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);
}
/**
* Adds other Bounds, masked with Rectangle.
* @param bounds - TODO
* @param area - TODO
*/
addBoundsArea(bounds, area) {
const _minX = bounds.minX > area.x ? bounds.minX : area.x, _minY = bounds.minY > area.y ? bounds.minY : area.y, _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : area.x + area.width, _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : area.y + area.height;
if (_minX <= _maxX && _minY <= _maxY) {
const minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX, this.minY = _minY < minY ? _minY : minY, this.maxX = _maxX > maxX ? _maxX : maxX, this.maxY = _maxY > maxY ? _maxY : maxY;
}
}
/**
* 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 = 0, paddingY = paddingX) {
this.isEmpty() || (this.minX -= paddingX, this.maxX += paddingX, this.minY -= paddingY, this.maxY += paddingY);
}
/**
* Adds padded frame. (x0, y0) should be strictly less than (x1, y1)
* @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 padX - padding X
* @param padY - padding Y
*/
addFramePad(x0, y0, x1, y1, padX, padY) {
x0 -= padX, y0 -= padY, x1 += padX, y1 += padY, this.minX = this.minX < x0 ? this.minX : x0, this.maxX = this.maxX > x1 ? this.maxX : x1, this.minY = this.minY < y0 ? this.minY : y0, this.maxY = this.maxY > y1 ? this.maxY : y1;
}
}
export {
Bounds
};
//# sourceMappingURL=Bounds.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,322 @@
"use strict";
var core = require("@pixi/core"), DisplayObject = require("./DisplayObject.js");
const tempMatrix = new core.Matrix();
function sortChildren(a, b) {
return a.zIndex === b.zIndex ? a._lastSortedIndex - b._lastSortedIndex : a.zIndex - b.zIndex;
}
const _Container = class _Container2 extends DisplayObject.DisplayObject {
constructor() {
super(), this.children = [], this.sortableChildren = _Container2.defaultSortableChildren, this.sortDirty = !1;
}
/**
* Overridable method that can be used by Container subclasses whenever the children array is modified.
* @param _length
*/
onChildrenChange(_length) {
}
/**
* Adds one or more children to the container.
*
* Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container
* @returns {PIXI.DisplayObject} - The first child that was added.
*/
addChild(...children) {
if (children.length > 1)
for (let i = 0; i < children.length; i++)
this.addChild(children[i]);
else {
const child = children[0];
child.parent && child.parent.removeChild(child), child.parent = this, this.sortDirty = !0, child.transform._parentID = -1, this.children.push(child), this._boundsID++, this.onChildrenChange(this.children.length - 1), this.emit("childAdded", child, this, this.children.length - 1), child.emit("added", this);
}
return children[0];
}
/**
* 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 {PIXI.DisplayObject} child - The child to add.
* @param {number} index - The absolute index where the child will be positioned at the end of the operation.
* @returns {PIXI.DisplayObject} The child that was added.
*/
addChildAt(child, index) {
if (index < 0 || index > this.children.length)
throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);
return child.parent && child.parent.removeChild(child), child.parent = this, this.sortDirty = !0, child.transform._parentID = -1, this.children.splice(index, 0, child), this._boundsID++, this.onChildrenChange(index), child.emit("added", this), this.emit("childAdded", child, this, index), child;
}
/**
* Swaps the position of 2 Display Objects within this container.
* @param child - First display object to swap
* @param child2 - Second display object to swap
*/
swapChildren(child, child2) {
if (child === child2)
return;
const index1 = this.getChildIndex(child), index2 = this.getChildIndex(child2);
this.children[index1] = child2, this.children[index2] = child, this.onChildrenChange(index1 < index2 ? index1 : index2);
}
/**
* Returns the index position of a child DisplayObject instance
* @param child - The DisplayObject instance to identify
* @returns - The index position of the child display object to identify
*/
getChildIndex(child) {
const index = this.children.indexOf(child);
if (index === -1)
throw new Error("The supplied DisplayObject must be a child of the caller");
return index;
}
/**
* Changes the position of an existing child in the display object container
* @param child - The child DisplayObject instance for which you want to change the index number
* @param index - The resulting index number for the child display object
*/
setChildIndex(child, index) {
if (index < 0 || index >= this.children.length)
throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);
const currentIndex = this.getChildIndex(child);
core.utils.removeItems(this.children, currentIndex, 1), this.children.splice(index, 0, child), this.onChildrenChange(index);
}
/**
* 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.
*/
getChildAt(index) {
if (index < 0 || index >= this.children.length)
throw new Error(`getChildAt: Index (${index}) does not exist.`);
return this.children[index];
}
/**
* Removes one or more children from the container.
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove
* @returns {PIXI.DisplayObject} The first child that was removed.
*/
removeChild(...children) {
if (children.length > 1)
for (let i = 0; i < children.length; i++)
this.removeChild(children[i]);
else {
const child = children[0], index = this.children.indexOf(child);
if (index === -1)
return null;
child.parent = null, child.transform._parentID = -1, core.utils.removeItems(this.children, index, 1), this._boundsID++, this.onChildrenChange(index), child.emit("removed", this), this.emit("childRemoved", child, this, index);
}
return children[0];
}
/**
* Removes a child from the specified index position.
* @param index - The index to get the child from
* @returns The child that was removed.
*/
removeChildAt(index) {
const child = this.getChildAt(index);
return child.parent = null, child.transform._parentID = -1, core.utils.removeItems(this.children, index, 1), this._boundsID++, this.onChildrenChange(index), child.emit("removed", this), this.emit("childRemoved", child, this, index), child;
}
/**
* 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
*/
removeChildren(beginIndex = 0, endIndex = this.children.length) {
const begin = beginIndex, end = endIndex, range = end - begin;
let removed;
if (range > 0 && range <= end) {
removed = this.children.splice(begin, range);
for (let i = 0; i < removed.length; ++i)
removed[i].parent = null, removed[i].transform && (removed[i].transform._parentID = -1);
this._boundsID++, this.onChildrenChange(beginIndex);
for (let i = 0; i < removed.length; ++i)
removed[i].emit("removed", this), this.emit("childRemoved", removed[i], this, i);
return removed;
} else if (range === 0 && this.children.length === 0)
return [];
throw new RangeError("removeChildren: numeric values are outside the acceptable range.");
}
/** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */
sortChildren() {
let sortRequired = !1;
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
child._lastSortedIndex = i, !sortRequired && child.zIndex !== 0 && (sortRequired = !0);
}
sortRequired && this.children.length > 1 && this.children.sort(sortChildren), this.sortDirty = !1;
}
/** Updates the transform on all children of this container for rendering. */
updateTransform() {
this.sortableChildren && this.sortDirty && this.sortChildren(), this._boundsID++, this.transform.updateTransform(this.parent.transform), this.worldAlpha = this.alpha * this.parent.worldAlpha;
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
child.visible && child.updateTransform();
}
}
/**
* Recalculates the bounds of the container.
*
* This implementation will automatically fit the children's bounds into the calculation. Each child's bounds
* is limited to its mask's bounds or filterArea, if any is applied.
*/
calculateBounds() {
this._bounds.clear(), this._calculateBounds();
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (!(!child.visible || !child.renderable))
if (child.calculateBounds(), child._mask) {
const maskObject = child._mask.isMaskData ? child._mask.maskObject : child._mask;
maskObject ? (maskObject.calculateBounds(), this._bounds.addBoundsMask(child._bounds, maskObject._bounds)) : this._bounds.addBounds(child._bounds);
} else
child.filterArea ? this._bounds.addBoundsArea(child._bounds, child.filterArea) : this._bounds.addBounds(child._bounds);
}
this._bounds.updateID = this._boundsID;
}
/**
* Retrieves the local bounds of the displayObject as a rectangle object.
*
* Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()
* call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.
* @param rect - Optional rectangle to store the result of the bounds calculation.
* @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,
* it was default behaviour of pixi 4.0-5.2 and caused many problems to users.
* @returns - The rectangular bounding area.
*/
getLocalBounds(rect, skipChildrenUpdate = !1) {
const result = super.getLocalBounds(rect);
if (!skipChildrenUpdate)
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
child.visible && child.updateTransform();
}
return result;
}
/**
* Recalculates the content bounds of this object. This should be overriden to
* calculate the bounds of this specific object (not including children).
* @protected
*/
_calculateBounds() {
}
/**
* Renders this object and its children with culling.
* @protected
* @param {PIXI.Renderer} renderer - The renderer
*/
_renderWithCulling(renderer) {
const sourceFrame = renderer.renderTexture.sourceFrame;
if (!(sourceFrame.width > 0 && sourceFrame.height > 0))
return;
let bounds, transform;
this.cullArea ? (bounds = this.cullArea, transform = this.worldTransform) : this._render !== _Container2.prototype._render && (bounds = this.getBounds(!0));
const projectionTransform = renderer.projection.transform;
if (projectionTransform && (transform ? (transform = tempMatrix.copyFrom(transform), transform.prepend(projectionTransform)) : transform = projectionTransform), bounds && sourceFrame.intersects(bounds, transform))
this._render(renderer);
else if (this.cullArea)
return;
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i], childCullable = child.cullable;
child.cullable = childCullable || !this.cullArea, child.render(renderer), child.cullable = childCullable;
}
}
/**
* Renders the object using the WebGL renderer.
*
* The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the
* container itself. This `render` method will invoke it, and also invoke the `render` methods of all
* children afterward.
*
* If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and
* the bounds of this object are out of frame, this implementation will entirely skip rendering.
* See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,
* setting alpha to zero is not recommended for purely skipping rendering.
*
* When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is
* advised to employ **culling** to automatically skip rendering objects outside of the current screen.
* See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.
* Other culling methods might be better suited for a large number static objects; see
* [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and
* [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.
*
* The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or
* filtering is applied on a container. This does, however, break batching and can affect performance when
* masking and filtering is applied extensively throughout the scene graph.
* @param renderer - The renderer
*/
render(renderer) {
if (!(!this.visible || this.worldAlpha <= 0 || !this.renderable))
if (this._mask || this.filters?.length)
this.renderAdvanced(renderer);
else if (this.cullable)
this._renderWithCulling(renderer);
else {
this._render(renderer);
for (let i = 0, j = this.children.length; i < j; ++i)
this.children[i].render(renderer);
}
}
/**
* Render the object using the WebGL renderer and advanced features.
* @param renderer - The renderer
*/
renderAdvanced(renderer) {
const filters = this.filters, mask = this._mask;
if (filters) {
this._enabledFilters || (this._enabledFilters = []), this._enabledFilters.length = 0;
for (let i = 0; i < filters.length; i++)
filters[i].enabled && this._enabledFilters.push(filters[i]);
}
const flush = filters && this._enabledFilters?.length || mask && (!mask.isMaskData || mask.enabled && (mask.autoDetect || mask.type !== core.MASK_TYPES.NONE));
if (flush && renderer.batch.flush(), filters && this._enabledFilters?.length && renderer.filter.push(this, this._enabledFilters), mask && renderer.mask.push(this, this._mask), this.cullable)
this._renderWithCulling(renderer);
else {
this._render(renderer);
for (let i = 0, j = this.children.length; i < j; ++i)
this.children[i].render(renderer);
}
flush && renderer.batch.flush(), mask && renderer.mask.pop(this), filters && this._enabledFilters?.length && renderer.filter.pop();
}
/**
* To be overridden by the subclasses.
* @param _renderer - The renderer
*/
_render(_renderer) {
}
/**
* 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 child Sprites if options.children is set to true
* Should it destroy the texture of the child sprite
* @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true
* Should it destroy the base texture of the child sprite
*/
destroy(options) {
super.destroy(), this.sortDirty = !1;
const destroyChildren = typeof options == "boolean" ? options : options?.children, oldChildren = this.removeChildren(0, this.children.length);
if (destroyChildren)
for (let i = 0; i < oldChildren.length; ++i)
oldChildren[i].destroy(options);
}
/** The width of the Container, setting this will actually modify the scale to achieve the value set. */
get width() {
return this.scale.x * this.getLocalBounds().width;
}
set width(value) {
const width = this.getLocalBounds().width;
width !== 0 ? this.scale.x = value / width : this.scale.x = 1, this._width = value;
}
/** The height of the Container, setting this will actually modify the scale to achieve the value set. */
get height() {
return this.scale.y * this.getLocalBounds().height;
}
set height(value) {
const height = this.getLocalBounds().height;
height !== 0 ? this.scale.y = value / height : this.scale.y = 1, this._height = value;
}
};
_Container.defaultSortableChildren = !1;
let Container = _Container;
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
exports.Container = Container;
//# sourceMappingURL=Container.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,324 @@
import { Matrix, utils, MASK_TYPES } from "@pixi/core";
import { DisplayObject } from "./DisplayObject.mjs";
const tempMatrix = new Matrix();
function sortChildren(a, b) {
return a.zIndex === b.zIndex ? a._lastSortedIndex - b._lastSortedIndex : a.zIndex - b.zIndex;
}
const _Container = class _Container2 extends DisplayObject {
constructor() {
super(), this.children = [], this.sortableChildren = _Container2.defaultSortableChildren, this.sortDirty = !1;
}
/**
* Overridable method that can be used by Container subclasses whenever the children array is modified.
* @param _length
*/
onChildrenChange(_length) {
}
/**
* Adds one or more children to the container.
*
* Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container
* @returns {PIXI.DisplayObject} - The first child that was added.
*/
addChild(...children) {
if (children.length > 1)
for (let i = 0; i < children.length; i++)
this.addChild(children[i]);
else {
const child = children[0];
child.parent && child.parent.removeChild(child), child.parent = this, this.sortDirty = !0, child.transform._parentID = -1, this.children.push(child), this._boundsID++, this.onChildrenChange(this.children.length - 1), this.emit("childAdded", child, this, this.children.length - 1), child.emit("added", this);
}
return children[0];
}
/**
* 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 {PIXI.DisplayObject} child - The child to add.
* @param {number} index - The absolute index where the child will be positioned at the end of the operation.
* @returns {PIXI.DisplayObject} The child that was added.
*/
addChildAt(child, index) {
if (index < 0 || index > this.children.length)
throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);
return child.parent && child.parent.removeChild(child), child.parent = this, this.sortDirty = !0, child.transform._parentID = -1, this.children.splice(index, 0, child), this._boundsID++, this.onChildrenChange(index), child.emit("added", this), this.emit("childAdded", child, this, index), child;
}
/**
* Swaps the position of 2 Display Objects within this container.
* @param child - First display object to swap
* @param child2 - Second display object to swap
*/
swapChildren(child, child2) {
if (child === child2)
return;
const index1 = this.getChildIndex(child), index2 = this.getChildIndex(child2);
this.children[index1] = child2, this.children[index2] = child, this.onChildrenChange(index1 < index2 ? index1 : index2);
}
/**
* Returns the index position of a child DisplayObject instance
* @param child - The DisplayObject instance to identify
* @returns - The index position of the child display object to identify
*/
getChildIndex(child) {
const index = this.children.indexOf(child);
if (index === -1)
throw new Error("The supplied DisplayObject must be a child of the caller");
return index;
}
/**
* Changes the position of an existing child in the display object container
* @param child - The child DisplayObject instance for which you want to change the index number
* @param index - The resulting index number for the child display object
*/
setChildIndex(child, index) {
if (index < 0 || index >= this.children.length)
throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);
const currentIndex = this.getChildIndex(child);
utils.removeItems(this.children, currentIndex, 1), this.children.splice(index, 0, child), this.onChildrenChange(index);
}
/**
* 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.
*/
getChildAt(index) {
if (index < 0 || index >= this.children.length)
throw new Error(`getChildAt: Index (${index}) does not exist.`);
return this.children[index];
}
/**
* Removes one or more children from the container.
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove
* @returns {PIXI.DisplayObject} The first child that was removed.
*/
removeChild(...children) {
if (children.length > 1)
for (let i = 0; i < children.length; i++)
this.removeChild(children[i]);
else {
const child = children[0], index = this.children.indexOf(child);
if (index === -1)
return null;
child.parent = null, child.transform._parentID = -1, utils.removeItems(this.children, index, 1), this._boundsID++, this.onChildrenChange(index), child.emit("removed", this), this.emit("childRemoved", child, this, index);
}
return children[0];
}
/**
* Removes a child from the specified index position.
* @param index - The index to get the child from
* @returns The child that was removed.
*/
removeChildAt(index) {
const child = this.getChildAt(index);
return child.parent = null, child.transform._parentID = -1, utils.removeItems(this.children, index, 1), this._boundsID++, this.onChildrenChange(index), child.emit("removed", this), this.emit("childRemoved", child, this, index), child;
}
/**
* 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
*/
removeChildren(beginIndex = 0, endIndex = this.children.length) {
const begin = beginIndex, end = endIndex, range = end - begin;
let removed;
if (range > 0 && range <= end) {
removed = this.children.splice(begin, range);
for (let i = 0; i < removed.length; ++i)
removed[i].parent = null, removed[i].transform && (removed[i].transform._parentID = -1);
this._boundsID++, this.onChildrenChange(beginIndex);
for (let i = 0; i < removed.length; ++i)
removed[i].emit("removed", this), this.emit("childRemoved", removed[i], this, i);
return removed;
} else if (range === 0 && this.children.length === 0)
return [];
throw new RangeError("removeChildren: numeric values are outside the acceptable range.");
}
/** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */
sortChildren() {
let sortRequired = !1;
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
child._lastSortedIndex = i, !sortRequired && child.zIndex !== 0 && (sortRequired = !0);
}
sortRequired && this.children.length > 1 && this.children.sort(sortChildren), this.sortDirty = !1;
}
/** Updates the transform on all children of this container for rendering. */
updateTransform() {
this.sortableChildren && this.sortDirty && this.sortChildren(), this._boundsID++, this.transform.updateTransform(this.parent.transform), this.worldAlpha = this.alpha * this.parent.worldAlpha;
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
child.visible && child.updateTransform();
}
}
/**
* Recalculates the bounds of the container.
*
* This implementation will automatically fit the children's bounds into the calculation. Each child's bounds
* is limited to its mask's bounds or filterArea, if any is applied.
*/
calculateBounds() {
this._bounds.clear(), this._calculateBounds();
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (!(!child.visible || !child.renderable))
if (child.calculateBounds(), child._mask) {
const maskObject = child._mask.isMaskData ? child._mask.maskObject : child._mask;
maskObject ? (maskObject.calculateBounds(), this._bounds.addBoundsMask(child._bounds, maskObject._bounds)) : this._bounds.addBounds(child._bounds);
} else
child.filterArea ? this._bounds.addBoundsArea(child._bounds, child.filterArea) : this._bounds.addBounds(child._bounds);
}
this._bounds.updateID = this._boundsID;
}
/**
* Retrieves the local bounds of the displayObject as a rectangle object.
*
* Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()
* call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.
* @param rect - Optional rectangle to store the result of the bounds calculation.
* @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,
* it was default behaviour of pixi 4.0-5.2 and caused many problems to users.
* @returns - The rectangular bounding area.
*/
getLocalBounds(rect, skipChildrenUpdate = !1) {
const result = super.getLocalBounds(rect);
if (!skipChildrenUpdate)
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
child.visible && child.updateTransform();
}
return result;
}
/**
* Recalculates the content bounds of this object. This should be overriden to
* calculate the bounds of this specific object (not including children).
* @protected
*/
_calculateBounds() {
}
/**
* Renders this object and its children with culling.
* @protected
* @param {PIXI.Renderer} renderer - The renderer
*/
_renderWithCulling(renderer) {
const sourceFrame = renderer.renderTexture.sourceFrame;
if (!(sourceFrame.width > 0 && sourceFrame.height > 0))
return;
let bounds, transform;
this.cullArea ? (bounds = this.cullArea, transform = this.worldTransform) : this._render !== _Container2.prototype._render && (bounds = this.getBounds(!0));
const projectionTransform = renderer.projection.transform;
if (projectionTransform && (transform ? (transform = tempMatrix.copyFrom(transform), transform.prepend(projectionTransform)) : transform = projectionTransform), bounds && sourceFrame.intersects(bounds, transform))
this._render(renderer);
else if (this.cullArea)
return;
for (let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i], childCullable = child.cullable;
child.cullable = childCullable || !this.cullArea, child.render(renderer), child.cullable = childCullable;
}
}
/**
* Renders the object using the WebGL renderer.
*
* The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the
* container itself. This `render` method will invoke it, and also invoke the `render` methods of all
* children afterward.
*
* If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and
* the bounds of this object are out of frame, this implementation will entirely skip rendering.
* See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,
* setting alpha to zero is not recommended for purely skipping rendering.
*
* When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is
* advised to employ **culling** to automatically skip rendering objects outside of the current screen.
* See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.
* Other culling methods might be better suited for a large number static objects; see
* [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and
* [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.
*
* The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or
* filtering is applied on a container. This does, however, break batching and can affect performance when
* masking and filtering is applied extensively throughout the scene graph.
* @param renderer - The renderer
*/
render(renderer) {
if (!(!this.visible || this.worldAlpha <= 0 || !this.renderable))
if (this._mask || this.filters?.length)
this.renderAdvanced(renderer);
else if (this.cullable)
this._renderWithCulling(renderer);
else {
this._render(renderer);
for (let i = 0, j = this.children.length; i < j; ++i)
this.children[i].render(renderer);
}
}
/**
* Render the object using the WebGL renderer and advanced features.
* @param renderer - The renderer
*/
renderAdvanced(renderer) {
const filters = this.filters, mask = this._mask;
if (filters) {
this._enabledFilters || (this._enabledFilters = []), this._enabledFilters.length = 0;
for (let i = 0; i < filters.length; i++)
filters[i].enabled && this._enabledFilters.push(filters[i]);
}
const flush = filters && this._enabledFilters?.length || mask && (!mask.isMaskData || mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE));
if (flush && renderer.batch.flush(), filters && this._enabledFilters?.length && renderer.filter.push(this, this._enabledFilters), mask && renderer.mask.push(this, this._mask), this.cullable)
this._renderWithCulling(renderer);
else {
this._render(renderer);
for (let i = 0, j = this.children.length; i < j; ++i)
this.children[i].render(renderer);
}
flush && renderer.batch.flush(), mask && renderer.mask.pop(this), filters && this._enabledFilters?.length && renderer.filter.pop();
}
/**
* To be overridden by the subclasses.
* @param _renderer - The renderer
*/
_render(_renderer) {
}
/**
* 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 child Sprites if options.children is set to true
* Should it destroy the texture of the child sprite
* @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true
* Should it destroy the base texture of the child sprite
*/
destroy(options) {
super.destroy(), this.sortDirty = !1;
const destroyChildren = typeof options == "boolean" ? options : options?.children, oldChildren = this.removeChildren(0, this.children.length);
if (destroyChildren)
for (let i = 0; i < oldChildren.length; ++i)
oldChildren[i].destroy(options);
}
/** The width of the Container, setting this will actually modify the scale to achieve the value set. */
get width() {
return this.scale.x * this.getLocalBounds().width;
}
set width(value) {
const width = this.getLocalBounds().width;
width !== 0 ? this.scale.x = value / width : this.scale.x = 1, this._width = value;
}
/** The height of the Container, setting this will actually modify the scale to achieve the value set. */
get height() {
return this.scale.y * this.getLocalBounds().height;
}
set height(value) {
const height = this.getLocalBounds().height;
height !== 0 ? this.scale.y = value / height : this.scale.y = 1, this._height = value;
}
};
_Container.defaultSortableChildren = !1;
let Container = _Container;
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
export {
Container
};
//# sourceMappingURL=Container.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,365 @@
"use strict";
var core = require("@pixi/core"), Bounds = require("./Bounds.js");
class DisplayObject extends core.utils.EventEmitter {
constructor() {
super(), this.tempDisplayObjectParent = null, this.transform = new core.Transform(), this.alpha = 1, this.visible = !0, this.renderable = !0, this.cullable = !1, this.cullArea = null, this.parent = null, this.worldAlpha = 1, this._lastSortedIndex = 0, this._zIndex = 0, this.filterArea = null, this.filters = null, this._enabledFilters = null, this._bounds = new Bounds.Bounds(), this._localBounds = null, this._boundsID = 0, this._boundsRect = null, this._localBoundsRect = null, this._mask = null, this._maskRefCount = 0, this._destroyed = !1, this.isSprite = !1, this.isMask = !1;
}
/**
* Mixes all enumerable properties and methods from a source object to DisplayObject.
* @param source - The source of properties and methods to mix in.
*/
static mixin(source) {
const keys = Object.keys(source);
for (let i = 0; i < keys.length; ++i) {
const propertyName = keys[i];
Object.defineProperty(
DisplayObject.prototype,
propertyName,
Object.getOwnPropertyDescriptor(source, propertyName)
);
}
}
/**
* Fired when this DisplayObject is added to a Container.
* @instance
* @event added
* @param {PIXI.Container} container - The container added to.
*/
/**
* Fired when this DisplayObject is removed from a Container.
* @instance
* @event removed
* @param {PIXI.Container} container - The container removed from.
*/
/**
* Fired when this DisplayObject is destroyed. This event is emitted once
* destroy is finished.
* @instance
* @event destroyed
*/
/** Readonly flag for destroyed display objects. */
get destroyed() {
return this._destroyed;
}
/** Recursively updates transform of all objects from the root to this one internal function for toLocal() */
_recursivePostUpdateTransform() {
this.parent ? (this.parent._recursivePostUpdateTransform(), this.transform.updateTransform(this.parent.transform)) : this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
/** Updates the object transform for rendering. TODO - Optimization pass! */
updateTransform() {
this._boundsID++, this.transform.updateTransform(this.parent.transform), this.worldAlpha = this.alpha * this.parent.worldAlpha;
}
/**
* Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.
*
* This method is expensive on containers with a large subtree (like the stage). This is because the bounds
* of a container depend on its children's bounds, which recursively causes all bounds in the subtree to
* be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update
* the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using
* `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,
* calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as
* its height increases.
*
* The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.
* The world bounds of all display objects in a container's **subtree** will also be recalculated.
*
* The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds
* calculation if needed.
*
* ```js
* const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);
* ```
*
* Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This
* is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more
* details.
*
* `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms
* are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain
* cases.
* @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 rect - Optional rectangle to store the result of the bounds calculation.
* @returns - The minimum axis-aligned rectangle in world space that fits around this object.
*/
getBounds(skipUpdate, rect) {
return skipUpdate || (this.parent ? (this._recursivePostUpdateTransform(), this.updateTransform()) : (this.parent = this._tempDisplayObjectParent, this.updateTransform(), this.parent = null)), this._bounds.updateID !== this._boundsID && (this.calculateBounds(), this._bounds.updateID = this._boundsID), rect || (this._boundsRect || (this._boundsRect = new core.Rectangle()), rect = this._boundsRect), this._bounds.getRectangle(rect);
}
/**
* Retrieves the local bounds of the displayObject as a rectangle object.
* @param rect - Optional rectangle to store the result of the bounds calculation.
* @returns - The rectangular bounding area.
*/
getLocalBounds(rect) {
rect || (this._localBoundsRect || (this._localBoundsRect = new core.Rectangle()), rect = this._localBoundsRect), this._localBounds || (this._localBounds = new Bounds.Bounds());
const transformRef = this.transform, parentRef = this.parent;
this.parent = null, this._tempDisplayObjectParent.worldAlpha = parentRef?.worldAlpha ?? 1, this.transform = this._tempDisplayObjectParent.transform;
const worldBounds = this._bounds, worldBoundsID = this._boundsID;
this._bounds = this._localBounds;
const bounds = this.getBounds(!1, rect);
return this.parent = parentRef, this.transform = transformRef, this._bounds = worldBounds, this._bounds.updateID += this._boundsID - worldBoundsID, bounds;
}
/**
* Calculates the global position of the display object.
* @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.
*/
toGlobal(position, point, skipUpdate = !1) {
return skipUpdate || (this._recursivePostUpdateTransform(), this.parent ? this.displayObjectUpdateTransform() : (this.parent = this._tempDisplayObjectParent, this.displayObjectUpdateTransform(), this.parent = null)), this.worldTransform.apply(position, point);
}
/**
* Calculates the local position of the display object relative to another point.
* @param position - The world origin to calculate from.
* @param from - The DisplayObject 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
*/
toLocal(position, from, point, skipUpdate) {
return from && (position = from.toGlobal(position, point, skipUpdate)), skipUpdate || (this._recursivePostUpdateTransform(), this.parent ? this.displayObjectUpdateTransform() : (this.parent = this._tempDisplayObjectParent, this.displayObjectUpdateTransform(), this.parent = null)), this.worldTransform.applyInverse(position, point);
}
/**
* Set the parent Container of this DisplayObject.
* @param container - The Container to add this DisplayObject to.
* @returns - The Container that this DisplayObject was added to.
*/
setParent(container) {
if (!container || !container.addChild)
throw new Error("setParent: Argument must be a Container");
return container.addChild(this), container;
}
/** Remove the DisplayObject from its parent Container. If the DisplayObject has no parent, do nothing. */
removeFromParent() {
this.parent?.removeChild(this);
}
/**
* Convenience function to set the position, scale, skew and pivot at once.
* @param x - The X position
* @param y - The Y position
* @param scaleX - The X scale value
* @param scaleY - The Y scale value
* @param rotation - The rotation
* @param skewX - The X skew value
* @param skewY - The Y skew value
* @param pivotX - The X pivot value
* @param pivotY - The Y pivot value
* @returns - The DisplayObject instance
*/
setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0) {
return this.position.x = x, this.position.y = y, this.scale.x = scaleX || 1, this.scale.y = scaleY || 1, this.rotation = rotation, this.skew.x = skewX, this.skew.y = skewY, this.pivot.x = pivotX, this.pivot.y = pivotY, this;
}
/**
* Base destroy method for generic display objects. This will automatically
* remove the display object from its parent Container as well as remove
* all current event listeners and internal references. Do not use a DisplayObject
* after calling `destroy()`.
* @param _options
*/
destroy(_options) {
this.removeFromParent(), this._destroyed = !0, this.transform = null, this.parent = null, this._bounds = null, this.mask = null, this.cullArea = null, this.filters = null, this.filterArea = null, this.hitArea = null, this.eventMode = "auto", this.interactiveChildren = !1, this.emit("destroyed"), this.removeAllListeners();
}
/**
* @protected
* @member {PIXI.Container}
*/
get _tempDisplayObjectParent() {
return this.tempDisplayObjectParent === null && (this.tempDisplayObjectParent = new TemporaryDisplayObject()), this.tempDisplayObjectParent;
}
/**
* Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root.
*
* ```js
* const cacheParent = elem.enableTempParent();
* elem.updateTransform();
* elem.disableTempParent(cacheParent);
* ```
* @returns - Current parent
*/
enableTempParent() {
const myParent = this.parent;
return this.parent = this._tempDisplayObjectParent, myParent;
}
/**
* Pair method for `enableTempParent`
* @param cacheParent - Actual parent of element
*/
disableTempParent(cacheParent) {
this.parent = cacheParent;
}
/**
* The position of the displayObject 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.transform.position.x = value;
}
/**
* The position of the displayObject 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.transform.position.y = value;
}
/**
* Current transform of the object based on world (parent) factors.
* @readonly
*/
get worldTransform() {
return this.transform.worldTransform;
}
/**
* Current transform of the object based on local factors: position, scale, other stuff.
* @readonly
*/
get localTransform() {
return this.transform.localTransform;
}
/**
* The coordinate of the object relative to the local coordinates of the parent.
* @since 4.0.0
*/
get position() {
return this.transform.position;
}
set position(value) {
this.transform.position.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() {
return this.transform.scale;
}
set scale(value) {
this.transform.scale.copyFrom(value);
}
/**
* 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() {
return this.transform.pivot;
}
set pivot(value) {
this.transform.pivot.copyFrom(value);
}
/**
* The skew factor for the object in radians.
* @since 4.0.0
*/
get skew() {
return this.transform.skew;
}
set skew(value) {
this.transform.skew.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.transform.rotation;
}
set rotation(value) {
this.transform.rotation = value;
}
/**
* 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.transform.rotation * core.RAD_TO_DEG;
}
set angle(value) {
this.transform.rotation = value * core.DEG_TO_RAD;
}
/**
* The zIndex of the displayObject.
*
* If a container has the sortableChildren property set to true, 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 PIXI.Container#sortableChildren
*/
get zIndex() {
return this._zIndex;
}
set zIndex(value) {
this._zIndex !== value && (this._zIndex = value, this.parent && (this.parent.sortDirty = !0));
}
/**
* Indicates if the object is globally visible.
* @readonly
*/
get worldVisible() {
let item = this;
do {
if (!item.visible)
return !1;
item = item.parent;
} while (item);
return !0;
}
/**
* 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 PIXI.Graphics} or a {@link PIXI.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;
* @todo At the moment, CanvasRenderer doesn't support Sprite as mask.
*/
get mask() {
return this._mask;
}
set mask(value) {
if (this._mask !== value) {
if (this._mask) {
const maskObject = this._mask.isMaskData ? this._mask.maskObject : this._mask;
maskObject && (maskObject._maskRefCount--, maskObject._maskRefCount === 0 && (maskObject.renderable = !0, maskObject.isMask = !1));
}
if (this._mask = value, this._mask) {
const maskObject = this._mask.isMaskData ? this._mask.maskObject : this._mask;
maskObject && (maskObject._maskRefCount === 0 && (maskObject.renderable = !1, maskObject.isMask = !0), maskObject._maskRefCount++);
}
}
}
}
class TemporaryDisplayObject extends DisplayObject {
constructor() {
super(...arguments), this.sortDirty = null;
}
}
DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;
exports.DisplayObject = DisplayObject;
exports.TemporaryDisplayObject = TemporaryDisplayObject;
//# sourceMappingURL=DisplayObject.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,367 @@
import { utils, Transform, Rectangle, RAD_TO_DEG, DEG_TO_RAD } from "@pixi/core";
import { Bounds } from "./Bounds.mjs";
class DisplayObject extends utils.EventEmitter {
constructor() {
super(), this.tempDisplayObjectParent = null, this.transform = new Transform(), this.alpha = 1, this.visible = !0, this.renderable = !0, this.cullable = !1, this.cullArea = null, this.parent = null, this.worldAlpha = 1, this._lastSortedIndex = 0, this._zIndex = 0, this.filterArea = null, this.filters = null, this._enabledFilters = null, this._bounds = new Bounds(), this._localBounds = null, this._boundsID = 0, this._boundsRect = null, this._localBoundsRect = null, this._mask = null, this._maskRefCount = 0, this._destroyed = !1, this.isSprite = !1, this.isMask = !1;
}
/**
* Mixes all enumerable properties and methods from a source object to DisplayObject.
* @param source - The source of properties and methods to mix in.
*/
static mixin(source) {
const keys = Object.keys(source);
for (let i = 0; i < keys.length; ++i) {
const propertyName = keys[i];
Object.defineProperty(
DisplayObject.prototype,
propertyName,
Object.getOwnPropertyDescriptor(source, propertyName)
);
}
}
/**
* Fired when this DisplayObject is added to a Container.
* @instance
* @event added
* @param {PIXI.Container} container - The container added to.
*/
/**
* Fired when this DisplayObject is removed from a Container.
* @instance
* @event removed
* @param {PIXI.Container} container - The container removed from.
*/
/**
* Fired when this DisplayObject is destroyed. This event is emitted once
* destroy is finished.
* @instance
* @event destroyed
*/
/** Readonly flag for destroyed display objects. */
get destroyed() {
return this._destroyed;
}
/** Recursively updates transform of all objects from the root to this one internal function for toLocal() */
_recursivePostUpdateTransform() {
this.parent ? (this.parent._recursivePostUpdateTransform(), this.transform.updateTransform(this.parent.transform)) : this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
/** Updates the object transform for rendering. TODO - Optimization pass! */
updateTransform() {
this._boundsID++, this.transform.updateTransform(this.parent.transform), this.worldAlpha = this.alpha * this.parent.worldAlpha;
}
/**
* Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.
*
* This method is expensive on containers with a large subtree (like the stage). This is because the bounds
* of a container depend on its children's bounds, which recursively causes all bounds in the subtree to
* be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update
* the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using
* `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,
* calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as
* its height increases.
*
* The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.
* The world bounds of all display objects in a container's **subtree** will also be recalculated.
*
* The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds
* calculation if needed.
*
* ```js
* const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);
* ```
*
* Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This
* is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more
* details.
*
* `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms
* are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain
* cases.
* @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 rect - Optional rectangle to store the result of the bounds calculation.
* @returns - The minimum axis-aligned rectangle in world space that fits around this object.
*/
getBounds(skipUpdate, rect) {
return skipUpdate || (this.parent ? (this._recursivePostUpdateTransform(), this.updateTransform()) : (this.parent = this._tempDisplayObjectParent, this.updateTransform(), this.parent = null)), this._bounds.updateID !== this._boundsID && (this.calculateBounds(), this._bounds.updateID = this._boundsID), rect || (this._boundsRect || (this._boundsRect = new Rectangle()), rect = this._boundsRect), this._bounds.getRectangle(rect);
}
/**
* Retrieves the local bounds of the displayObject as a rectangle object.
* @param rect - Optional rectangle to store the result of the bounds calculation.
* @returns - The rectangular bounding area.
*/
getLocalBounds(rect) {
rect || (this._localBoundsRect || (this._localBoundsRect = new Rectangle()), rect = this._localBoundsRect), this._localBounds || (this._localBounds = new Bounds());
const transformRef = this.transform, parentRef = this.parent;
this.parent = null, this._tempDisplayObjectParent.worldAlpha = parentRef?.worldAlpha ?? 1, this.transform = this._tempDisplayObjectParent.transform;
const worldBounds = this._bounds, worldBoundsID = this._boundsID;
this._bounds = this._localBounds;
const bounds = this.getBounds(!1, rect);
return this.parent = parentRef, this.transform = transformRef, this._bounds = worldBounds, this._bounds.updateID += this._boundsID - worldBoundsID, bounds;
}
/**
* Calculates the global position of the display object.
* @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.
*/
toGlobal(position, point, skipUpdate = !1) {
return skipUpdate || (this._recursivePostUpdateTransform(), this.parent ? this.displayObjectUpdateTransform() : (this.parent = this._tempDisplayObjectParent, this.displayObjectUpdateTransform(), this.parent = null)), this.worldTransform.apply(position, point);
}
/**
* Calculates the local position of the display object relative to another point.
* @param position - The world origin to calculate from.
* @param from - The DisplayObject 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
*/
toLocal(position, from, point, skipUpdate) {
return from && (position = from.toGlobal(position, point, skipUpdate)), skipUpdate || (this._recursivePostUpdateTransform(), this.parent ? this.displayObjectUpdateTransform() : (this.parent = this._tempDisplayObjectParent, this.displayObjectUpdateTransform(), this.parent = null)), this.worldTransform.applyInverse(position, point);
}
/**
* Set the parent Container of this DisplayObject.
* @param container - The Container to add this DisplayObject to.
* @returns - The Container that this DisplayObject was added to.
*/
setParent(container) {
if (!container || !container.addChild)
throw new Error("setParent: Argument must be a Container");
return container.addChild(this), container;
}
/** Remove the DisplayObject from its parent Container. If the DisplayObject has no parent, do nothing. */
removeFromParent() {
this.parent?.removeChild(this);
}
/**
* Convenience function to set the position, scale, skew and pivot at once.
* @param x - The X position
* @param y - The Y position
* @param scaleX - The X scale value
* @param scaleY - The Y scale value
* @param rotation - The rotation
* @param skewX - The X skew value
* @param skewY - The Y skew value
* @param pivotX - The X pivot value
* @param pivotY - The Y pivot value
* @returns - The DisplayObject instance
*/
setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0) {
return this.position.x = x, this.position.y = y, this.scale.x = scaleX || 1, this.scale.y = scaleY || 1, this.rotation = rotation, this.skew.x = skewX, this.skew.y = skewY, this.pivot.x = pivotX, this.pivot.y = pivotY, this;
}
/**
* Base destroy method for generic display objects. This will automatically
* remove the display object from its parent Container as well as remove
* all current event listeners and internal references. Do not use a DisplayObject
* after calling `destroy()`.
* @param _options
*/
destroy(_options) {
this.removeFromParent(), this._destroyed = !0, this.transform = null, this.parent = null, this._bounds = null, this.mask = null, this.cullArea = null, this.filters = null, this.filterArea = null, this.hitArea = null, this.eventMode = "auto", this.interactiveChildren = !1, this.emit("destroyed"), this.removeAllListeners();
}
/**
* @protected
* @member {PIXI.Container}
*/
get _tempDisplayObjectParent() {
return this.tempDisplayObjectParent === null && (this.tempDisplayObjectParent = new TemporaryDisplayObject()), this.tempDisplayObjectParent;
}
/**
* Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root.
*
* ```js
* const cacheParent = elem.enableTempParent();
* elem.updateTransform();
* elem.disableTempParent(cacheParent);
* ```
* @returns - Current parent
*/
enableTempParent() {
const myParent = this.parent;
return this.parent = this._tempDisplayObjectParent, myParent;
}
/**
* Pair method for `enableTempParent`
* @param cacheParent - Actual parent of element
*/
disableTempParent(cacheParent) {
this.parent = cacheParent;
}
/**
* The position of the displayObject 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.transform.position.x = value;
}
/**
* The position of the displayObject 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.transform.position.y = value;
}
/**
* Current transform of the object based on world (parent) factors.
* @readonly
*/
get worldTransform() {
return this.transform.worldTransform;
}
/**
* Current transform of the object based on local factors: position, scale, other stuff.
* @readonly
*/
get localTransform() {
return this.transform.localTransform;
}
/**
* The coordinate of the object relative to the local coordinates of the parent.
* @since 4.0.0
*/
get position() {
return this.transform.position;
}
set position(value) {
this.transform.position.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() {
return this.transform.scale;
}
set scale(value) {
this.transform.scale.copyFrom(value);
}
/**
* 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() {
return this.transform.pivot;
}
set pivot(value) {
this.transform.pivot.copyFrom(value);
}
/**
* The skew factor for the object in radians.
* @since 4.0.0
*/
get skew() {
return this.transform.skew;
}
set skew(value) {
this.transform.skew.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.transform.rotation;
}
set rotation(value) {
this.transform.rotation = value;
}
/**
* 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.transform.rotation * RAD_TO_DEG;
}
set angle(value) {
this.transform.rotation = value * DEG_TO_RAD;
}
/**
* The zIndex of the displayObject.
*
* If a container has the sortableChildren property set to true, 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 PIXI.Container#sortableChildren
*/
get zIndex() {
return this._zIndex;
}
set zIndex(value) {
this._zIndex !== value && (this._zIndex = value, this.parent && (this.parent.sortDirty = !0));
}
/**
* Indicates if the object is globally visible.
* @readonly
*/
get worldVisible() {
let item = this;
do {
if (!item.visible)
return !1;
item = item.parent;
} while (item);
return !0;
}
/**
* 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 PIXI.Graphics} or a {@link PIXI.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;
* @todo At the moment, CanvasRenderer doesn't support Sprite as mask.
*/
get mask() {
return this._mask;
}
set mask(value) {
if (this._mask !== value) {
if (this._mask) {
const maskObject = this._mask.isMaskData ? this._mask.maskObject : this._mask;
maskObject && (maskObject._maskRefCount--, maskObject._maskRefCount === 0 && (maskObject.renderable = !0, maskObject.isMask = !1));
}
if (this._mask = value, this._mask) {
const maskObject = this._mask.isMaskData ? this._mask.maskObject : this._mask;
maskObject && (maskObject._maskRefCount === 0 && (maskObject.renderable = !1, maskObject.isMask = !0), maskObject._maskRefCount++);
}
}
}
}
class TemporaryDisplayObject extends DisplayObject {
constructor() {
super(...arguments), this.sortDirty = null;
}
}
DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;
export {
DisplayObject,
TemporaryDisplayObject
};
//# sourceMappingURL=DisplayObject.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
"use strict";
require("./settings.js");
var Bounds = require("./Bounds.js"), Container = require("./Container.js"), DisplayObject = require("./DisplayObject.js");
exports.Bounds = Bounds.Bounds;
exports.Container = Container.Container;
exports.DisplayObject = DisplayObject.DisplayObject;
exports.TemporaryDisplayObject = DisplayObject.TemporaryDisplayObject;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}

11
resources/app/node_modules/@pixi/display/lib/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import "./settings.mjs";
import { Bounds } from "./Bounds.mjs";
import { Container } from "./Container.mjs";
import { DisplayObject, TemporaryDisplayObject } from "./DisplayObject.mjs";
export {
Bounds,
Container,
DisplayObject,
TemporaryDisplayObject
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}

View File

@@ -0,0 +1,28 @@
"use strict";
var core = require("@pixi/core"), Container = require("./Container.js");
Object.defineProperties(core.settings, {
/**
* Sets the default value for the container property 'sortableChildren'.
* @static
* @name SORTABLE_CHILDREN
* @memberof PIXI.settings
* @deprecated since 7.1.0
* @type {boolean}
* @see PIXI.Container.defaultSortableChildren
*/
SORTABLE_CHILDREN: {
get() {
return Container.Container.defaultSortableChildren;
},
set(value) {
core.utils.deprecation("7.1.0", "settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"), Container.Container.defaultSortableChildren = value;
}
}
});
Object.defineProperty(exports, "settings", {
enumerable: !0,
get: function() {
return core.settings;
}
});
//# sourceMappingURL=settings.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"settings.js","sources":["../src/settings.ts"],"sourcesContent":["import { settings, utils } from '@pixi/core';\nimport { Container } from './Container';\n\nObject.defineProperties(settings, {\n /**\n * Sets the default value for the container property 'sortableChildren'.\n * @static\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @type {boolean}\n * @see PIXI.Container.defaultSortableChildren\n */\n SORTABLE_CHILDREN: {\n get()\n {\n return Container.defaultSortableChildren;\n },\n set(value: boolean)\n {\n if (process.env.DEBUG)\n {\n // eslint-disable-next-line max-len\n utils.deprecation('7.1.0', 'settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren');\n }\n Container.defaultSortableChildren = value;\n },\n },\n});\n\nexport { settings };\n"],"names":["settings","Container","utils"],"mappings":";;AAGA,OAAO,iBAAiBA,KAAAA,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU9B,mBAAmB;AAAA,IACf,MACA;AACI,aAAOC,UAAAA,UAAU;AAAA,IACrB;AAAA,IACA,IAAI,OACJ;AAIQC,WAAA,MAAM,YAAY,SAAS,iFAAiF,GAEhHD,oBAAU,0BAA0B;AAAA,IACxC;AAAA,EACJ;AACJ,CAAC;;;;;;;"}

View File

@@ -0,0 +1,26 @@
import { settings, utils } from "@pixi/core";
import { settings as settings2 } from "@pixi/core";
import { Container } from "./Container.mjs";
Object.defineProperties(settings, {
/**
* Sets the default value for the container property 'sortableChildren'.
* @static
* @name SORTABLE_CHILDREN
* @memberof PIXI.settings
* @deprecated since 7.1.0
* @type {boolean}
* @see PIXI.Container.defaultSortableChildren
*/
SORTABLE_CHILDREN: {
get() {
return Container.defaultSortableChildren;
},
set(value) {
utils.deprecation("7.1.0", "settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"), Container.defaultSortableChildren = value;
}
}
});
export {
settings2 as settings
};
//# sourceMappingURL=settings.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"settings.mjs","sources":["../src/settings.ts"],"sourcesContent":["import { settings, utils } from '@pixi/core';\nimport { Container } from './Container';\n\nObject.defineProperties(settings, {\n /**\n * Sets the default value for the container property 'sortableChildren'.\n * @static\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @type {boolean}\n * @see PIXI.Container.defaultSortableChildren\n */\n SORTABLE_CHILDREN: {\n get()\n {\n return Container.defaultSortableChildren;\n },\n set(value: boolean)\n {\n if (process.env.DEBUG)\n {\n // eslint-disable-next-line max-len\n utils.deprecation('7.1.0', 'settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren');\n }\n Container.defaultSortableChildren = value;\n },\n },\n});\n\nexport { settings };\n"],"names":[],"mappings":";;;AAGA,OAAO,iBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU9B,mBAAmB;AAAA,IACf,MACA;AACI,aAAO,UAAU;AAAA,IACrB;AAAA,IACA,IAAI,OACJ;AAIQ,YAAM,YAAY,SAAS,iFAAiF,GAEhH,UAAU,0BAA0B;AAAA,IACxC;AAAA,EACJ;AACJ,CAAC;"}

37
resources/app/node_modules/@pixi/display/package.json generated vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "@pixi/display",
"version": "7.4.2",
"main": "lib/index.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
}
}
},
"description": "Core display functionality",
"author": "Mat Groves",
"homepage": "http://pixijs.com/",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pixijs/pixijs.git"
},
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"*.d.ts"
],
"peerDependencies": {
"@pixi/core": "7.4.2"
}
}