sdfsdfs
This commit is contained in:
47
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.d.ts
generated
vendored
Normal file
47
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { PlaneGeometry } from '../mesh-plane/PlaneGeometry';
|
||||
/**
|
||||
* Options for the NineSliceGeometry.
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface NineSliceGeometryOptions {
|
||||
/** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
|
||||
width?: number;
|
||||
/** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
|
||||
height?: number;
|
||||
/** The original width of the texture */
|
||||
originalWidth?: number;
|
||||
/** The original height of the texture */
|
||||
originalHeight?: number;
|
||||
/** The width of the left column. */
|
||||
leftWidth?: number;
|
||||
/** The height of the top row. */
|
||||
topHeight?: number;
|
||||
/** The width of the right column. */
|
||||
rightWidth?: number;
|
||||
/** The height of the bottom row. */
|
||||
bottomHeight?: number;
|
||||
}
|
||||
/**
|
||||
* The NineSliceGeometry class allows you to create a NineSlicePlane object.
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class NineSliceGeometry extends PlaneGeometry {
|
||||
/** The default options for the NineSliceGeometry. */
|
||||
static defaultOptions: NineSliceGeometryOptions;
|
||||
_leftWidth: number;
|
||||
_rightWidth: number;
|
||||
_topHeight: number;
|
||||
_bottomHeight: number;
|
||||
private _originalWidth;
|
||||
private _originalHeight;
|
||||
constructor(options?: NineSliceGeometryOptions);
|
||||
/**
|
||||
* Updates the NineSliceGeometry with the options.
|
||||
* @param options - The options of the NineSliceGeometry.
|
||||
*/
|
||||
update(options: NineSliceGeometryOptions): void;
|
||||
/** Updates the positions of the vertices. */
|
||||
updatePositions(): void;
|
||||
/** Updates the UVs of the vertices. */
|
||||
updateUvs(): void;
|
||||
}
|
87
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.js
generated
vendored
Normal file
87
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
'use strict';
|
||||
|
||||
var PlaneGeometry = require('../mesh-plane/PlaneGeometry.js');
|
||||
|
||||
"use strict";
|
||||
const _NineSliceGeometry = class _NineSliceGeometry extends PlaneGeometry.PlaneGeometry {
|
||||
constructor(options = {}) {
|
||||
options = { ..._NineSliceGeometry.defaultOptions, ...options };
|
||||
super({
|
||||
width: options.width,
|
||||
height: options.height,
|
||||
verticesX: 4,
|
||||
verticesY: 4
|
||||
});
|
||||
this.update(options);
|
||||
}
|
||||
/**
|
||||
* Updates the NineSliceGeometry with the options.
|
||||
* @param options - The options of the NineSliceGeometry.
|
||||
*/
|
||||
update(options) {
|
||||
this.width = options.width ?? this.width;
|
||||
this.height = options.height ?? this.height;
|
||||
this._originalWidth = options.originalWidth ?? this._originalWidth;
|
||||
this._originalHeight = options.originalHeight ?? this._originalHeight;
|
||||
this._leftWidth = options.leftWidth ?? this._leftWidth;
|
||||
this._rightWidth = options.rightWidth ?? this._rightWidth;
|
||||
this._topHeight = options.topHeight ?? this._topHeight;
|
||||
this._bottomHeight = options.bottomHeight ?? this._bottomHeight;
|
||||
this.updateUvs();
|
||||
this.updatePositions();
|
||||
}
|
||||
/** Updates the positions of the vertices. */
|
||||
updatePositions() {
|
||||
const positions = this.positions;
|
||||
const w = this._leftWidth + this._rightWidth;
|
||||
const scaleW = this.width > w ? 1 : this.width / w;
|
||||
const h = this._topHeight + this._bottomHeight;
|
||||
const scaleH = this.height > h ? 1 : this.height / h;
|
||||
const scale = Math.min(scaleW, scaleH);
|
||||
positions[9] = positions[11] = positions[13] = positions[15] = this._topHeight * scale;
|
||||
positions[17] = positions[19] = positions[21] = positions[23] = this.height - this._bottomHeight * scale;
|
||||
positions[25] = positions[27] = positions[29] = positions[31] = this.height;
|
||||
positions[2] = positions[10] = positions[18] = positions[26] = this._leftWidth * scale;
|
||||
positions[4] = positions[12] = positions[20] = positions[28] = this.width - this._rightWidth * scale;
|
||||
positions[6] = positions[14] = positions[22] = positions[30] = this.width;
|
||||
this.getBuffer("aPosition").update();
|
||||
}
|
||||
/** Updates the UVs of the vertices. */
|
||||
updateUvs() {
|
||||
const uvs = this.uvs;
|
||||
uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;
|
||||
uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;
|
||||
uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;
|
||||
uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;
|
||||
const _uvw = 1 / this._originalWidth;
|
||||
const _uvh = 1 / this._originalHeight;
|
||||
uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;
|
||||
uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;
|
||||
uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - _uvw * this._rightWidth;
|
||||
uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - _uvh * this._bottomHeight;
|
||||
this.getBuffer("aUV").update();
|
||||
}
|
||||
};
|
||||
/** The default options for the NineSliceGeometry. */
|
||||
_NineSliceGeometry.defaultOptions = {
|
||||
/** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
|
||||
width: 100,
|
||||
/** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
|
||||
height: 100,
|
||||
/** The width of the left column. */
|
||||
leftWidth: 10,
|
||||
/** The height of the top row. */
|
||||
topHeight: 10,
|
||||
/** The width of the right column. */
|
||||
rightWidth: 10,
|
||||
/** The height of the bottom row. */
|
||||
bottomHeight: 10,
|
||||
/** The original width of the texture */
|
||||
originalWidth: 100,
|
||||
/** The original height of the texture */
|
||||
originalHeight: 100
|
||||
};
|
||||
let NineSliceGeometry = _NineSliceGeometry;
|
||||
|
||||
exports.NineSliceGeometry = NineSliceGeometry;
|
||||
//# sourceMappingURL=NineSliceGeometry.js.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
85
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.mjs
generated
vendored
Normal file
85
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.mjs
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
import { PlaneGeometry } from '../mesh-plane/PlaneGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
const _NineSliceGeometry = class _NineSliceGeometry extends PlaneGeometry {
|
||||
constructor(options = {}) {
|
||||
options = { ..._NineSliceGeometry.defaultOptions, ...options };
|
||||
super({
|
||||
width: options.width,
|
||||
height: options.height,
|
||||
verticesX: 4,
|
||||
verticesY: 4
|
||||
});
|
||||
this.update(options);
|
||||
}
|
||||
/**
|
||||
* Updates the NineSliceGeometry with the options.
|
||||
* @param options - The options of the NineSliceGeometry.
|
||||
*/
|
||||
update(options) {
|
||||
this.width = options.width ?? this.width;
|
||||
this.height = options.height ?? this.height;
|
||||
this._originalWidth = options.originalWidth ?? this._originalWidth;
|
||||
this._originalHeight = options.originalHeight ?? this._originalHeight;
|
||||
this._leftWidth = options.leftWidth ?? this._leftWidth;
|
||||
this._rightWidth = options.rightWidth ?? this._rightWidth;
|
||||
this._topHeight = options.topHeight ?? this._topHeight;
|
||||
this._bottomHeight = options.bottomHeight ?? this._bottomHeight;
|
||||
this.updateUvs();
|
||||
this.updatePositions();
|
||||
}
|
||||
/** Updates the positions of the vertices. */
|
||||
updatePositions() {
|
||||
const positions = this.positions;
|
||||
const w = this._leftWidth + this._rightWidth;
|
||||
const scaleW = this.width > w ? 1 : this.width / w;
|
||||
const h = this._topHeight + this._bottomHeight;
|
||||
const scaleH = this.height > h ? 1 : this.height / h;
|
||||
const scale = Math.min(scaleW, scaleH);
|
||||
positions[9] = positions[11] = positions[13] = positions[15] = this._topHeight * scale;
|
||||
positions[17] = positions[19] = positions[21] = positions[23] = this.height - this._bottomHeight * scale;
|
||||
positions[25] = positions[27] = positions[29] = positions[31] = this.height;
|
||||
positions[2] = positions[10] = positions[18] = positions[26] = this._leftWidth * scale;
|
||||
positions[4] = positions[12] = positions[20] = positions[28] = this.width - this._rightWidth * scale;
|
||||
positions[6] = positions[14] = positions[22] = positions[30] = this.width;
|
||||
this.getBuffer("aPosition").update();
|
||||
}
|
||||
/** Updates the UVs of the vertices. */
|
||||
updateUvs() {
|
||||
const uvs = this.uvs;
|
||||
uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;
|
||||
uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;
|
||||
uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;
|
||||
uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;
|
||||
const _uvw = 1 / this._originalWidth;
|
||||
const _uvh = 1 / this._originalHeight;
|
||||
uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;
|
||||
uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;
|
||||
uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - _uvw * this._rightWidth;
|
||||
uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - _uvh * this._bottomHeight;
|
||||
this.getBuffer("aUV").update();
|
||||
}
|
||||
};
|
||||
/** The default options for the NineSliceGeometry. */
|
||||
_NineSliceGeometry.defaultOptions = {
|
||||
/** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
|
||||
width: 100,
|
||||
/** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
|
||||
height: 100,
|
||||
/** The width of the left column. */
|
||||
leftWidth: 10,
|
||||
/** The height of the top row. */
|
||||
topHeight: 10,
|
||||
/** The width of the right column. */
|
||||
rightWidth: 10,
|
||||
/** The height of the bottom row. */
|
||||
bottomHeight: 10,
|
||||
/** The original width of the texture */
|
||||
originalWidth: 100,
|
||||
/** The original height of the texture */
|
||||
originalHeight: 100
|
||||
};
|
||||
let NineSliceGeometry = _NineSliceGeometry;
|
||||
|
||||
export { NineSliceGeometry };
|
||||
//# sourceMappingURL=NineSliceGeometry.mjs.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceGeometry.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
160
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts
generated
vendored
Normal file
160
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.d.ts
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
import { Texture } from '../../rendering/renderers/shared/texture/Texture';
|
||||
import { ViewContainer } from '../view/View';
|
||||
import type { Size } from '../../maths/misc/Size';
|
||||
import type { View } from '../../rendering/renderers/shared/view/View';
|
||||
import type { Bounds, BoundsData } from '../container/bounds/Bounds';
|
||||
import type { ContainerOptions } from '../container/Container';
|
||||
import type { Optional } from '../container/container-mixins/measureMixin';
|
||||
import type { DestroyOptions } from '../container/destroyTypes';
|
||||
/**
|
||||
* Constructor options used for `NineSliceSprite` instances.
|
||||
* ```js
|
||||
* const nineSliceSprite = new NineSliceSprite({
|
||||
* texture: Texture.from('button.png'),
|
||||
* leftWidth: 20,
|
||||
* topHeight: 20,
|
||||
* rightWidth: 20,
|
||||
* bottomHeight: 20,
|
||||
* });
|
||||
* ```
|
||||
* @see {@link scene.NineSliceSprite}
|
||||
* @memberof scene
|
||||
*/
|
||||
export interface NineSliceSpriteOptions extends ContainerOptions {
|
||||
/** The texture to use on the NineSliceSprite. */
|
||||
texture: Texture;
|
||||
/** Width of the left vertical bar (A) */
|
||||
leftWidth?: number;
|
||||
/** Height of the top horizontal bar (C) */
|
||||
topHeight?: number;
|
||||
/** Width of the right vertical bar (B) */
|
||||
rightWidth?: number;
|
||||
/** Height of the bottom horizontal bar (D) */
|
||||
bottomHeight?: number;
|
||||
/** Width of the NineSliceSprite, setting this will actually modify the vertices and not the UV's of this plane. */
|
||||
width?: number;
|
||||
/** Height of the NineSliceSprite, setting this will actually modify the vertices and not UV's of this plane. */
|
||||
height?: number;
|
||||
/** Whether or not to round the x/y position. */
|
||||
roundPixels?: boolean;
|
||||
}
|
||||
/**
|
||||
* The NineSliceSprite allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful
|
||||
* for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically
|
||||
*
|
||||
* <pre>
|
||||
* A B
|
||||
* +---+----------------------+---+
|
||||
* C | 1 | 2 | 3 |
|
||||
* +---+----------------------+---+
|
||||
* | | | |
|
||||
* | 4 | 5 | 6 |
|
||||
* | | | |
|
||||
* +---+----------------------+---+
|
||||
* D | 7 | 8 | 9 |
|
||||
* +---+----------------------+---+
|
||||
* When changing this objects width and/or height:
|
||||
* areas 1 3 7 and 9 will remain unscaled.
|
||||
* areas 2 and 8 will be stretched horizontally
|
||||
* areas 4 and 6 will be stretched vertically
|
||||
* area 5 will be stretched both horizontally and vertically
|
||||
* </pre>
|
||||
* @example
|
||||
* import { NineSliceSprite, Texture } from 'pixi.js';
|
||||
*
|
||||
* const plane9 = new NineSliceSprite(Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class NineSliceSprite extends ViewContainer implements View {
|
||||
/** The default options, used to override the initial values of any options passed in the constructor. */
|
||||
static defaultOptions: NineSliceSpriteOptions;
|
||||
readonly renderPipeId: string;
|
||||
_texture: Texture;
|
||||
batched: boolean;
|
||||
private _leftWidth;
|
||||
private _topHeight;
|
||||
private _rightWidth;
|
||||
private _bottomHeight;
|
||||
private _width;
|
||||
private _height;
|
||||
_didSpriteUpdate: boolean;
|
||||
/**
|
||||
* @param {scene.NineSliceSpriteOptions|Texture} options - Options to use
|
||||
* @param options.texture - The texture to use on the NineSliceSprite.
|
||||
* @param options.leftWidth - Width of the left vertical bar (A)
|
||||
* @param options.topHeight - Height of the top horizontal bar (C)
|
||||
* @param options.rightWidth - Width of the right vertical bar (B)
|
||||
* @param options.bottomHeight - Height of the bottom horizontal bar (D)
|
||||
* @param options.width - Width of the NineSliceSprite,
|
||||
* setting this will actually modify the vertices and not the UV's of this plane.
|
||||
* @param options.height - Height of the NineSliceSprite,
|
||||
* setting this will actually modify the vertices and not UV's of this plane.
|
||||
*/
|
||||
constructor(options: NineSliceSpriteOptions | Texture);
|
||||
/** The local bounds of the view. */
|
||||
get bounds(): BoundsData;
|
||||
/** The width of the NineSliceSprite, setting this will actually modify the vertices and UV's of this plane. */
|
||||
get width(): number;
|
||||
set width(value: number);
|
||||
/** The height of the NineSliceSprite, setting this will actually modify the vertices and UV's of this plane. */
|
||||
get height(): number;
|
||||
set height(value: number);
|
||||
/**
|
||||
* Sets the size of the NiceSliceSprite to the specified width and height.
|
||||
* setting this will actually modify the vertices and UV's of this plane
|
||||
* 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.
|
||||
*/
|
||||
setSize(value: number | Optional<Size, 'height'>, height?: number): void;
|
||||
/**
|
||||
* Retrieves the size of the NineSliceSprite 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 NineSliceSprite.
|
||||
*/
|
||||
getSize(out?: Size): Size;
|
||||
/** The width of the left column (a) of the NineSliceSprite. */
|
||||
get leftWidth(): number;
|
||||
set leftWidth(value: number);
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get topHeight(): number;
|
||||
set topHeight(value: number);
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get rightWidth(): number;
|
||||
set rightWidth(value: number);
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get bottomHeight(): number;
|
||||
set bottomHeight(value: number);
|
||||
/** The texture that the NineSliceSprite is using. */
|
||||
get texture(): Texture;
|
||||
set texture(value: Texture);
|
||||
/** The original width of the texture */
|
||||
get originalWidth(): number;
|
||||
/** The original height of the texture */
|
||||
get originalHeight(): number;
|
||||
protected onViewUpdate(): void;
|
||||
/**
|
||||
* Adds the bounds of this object to the bounds object.
|
||||
* @param bounds - The output bounds object.
|
||||
*/
|
||||
addBounds(bounds: Bounds): void;
|
||||
/**
|
||||
* Destroys this sprite renderable and optionally its texture.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well
|
||||
* @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well
|
||||
*/
|
||||
destroy(options?: DestroyOptions): void;
|
||||
}
|
||||
/**
|
||||
* Please use the `NineSliceSprite` class instead.
|
||||
* @deprecated since 8.0.0
|
||||
* @memberof scene
|
||||
*/
|
||||
export declare class NineSlicePlane extends NineSliceSprite {
|
||||
constructor(options: NineSliceSpriteOptions | Texture);
|
||||
/** @deprecated since 8.0.0 */
|
||||
constructor(texture: Texture, leftWidth: number, topHeight: number, rightWidth: number, bottomHeight: number);
|
||||
}
|
220
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.js
generated
vendored
Normal file
220
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.js
generated
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
'use strict';
|
||||
|
||||
var Texture = require('../../rendering/renderers/shared/texture/Texture.js');
|
||||
var deprecation = require('../../utils/logging/deprecation.js');
|
||||
var View = require('../view/View.js');
|
||||
var NineSliceGeometry = require('./NineSliceGeometry.js');
|
||||
|
||||
"use strict";
|
||||
const _NineSliceSprite = class _NineSliceSprite extends View.ViewContainer {
|
||||
/**
|
||||
* @param {scene.NineSliceSpriteOptions|Texture} options - Options to use
|
||||
* @param options.texture - The texture to use on the NineSliceSprite.
|
||||
* @param options.leftWidth - Width of the left vertical bar (A)
|
||||
* @param options.topHeight - Height of the top horizontal bar (C)
|
||||
* @param options.rightWidth - Width of the right vertical bar (B)
|
||||
* @param options.bottomHeight - Height of the bottom horizontal bar (D)
|
||||
* @param options.width - Width of the NineSliceSprite,
|
||||
* setting this will actually modify the vertices and not the UV's of this plane.
|
||||
* @param options.height - Height of the NineSliceSprite,
|
||||
* setting this will actually modify the vertices and not UV's of this plane.
|
||||
*/
|
||||
constructor(options) {
|
||||
if (options instanceof Texture.Texture) {
|
||||
options = { texture: options };
|
||||
}
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
leftWidth,
|
||||
rightWidth,
|
||||
topHeight,
|
||||
bottomHeight,
|
||||
texture,
|
||||
roundPixels,
|
||||
...rest
|
||||
} = options;
|
||||
super({
|
||||
label: "NineSliceSprite",
|
||||
...rest
|
||||
});
|
||||
this.renderPipeId = "nineSliceSprite";
|
||||
this.batched = true;
|
||||
this._didSpriteUpdate = true;
|
||||
this._leftWidth = leftWidth ?? texture?.defaultBorders?.left ?? NineSliceGeometry.NineSliceGeometry.defaultOptions.leftWidth;
|
||||
this._topHeight = topHeight ?? texture?.defaultBorders?.top ?? NineSliceGeometry.NineSliceGeometry.defaultOptions.topHeight;
|
||||
this._rightWidth = rightWidth ?? texture?.defaultBorders?.right ?? NineSliceGeometry.NineSliceGeometry.defaultOptions.rightWidth;
|
||||
this._bottomHeight = bottomHeight ?? texture?.defaultBorders?.bottom ?? NineSliceGeometry.NineSliceGeometry.defaultOptions.bottomHeight;
|
||||
this.bounds.maxX = this._width = width ?? texture.width ?? NineSliceGeometry.NineSliceGeometry.defaultOptions.width;
|
||||
this.bounds.maxY = this._height = height ?? texture.height ?? NineSliceGeometry.NineSliceGeometry.defaultOptions.height;
|
||||
this.allowChildren = false;
|
||||
this.texture = texture ?? _NineSliceSprite.defaultOptions.texture;
|
||||
this.roundPixels = roundPixels ?? false;
|
||||
}
|
||||
/** The local bounds of the view. */
|
||||
get bounds() {
|
||||
return this._bounds;
|
||||
}
|
||||
/** The width of the NineSliceSprite, setting this will actually modify the vertices and UV's of this plane. */
|
||||
get width() {
|
||||
return this._width;
|
||||
}
|
||||
set width(value) {
|
||||
this.bounds.maxX = this._width = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The height of the NineSliceSprite, setting this will actually modify the vertices and UV's of this plane. */
|
||||
get height() {
|
||||
return this._height;
|
||||
}
|
||||
set height(value) {
|
||||
this.bounds.maxY = this._height = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/**
|
||||
* Sets the size of the NiceSliceSprite to the specified width and height.
|
||||
* setting this will actually modify the vertices and UV's of this plane
|
||||
* 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.
|
||||
*/
|
||||
setSize(value, height) {
|
||||
if (typeof value === "object") {
|
||||
height = value.height ?? value.width;
|
||||
value = value.width;
|
||||
}
|
||||
this.bounds.maxX = this._width = value;
|
||||
this.bounds.maxY = this._height = height ?? value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/**
|
||||
* Retrieves the size of the NineSliceSprite 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 NineSliceSprite.
|
||||
*/
|
||||
getSize(out) {
|
||||
out || (out = {});
|
||||
out.width = this._width;
|
||||
out.height = this._height;
|
||||
return out;
|
||||
}
|
||||
/** The width of the left column (a) of the NineSliceSprite. */
|
||||
get leftWidth() {
|
||||
return this._leftWidth;
|
||||
}
|
||||
set leftWidth(value) {
|
||||
this._leftWidth = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get topHeight() {
|
||||
return this._topHeight;
|
||||
}
|
||||
set topHeight(value) {
|
||||
this._topHeight = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get rightWidth() {
|
||||
return this._rightWidth;
|
||||
}
|
||||
set rightWidth(value) {
|
||||
this._rightWidth = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get bottomHeight() {
|
||||
return this._bottomHeight;
|
||||
}
|
||||
set bottomHeight(value) {
|
||||
this._bottomHeight = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The texture that the NineSliceSprite is using. */
|
||||
get texture() {
|
||||
return this._texture;
|
||||
}
|
||||
set texture(value) {
|
||||
value || (value = Texture.Texture.EMPTY);
|
||||
const currentTexture = this._texture;
|
||||
if (currentTexture === value)
|
||||
return;
|
||||
if (currentTexture && currentTexture.dynamic)
|
||||
currentTexture.off("update", this.onViewUpdate, this);
|
||||
if (value.dynamic)
|
||||
value.on("update", this.onViewUpdate, this);
|
||||
this._texture = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The original width of the texture */
|
||||
get originalWidth() {
|
||||
return this._texture.width;
|
||||
}
|
||||
/** The original height of the texture */
|
||||
get originalHeight() {
|
||||
return this._texture.height;
|
||||
}
|
||||
onViewUpdate() {
|
||||
this._didViewChangeTick++;
|
||||
this._didSpriteUpdate = true;
|
||||
if (this.didViewUpdate)
|
||||
return;
|
||||
this.didViewUpdate = true;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.onChildViewUpdate(this);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds the bounds of this object to the bounds object.
|
||||
* @param bounds - The output bounds object.
|
||||
*/
|
||||
addBounds(bounds) {
|
||||
const _bounds = this.bounds;
|
||||
bounds.addFrame(_bounds.minX, _bounds.minY, _bounds.maxX, _bounds.maxY);
|
||||
}
|
||||
/**
|
||||
* Destroys this sprite renderable and optionally its texture.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well
|
||||
* @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well
|
||||
*/
|
||||
destroy(options) {
|
||||
super.destroy(options);
|
||||
const destroyTexture = typeof options === "boolean" ? options : options?.texture;
|
||||
if (destroyTexture) {
|
||||
const destroyTextureSource = typeof options === "boolean" ? options : options?.textureSource;
|
||||
this._texture.destroy(destroyTextureSource);
|
||||
}
|
||||
this._texture = null;
|
||||
}
|
||||
};
|
||||
/** The default options, used to override the initial values of any options passed in the constructor. */
|
||||
_NineSliceSprite.defaultOptions = {
|
||||
/** @default Texture.EMPTY */
|
||||
texture: Texture.Texture.EMPTY
|
||||
};
|
||||
let NineSliceSprite = _NineSliceSprite;
|
||||
class NineSlicePlane extends NineSliceSprite {
|
||||
constructor(...args) {
|
||||
let options = args[0];
|
||||
if (options instanceof Texture.Texture) {
|
||||
deprecation.deprecation(deprecation.v8_0_0, "NineSlicePlane now uses the options object {texture, leftWidth, rightWidth, topHeight, bottomHeight}");
|
||||
options = {
|
||||
texture: options,
|
||||
leftWidth: args[1],
|
||||
topHeight: args[2],
|
||||
rightWidth: args[3],
|
||||
bottomHeight: args[4]
|
||||
};
|
||||
}
|
||||
deprecation.deprecation(deprecation.v8_0_0, "NineSlicePlane is deprecated. Use NineSliceSprite instead.");
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
|
||||
exports.NineSlicePlane = NineSlicePlane;
|
||||
exports.NineSliceSprite = NineSliceSprite;
|
||||
//# sourceMappingURL=NineSliceSprite.js.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
217
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.mjs
generated
vendored
Normal file
217
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.mjs
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
import { Texture } from '../../rendering/renderers/shared/texture/Texture.mjs';
|
||||
import { deprecation, v8_0_0 } from '../../utils/logging/deprecation.mjs';
|
||||
import { ViewContainer } from '../view/View.mjs';
|
||||
import { NineSliceGeometry } from './NineSliceGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
const _NineSliceSprite = class _NineSliceSprite extends ViewContainer {
|
||||
/**
|
||||
* @param {scene.NineSliceSpriteOptions|Texture} options - Options to use
|
||||
* @param options.texture - The texture to use on the NineSliceSprite.
|
||||
* @param options.leftWidth - Width of the left vertical bar (A)
|
||||
* @param options.topHeight - Height of the top horizontal bar (C)
|
||||
* @param options.rightWidth - Width of the right vertical bar (B)
|
||||
* @param options.bottomHeight - Height of the bottom horizontal bar (D)
|
||||
* @param options.width - Width of the NineSliceSprite,
|
||||
* setting this will actually modify the vertices and not the UV's of this plane.
|
||||
* @param options.height - Height of the NineSliceSprite,
|
||||
* setting this will actually modify the vertices and not UV's of this plane.
|
||||
*/
|
||||
constructor(options) {
|
||||
if (options instanceof Texture) {
|
||||
options = { texture: options };
|
||||
}
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
leftWidth,
|
||||
rightWidth,
|
||||
topHeight,
|
||||
bottomHeight,
|
||||
texture,
|
||||
roundPixels,
|
||||
...rest
|
||||
} = options;
|
||||
super({
|
||||
label: "NineSliceSprite",
|
||||
...rest
|
||||
});
|
||||
this.renderPipeId = "nineSliceSprite";
|
||||
this.batched = true;
|
||||
this._didSpriteUpdate = true;
|
||||
this._leftWidth = leftWidth ?? texture?.defaultBorders?.left ?? NineSliceGeometry.defaultOptions.leftWidth;
|
||||
this._topHeight = topHeight ?? texture?.defaultBorders?.top ?? NineSliceGeometry.defaultOptions.topHeight;
|
||||
this._rightWidth = rightWidth ?? texture?.defaultBorders?.right ?? NineSliceGeometry.defaultOptions.rightWidth;
|
||||
this._bottomHeight = bottomHeight ?? texture?.defaultBorders?.bottom ?? NineSliceGeometry.defaultOptions.bottomHeight;
|
||||
this.bounds.maxX = this._width = width ?? texture.width ?? NineSliceGeometry.defaultOptions.width;
|
||||
this.bounds.maxY = this._height = height ?? texture.height ?? NineSliceGeometry.defaultOptions.height;
|
||||
this.allowChildren = false;
|
||||
this.texture = texture ?? _NineSliceSprite.defaultOptions.texture;
|
||||
this.roundPixels = roundPixels ?? false;
|
||||
}
|
||||
/** The local bounds of the view. */
|
||||
get bounds() {
|
||||
return this._bounds;
|
||||
}
|
||||
/** The width of the NineSliceSprite, setting this will actually modify the vertices and UV's of this plane. */
|
||||
get width() {
|
||||
return this._width;
|
||||
}
|
||||
set width(value) {
|
||||
this.bounds.maxX = this._width = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The height of the NineSliceSprite, setting this will actually modify the vertices and UV's of this plane. */
|
||||
get height() {
|
||||
return this._height;
|
||||
}
|
||||
set height(value) {
|
||||
this.bounds.maxY = this._height = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/**
|
||||
* Sets the size of the NiceSliceSprite to the specified width and height.
|
||||
* setting this will actually modify the vertices and UV's of this plane
|
||||
* 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.
|
||||
*/
|
||||
setSize(value, height) {
|
||||
if (typeof value === "object") {
|
||||
height = value.height ?? value.width;
|
||||
value = value.width;
|
||||
}
|
||||
this.bounds.maxX = this._width = value;
|
||||
this.bounds.maxY = this._height = height ?? value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/**
|
||||
* Retrieves the size of the NineSliceSprite 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 NineSliceSprite.
|
||||
*/
|
||||
getSize(out) {
|
||||
out || (out = {});
|
||||
out.width = this._width;
|
||||
out.height = this._height;
|
||||
return out;
|
||||
}
|
||||
/** The width of the left column (a) of the NineSliceSprite. */
|
||||
get leftWidth() {
|
||||
return this._leftWidth;
|
||||
}
|
||||
set leftWidth(value) {
|
||||
this._leftWidth = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get topHeight() {
|
||||
return this._topHeight;
|
||||
}
|
||||
set topHeight(value) {
|
||||
this._topHeight = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get rightWidth() {
|
||||
return this._rightWidth;
|
||||
}
|
||||
set rightWidth(value) {
|
||||
this._rightWidth = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The width of the right column (b) of the NineSliceSprite. */
|
||||
get bottomHeight() {
|
||||
return this._bottomHeight;
|
||||
}
|
||||
set bottomHeight(value) {
|
||||
this._bottomHeight = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The texture that the NineSliceSprite is using. */
|
||||
get texture() {
|
||||
return this._texture;
|
||||
}
|
||||
set texture(value) {
|
||||
value || (value = Texture.EMPTY);
|
||||
const currentTexture = this._texture;
|
||||
if (currentTexture === value)
|
||||
return;
|
||||
if (currentTexture && currentTexture.dynamic)
|
||||
currentTexture.off("update", this.onViewUpdate, this);
|
||||
if (value.dynamic)
|
||||
value.on("update", this.onViewUpdate, this);
|
||||
this._texture = value;
|
||||
this.onViewUpdate();
|
||||
}
|
||||
/** The original width of the texture */
|
||||
get originalWidth() {
|
||||
return this._texture.width;
|
||||
}
|
||||
/** The original height of the texture */
|
||||
get originalHeight() {
|
||||
return this._texture.height;
|
||||
}
|
||||
onViewUpdate() {
|
||||
this._didViewChangeTick++;
|
||||
this._didSpriteUpdate = true;
|
||||
if (this.didViewUpdate)
|
||||
return;
|
||||
this.didViewUpdate = true;
|
||||
const renderGroup = this.renderGroup || this.parentRenderGroup;
|
||||
if (renderGroup) {
|
||||
renderGroup.onChildViewUpdate(this);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds the bounds of this object to the bounds object.
|
||||
* @param bounds - The output bounds object.
|
||||
*/
|
||||
addBounds(bounds) {
|
||||
const _bounds = this.bounds;
|
||||
bounds.addFrame(_bounds.minX, _bounds.minY, _bounds.maxX, _bounds.maxY);
|
||||
}
|
||||
/**
|
||||
* Destroys this sprite renderable and optionally its texture.
|
||||
* @param options - Options parameter. A boolean will act as if all options
|
||||
* have been set to that value
|
||||
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the renderable as well
|
||||
* @param {boolean} [options.textureSource=false] - Should it destroy the textureSource of the renderable as well
|
||||
*/
|
||||
destroy(options) {
|
||||
super.destroy(options);
|
||||
const destroyTexture = typeof options === "boolean" ? options : options?.texture;
|
||||
if (destroyTexture) {
|
||||
const destroyTextureSource = typeof options === "boolean" ? options : options?.textureSource;
|
||||
this._texture.destroy(destroyTextureSource);
|
||||
}
|
||||
this._texture = null;
|
||||
}
|
||||
};
|
||||
/** The default options, used to override the initial values of any options passed in the constructor. */
|
||||
_NineSliceSprite.defaultOptions = {
|
||||
/** @default Texture.EMPTY */
|
||||
texture: Texture.EMPTY
|
||||
};
|
||||
let NineSliceSprite = _NineSliceSprite;
|
||||
class NineSlicePlane extends NineSliceSprite {
|
||||
constructor(...args) {
|
||||
let options = args[0];
|
||||
if (options instanceof Texture) {
|
||||
deprecation(v8_0_0, "NineSlicePlane now uses the options object {texture, leftWidth, rightWidth, topHeight, bottomHeight}");
|
||||
options = {
|
||||
texture: options,
|
||||
leftWidth: args[1],
|
||||
topHeight: args[2],
|
||||
rightWidth: args[3],
|
||||
bottomHeight: args[4]
|
||||
};
|
||||
}
|
||||
deprecation(v8_0_0, "NineSlicePlane is deprecated. Use NineSliceSprite instead.");
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
|
||||
export { NineSlicePlane, NineSliceSprite };
|
||||
//# sourceMappingURL=NineSliceSprite.mjs.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSprite.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.d.ts
generated
vendored
Normal file
24
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions';
|
||||
import type { InstructionSet } from '../../rendering/renderers/shared/instructions/InstructionSet';
|
||||
import type { RenderPipe } from '../../rendering/renderers/shared/instructions/RenderPipe';
|
||||
import type { Renderer } from '../../rendering/renderers/types';
|
||||
import type { NineSliceSprite } from './NineSliceSprite';
|
||||
export declare class NineSliceSpritePipe implements RenderPipe<NineSliceSprite> {
|
||||
/** @ignore */
|
||||
static extension: {
|
||||
readonly type: readonly [ExtensionType.WebGLPipes, ExtensionType.WebGPUPipes, ExtensionType.CanvasPipes];
|
||||
readonly name: "nineSliceSprite";
|
||||
};
|
||||
private readonly _renderer;
|
||||
private readonly _gpuSpriteHash;
|
||||
private readonly _destroyRenderableBound;
|
||||
constructor(renderer: Renderer);
|
||||
addRenderable(sprite: NineSliceSprite, instructionSet: InstructionSet): void;
|
||||
updateRenderable(sprite: NineSliceSprite): void;
|
||||
validateRenderable(sprite: NineSliceSprite): boolean;
|
||||
destroyRenderable(sprite: NineSliceSprite): void;
|
||||
private _updateBatchableSprite;
|
||||
private _getGpuSprite;
|
||||
private _initGPUSprite;
|
||||
destroy(): void;
|
||||
}
|
82
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.js
generated
vendored
Normal file
82
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../extensions/Extensions.js');
|
||||
var PoolGroup = require('../../utils/pool/PoolGroup.js');
|
||||
var BatchableMesh = require('../mesh/shared/BatchableMesh.js');
|
||||
var NineSliceGeometry = require('./NineSliceGeometry.js');
|
||||
|
||||
"use strict";
|
||||
class NineSliceSpritePipe {
|
||||
constructor(renderer) {
|
||||
this._gpuSpriteHash = /* @__PURE__ */ Object.create(null);
|
||||
this._destroyRenderableBound = this.destroyRenderable.bind(this);
|
||||
this._renderer = renderer;
|
||||
}
|
||||
addRenderable(sprite, instructionSet) {
|
||||
const gpuSprite = this._getGpuSprite(sprite);
|
||||
if (sprite._didSpriteUpdate)
|
||||
this._updateBatchableSprite(sprite, gpuSprite);
|
||||
this._renderer.renderPipes.batch.addToBatch(gpuSprite, instructionSet);
|
||||
}
|
||||
updateRenderable(sprite) {
|
||||
const gpuSprite = this._gpuSpriteHash[sprite.uid];
|
||||
if (sprite._didSpriteUpdate)
|
||||
this._updateBatchableSprite(sprite, gpuSprite);
|
||||
gpuSprite._batcher.updateElement(gpuSprite);
|
||||
}
|
||||
validateRenderable(sprite) {
|
||||
const texture = sprite._texture;
|
||||
const gpuSprite = this._getGpuSprite(sprite);
|
||||
if (gpuSprite.texture._source !== texture._source) {
|
||||
return !gpuSprite._batcher.checkAndUpdateTexture(gpuSprite, texture);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
destroyRenderable(sprite) {
|
||||
const batchableMesh = this._gpuSpriteHash[sprite.uid];
|
||||
PoolGroup.BigPool.return(batchableMesh.geometry);
|
||||
PoolGroup.BigPool.return(batchableMesh);
|
||||
this._gpuSpriteHash[sprite.uid] = null;
|
||||
sprite.off("destroyed", this._destroyRenderableBound);
|
||||
}
|
||||
_updateBatchableSprite(sprite, batchableSprite) {
|
||||
sprite._didSpriteUpdate = false;
|
||||
batchableSprite.geometry.update(sprite);
|
||||
batchableSprite.texture = sprite._texture;
|
||||
}
|
||||
_getGpuSprite(sprite) {
|
||||
return this._gpuSpriteHash[sprite.uid] || this._initGPUSprite(sprite);
|
||||
}
|
||||
_initGPUSprite(sprite) {
|
||||
const batchableMesh = PoolGroup.BigPool.get(BatchableMesh.BatchableMesh);
|
||||
batchableMesh.geometry = PoolGroup.BigPool.get(NineSliceGeometry.NineSliceGeometry);
|
||||
batchableMesh.renderable = sprite;
|
||||
batchableMesh.transform = sprite.groupTransform;
|
||||
batchableMesh.texture = sprite._texture;
|
||||
batchableMesh.roundPixels = this._renderer._roundPixels | sprite._roundPixels;
|
||||
sprite._didSpriteUpdate = true;
|
||||
this._gpuSpriteHash[sprite.uid] = batchableMesh;
|
||||
sprite.on("destroyed", this._destroyRenderableBound);
|
||||
return batchableMesh;
|
||||
}
|
||||
destroy() {
|
||||
for (const i in this._gpuSpriteHash) {
|
||||
const batchableMesh = this._gpuSpriteHash[i];
|
||||
batchableMesh.geometry.destroy();
|
||||
}
|
||||
this._gpuSpriteHash = null;
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
NineSliceSpritePipe.extension = {
|
||||
type: [
|
||||
Extensions.ExtensionType.WebGLPipes,
|
||||
Extensions.ExtensionType.WebGPUPipes,
|
||||
Extensions.ExtensionType.CanvasPipes
|
||||
],
|
||||
name: "nineSliceSprite"
|
||||
};
|
||||
|
||||
exports.NineSliceSpritePipe = NineSliceSpritePipe;
|
||||
//# sourceMappingURL=NineSliceSpritePipe.js.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
80
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.mjs
generated
vendored
Normal file
80
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.mjs
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import { ExtensionType } from '../../extensions/Extensions.mjs';
|
||||
import { BigPool } from '../../utils/pool/PoolGroup.mjs';
|
||||
import { BatchableMesh } from '../mesh/shared/BatchableMesh.mjs';
|
||||
import { NineSliceGeometry } from './NineSliceGeometry.mjs';
|
||||
|
||||
"use strict";
|
||||
class NineSliceSpritePipe {
|
||||
constructor(renderer) {
|
||||
this._gpuSpriteHash = /* @__PURE__ */ Object.create(null);
|
||||
this._destroyRenderableBound = this.destroyRenderable.bind(this);
|
||||
this._renderer = renderer;
|
||||
}
|
||||
addRenderable(sprite, instructionSet) {
|
||||
const gpuSprite = this._getGpuSprite(sprite);
|
||||
if (sprite._didSpriteUpdate)
|
||||
this._updateBatchableSprite(sprite, gpuSprite);
|
||||
this._renderer.renderPipes.batch.addToBatch(gpuSprite, instructionSet);
|
||||
}
|
||||
updateRenderable(sprite) {
|
||||
const gpuSprite = this._gpuSpriteHash[sprite.uid];
|
||||
if (sprite._didSpriteUpdate)
|
||||
this._updateBatchableSprite(sprite, gpuSprite);
|
||||
gpuSprite._batcher.updateElement(gpuSprite);
|
||||
}
|
||||
validateRenderable(sprite) {
|
||||
const texture = sprite._texture;
|
||||
const gpuSprite = this._getGpuSprite(sprite);
|
||||
if (gpuSprite.texture._source !== texture._source) {
|
||||
return !gpuSprite._batcher.checkAndUpdateTexture(gpuSprite, texture);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
destroyRenderable(sprite) {
|
||||
const batchableMesh = this._gpuSpriteHash[sprite.uid];
|
||||
BigPool.return(batchableMesh.geometry);
|
||||
BigPool.return(batchableMesh);
|
||||
this._gpuSpriteHash[sprite.uid] = null;
|
||||
sprite.off("destroyed", this._destroyRenderableBound);
|
||||
}
|
||||
_updateBatchableSprite(sprite, batchableSprite) {
|
||||
sprite._didSpriteUpdate = false;
|
||||
batchableSprite.geometry.update(sprite);
|
||||
batchableSprite.texture = sprite._texture;
|
||||
}
|
||||
_getGpuSprite(sprite) {
|
||||
return this._gpuSpriteHash[sprite.uid] || this._initGPUSprite(sprite);
|
||||
}
|
||||
_initGPUSprite(sprite) {
|
||||
const batchableMesh = BigPool.get(BatchableMesh);
|
||||
batchableMesh.geometry = BigPool.get(NineSliceGeometry);
|
||||
batchableMesh.renderable = sprite;
|
||||
batchableMesh.transform = sprite.groupTransform;
|
||||
batchableMesh.texture = sprite._texture;
|
||||
batchableMesh.roundPixels = this._renderer._roundPixels | sprite._roundPixels;
|
||||
sprite._didSpriteUpdate = true;
|
||||
this._gpuSpriteHash[sprite.uid] = batchableMesh;
|
||||
sprite.on("destroyed", this._destroyRenderableBound);
|
||||
return batchableMesh;
|
||||
}
|
||||
destroy() {
|
||||
for (const i in this._gpuSpriteHash) {
|
||||
const batchableMesh = this._gpuSpriteHash[i];
|
||||
batchableMesh.geometry.destroy();
|
||||
}
|
||||
this._gpuSpriteHash = null;
|
||||
this._renderer = null;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
NineSliceSpritePipe.extension = {
|
||||
type: [
|
||||
ExtensionType.WebGLPipes,
|
||||
ExtensionType.WebGPUPipes,
|
||||
ExtensionType.CanvasPipes
|
||||
],
|
||||
name: "nineSliceSprite"
|
||||
};
|
||||
|
||||
export { NineSliceSpritePipe };
|
||||
//# sourceMappingURL=NineSliceSpritePipe.mjs.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/NineSliceSpritePipe.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
8
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.js
generated
vendored
Normal file
8
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../extensions/Extensions.js');
|
||||
var NineSliceSpritePipe = require('./NineSliceSpritePipe.js');
|
||||
|
||||
"use strict";
|
||||
Extensions.extensions.add(NineSliceSpritePipe.NineSliceSpritePipe);
|
||||
//# sourceMappingURL=init.js.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.js","sources":["../../../src/scene/sprite-nine-slice/init.ts"],"sourcesContent":["import { extensions } from '../../extensions/Extensions';\nimport { NineSliceSpritePipe } from './NineSliceSpritePipe';\n\nextensions.add(NineSliceSpritePipe);\n"],"names":["extensions","NineSliceSpritePipe"],"mappings":";;;;;;AAGAA,qBAAA,CAAW,IAAIC,uCAAmB,CAAA;;"}
|
6
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.mjs
generated
vendored
Normal file
6
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { extensions } from '../../extensions/Extensions.mjs';
|
||||
import { NineSliceSpritePipe } from './NineSliceSpritePipe.mjs';
|
||||
|
||||
"use strict";
|
||||
extensions.add(NineSliceSpritePipe);
|
||||
//# sourceMappingURL=init.mjs.map
|
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-nine-slice/init.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.mjs","sources":["../../../src/scene/sprite-nine-slice/init.ts"],"sourcesContent":["import { extensions } from '../../extensions/Extensions';\nimport { NineSliceSpritePipe } from './NineSliceSpritePipe';\n\nextensions.add(NineSliceSpritePipe);\n"],"names":[],"mappings":";;;;AAGA,UAAA,CAAW,IAAI,mBAAmB,CAAA"}
|
Reference in New Issue
Block a user