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/graphics/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.

View File

@@ -0,0 +1,554 @@
"use strict";
var core = require("@pixi/core"), display = require("@pixi/display"), _const = require("./const.js"), GraphicsGeometry = require("./GraphicsGeometry.js"), FillStyle = require("./styles/FillStyle.js"), LineStyle = require("./styles/LineStyle.js");
require("./utils/index.js");
var QuadraticUtils = require("./utils/QuadraticUtils.js"), BezierUtils = require("./utils/BezierUtils.js"), ArcUtils = require("./utils/ArcUtils.js");
const DEFAULT_SHADERS = {}, _Graphics = class _Graphics2 extends display.Container {
/**
* @param geometry - Geometry to use, if omitted will create a new GraphicsGeometry instance.
*/
constructor(geometry = null) {
super(), this.shader = null, this.pluginName = "batch", this.currentPath = null, this.batches = [], this.batchTint = -1, this.batchDirty = -1, this.vertexData = null, this._fillStyle = new FillStyle.FillStyle(), this._lineStyle = new LineStyle.LineStyle(), this._matrix = null, this._holeMode = !1, this.state = core.State.for2d(), this._geometry = geometry || new GraphicsGeometry.GraphicsGeometry(), this._geometry.refCount++, this._transformID = -1, this._tintColor = new core.Color(16777215), this.blendMode = core.BLEND_MODES.NORMAL;
}
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh or Graphics objects.
* @readonly
*/
get geometry() {
return this._geometry;
}
/**
* Creates a new Graphics object with the same values as this one.
* Note that only the geometry of the object is cloned, not its transform (position,scale,etc)
* @returns - A clone of the graphics object
*/
clone() {
return this.finishPoly(), new _Graphics2(this._geometry);
}
/**
* The blend mode to be applied to the graphic shape. Apply a value of
* `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. Note that, since each
* primitive in the GraphicsGeometry list is rendered sequentially, modes
* such as `PIXI.BLEND_MODES.ADD` and `PIXI.BLEND_MODES.MULTIPLY` will
* be applied per-primitive.
* @default PIXI.BLEND_MODES.NORMAL
*/
set blendMode(value) {
this.state.blendMode = value;
}
get blendMode() {
return this.state.blendMode;
}
/**
* The tint applied to each graphic shape. This is a hex value. A value of
* 0xFFFFFF will remove any tint effect.
* @default 0xFFFFFF
*/
get tint() {
return this._tintColor.value;
}
set tint(value) {
this._tintColor.setValue(value);
}
/**
* The current fill style.
* @readonly
*/
get fill() {
return this._fillStyle;
}
/**
* The current line style.
* @readonly
*/
get line() {
return this._lineStyle;
}
lineStyle(options = null, color = 0, alpha, alignment = 0.5, native = !1) {
return typeof options == "number" && (options = { width: options, color, alpha, alignment, native }), this.lineTextureStyle(options);
}
/**
* Like line style but support texture for line fill.
* @param [options] - Collection of options for setting line style.
* @param {number} [options.width=0] - width of the line to draw, will update the objects stored style
* @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use
* @param {PIXI.ColorSource} [options.color=0x0] - color of the line to draw, will update the objects stored style.
* Default 0xFFFFFF if texture present.
* @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style
* @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture
* @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer).
* WebGL only.
* @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP
* @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style
* @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style
* @param {number}[options.miterLimit=10] - miter limit ratio
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls
*/
lineTextureStyle(options) {
const defaultLineStyleOptions = {
width: 0,
texture: core.Texture.WHITE,
color: options?.texture ? 16777215 : 0,
matrix: null,
alignment: 0.5,
native: !1,
cap: _const.LINE_CAP.BUTT,
join: _const.LINE_JOIN.MITER,
miterLimit: 10
};
options = Object.assign(defaultLineStyleOptions, options), this.normalizeColor(options), this.currentPath && this.startPoly();
const visible = options.width > 0 && options.alpha > 0;
return visible ? (options.matrix && (options.matrix = options.matrix.clone(), options.matrix.invert()), Object.assign(this._lineStyle, { visible }, options)) : this._lineStyle.reset(), this;
}
/**
* Start a polygon object internally.
* @protected
*/
startPoly() {
if (this.currentPath) {
const points = this.currentPath.points, len = this.currentPath.points.length;
len > 2 && (this.drawShape(this.currentPath), this.currentPath = new core.Polygon(), this.currentPath.closeStroke = !1, this.currentPath.points.push(points[len - 2], points[len - 1]));
} else
this.currentPath = new core.Polygon(), this.currentPath.closeStroke = !1;
}
/**
* Finish the polygon object.
* @protected
*/
finishPoly() {
this.currentPath && (this.currentPath.points.length > 2 ? (this.drawShape(this.currentPath), this.currentPath = null) : this.currentPath.points.length = 0);
}
/**
* Moves the current drawing position to x, y.
* @param x - the X coordinate to move to
* @param y - the Y coordinate to move to
* @returns - This Graphics object. Good for chaining method calls
*/
moveTo(x, y) {
return this.startPoly(), this.currentPath.points[0] = x, this.currentPath.points[1] = y, this;
}
/**
* Draws a line using the current line style from the current drawing position to (x, y);
* The current drawing position is then set to (x, y).
* @param x - the X coordinate to draw to
* @param y - the Y coordinate to draw to
* @returns - This Graphics object. Good for chaining method calls
*/
lineTo(x, y) {
this.currentPath || this.moveTo(0, 0);
const points = this.currentPath.points, fromX = points[points.length - 2], fromY = points[points.length - 1];
return (fromX !== x || fromY !== y) && points.push(x, y), this;
}
/**
* Initialize the curve
* @param x
* @param y
*/
_initCurve(x = 0, y = 0) {
this.currentPath ? this.currentPath.points.length === 0 && (this.currentPath.points = [x, y]) : this.moveTo(x, y);
}
/**
* Calculate the points for a quadratic bezier curve and then draws it.
* Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
* @param cpX - Control point x
* @param cpY - Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @returns - This Graphics object. Good for chaining method calls
*/
quadraticCurveTo(cpX, cpY, toX, toY) {
this._initCurve();
const points = this.currentPath.points;
return points.length === 0 && this.moveTo(0, 0), QuadraticUtils.QuadraticUtils.curveTo(cpX, cpY, toX, toY, points), this;
}
/**
* Calculate the points for a bezier curve and then draws it.
* @param cpX - Control point x
* @param cpY - Control point y
* @param cpX2 - Second Control point x
* @param cpY2 - Second Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @returns This Graphics object. Good for chaining method calls
*/
bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) {
return this._initCurve(), BezierUtils.BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points), this;
}
/**
* The `arcTo` method creates an arc/curve between two tangents on the canvas.
* The first tangent is from the start point to the first control point,
* and the second tangent is from the first control point to the second control point.
* Note that the second control point is not necessarily the end point of the arc.
*
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
* @param x1 - The x-coordinate of the first control point of the arc
* @param y1 - The y-coordinate of the first control point of the arc
* @param x2 - The x-coordinate of the second control point of the arc
* @param y2 - The y-coordinate of the second control point of the arc
* @param radius - The radius of the arc
* @returns - This Graphics object. Good for chaining method calls
*/
arcTo(x1, y1, x2, y2, radius) {
this._initCurve(x1, y1);
const points = this.currentPath.points, result = ArcUtils.ArcUtils.curveTo(x1, y1, x2, y2, radius, points);
if (result) {
const { cx, cy, radius: radius2, startAngle, endAngle, anticlockwise } = result;
this.arc(cx, cy, radius2, startAngle, endAngle, anticlockwise);
}
return this;
}
/**
* The arc method creates an arc/curve (used to create circles, or parts of circles).
* @param cx - The x-coordinate of the center of the circle
* @param cy - The y-coordinate of the center of the circle
* @param radius - The radius of the circle
* @param startAngle - The starting angle, in radians (0 is at the 3 o'clock position
* of the arc's circle)
* @param endAngle - The ending angle, in radians
* @param anticlockwise - Specifies whether the drawing should be
* counter-clockwise or clockwise. False is default, and indicates clockwise, while true
* indicates counter-clockwise.
* @returns - This Graphics object. Good for chaining method calls
*/
arc(cx, cy, radius, startAngle, endAngle, anticlockwise = !1) {
if (startAngle === endAngle)
return this;
if (!anticlockwise && endAngle <= startAngle ? endAngle += core.PI_2 : anticlockwise && startAngle <= endAngle && (startAngle += core.PI_2), endAngle - startAngle === 0)
return this;
const startX = cx + Math.cos(startAngle) * radius, startY = cy + Math.sin(startAngle) * radius, eps = this._geometry.closePointEps;
let points = this.currentPath ? this.currentPath.points : null;
if (points) {
const xDiff = Math.abs(points[points.length - 2] - startX), yDiff = Math.abs(points[points.length - 1] - startY);
xDiff < eps && yDiff < eps || points.push(startX, startY);
} else
this.moveTo(startX, startY), points = this.currentPath.points;
return ArcUtils.ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points), this;
}
/**
* Specifies a simple one-color fill that subsequent calls to other Graphics methods
* (such as lineTo() or drawCircle()) use when drawing.
* @param {PIXI.ColorSource} color - the color of the fill
* @param alpha - the alpha of the fill, will override the color's alpha
* @returns - This Graphics object. Suitable for chaining method calls
*/
beginFill(color = 0, alpha) {
return this.beginTextureFill({ texture: core.Texture.WHITE, color, alpha });
}
/**
* Normalize the color input from options for line style or fill
* @param {PIXI.IFillStyleOptions} options - Fill style object.
*/
normalizeColor(options) {
const temp = core.Color.shared.setValue(options.color ?? 0);
options.color = temp.toNumber(), options.alpha ?? (options.alpha = temp.alpha);
}
/**
* Begin the texture fill.
* Note: The wrap mode of the texture is forced to REPEAT on render.
* @param options - Fill style object.
* @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill
* @param {PIXI.ColorSource} [options.color=0xffffff] - Background to fill behind texture
* @param {number} [options.alpha] - Alpha of fill, overrides the color's alpha
* @param {PIXI.Matrix} [options.matrix=null] - Transform matrix
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls
*/
beginTextureFill(options) {
const defaultOptions = {
texture: core.Texture.WHITE,
color: 16777215,
matrix: null
};
options = Object.assign(defaultOptions, options), this.normalizeColor(options), this.currentPath && this.startPoly();
const visible = options.alpha > 0;
return visible ? (options.matrix && (options.matrix = options.matrix.clone(), options.matrix.invert()), Object.assign(this._fillStyle, { visible }, options)) : this._fillStyle.reset(), this;
}
/**
* Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.
* @returns - This Graphics object. Good for chaining method calls
*/
endFill() {
return this.finishPoly(), this._fillStyle.reset(), this;
}
/**
* Draws a rectangle shape.
* @param x - The X coord of the top-left of the rectangle
* @param y - The Y coord of the top-left of the rectangle
* @param width - The width of the rectangle
* @param height - The height of the rectangle
* @returns - This Graphics object. Good for chaining method calls
*/
drawRect(x, y, width, height) {
return this.drawShape(new core.Rectangle(x, y, width, height));
}
/**
* Draw a rectangle shape with rounded/beveled corners.
* @param x - The X coord of the top-left of the rectangle
* @param y - The Y coord of the top-left of the rectangle
* @param width - The width of the rectangle
* @param height - The height of the rectangle
* @param radius - Radius of the rectangle corners
* @returns - This Graphics object. Good for chaining method calls
*/
drawRoundedRect(x, y, width, height, radius) {
return this.drawShape(new core.RoundedRectangle(x, y, width, height, radius));
}
/**
* Draws a circle.
* @param x - The X coordinate of the center of the circle
* @param y - The Y coordinate of the center of the circle
* @param radius - The radius of the circle
* @returns - This Graphics object. Good for chaining method calls
*/
drawCircle(x, y, radius) {
return this.drawShape(new core.Circle(x, y, radius));
}
/**
* Draws an ellipse.
* @param x - The X coordinate of the center of the ellipse
* @param y - The Y coordinate of the center of the ellipse
* @param width - The half width of the ellipse
* @param height - The half height of the ellipse
* @returns - This Graphics object. Good for chaining method calls
*/
drawEllipse(x, y, width, height) {
return this.drawShape(new core.Ellipse(x, y, width, height));
}
/**
* Draws a polygon using the given path.
* @param {number[]|PIXI.IPointData[]|PIXI.Polygon} path - The path data used to construct the polygon.
* @returns - This Graphics object. Good for chaining method calls
*/
drawPolygon(...path) {
let points, closeStroke = !0;
const poly = path[0];
poly.points ? (closeStroke = poly.closeStroke, points = poly.points) : Array.isArray(path[0]) ? points = path[0] : points = path;
const shape = new core.Polygon(points);
return shape.closeStroke = closeStroke, this.drawShape(shape), this;
}
/**
* Draw any shape.
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw
* @returns - This Graphics object. Good for chaining method calls
*/
drawShape(shape) {
return this._holeMode ? this._geometry.drawHole(shape, this._matrix) : this._geometry.drawShape(
shape,
this._fillStyle.clone(),
this._lineStyle.clone(),
this._matrix
), this;
}
/**
* Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
* @returns - This Graphics object. Good for chaining method calls
*/
clear() {
return this._geometry.clear(), this._lineStyle.reset(), this._fillStyle.reset(), this._boundsID++, this._matrix = null, this._holeMode = !1, this.currentPath = null, this;
}
/**
* True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and
* masked with gl.scissor.
* @returns - True if only 1 rect.
*/
isFastRect() {
const data = this._geometry.graphicsData;
return data.length === 1 && data[0].shape.type === core.SHAPES.RECT && !data[0].matrix && !data[0].holes.length && !(data[0].lineStyle.visible && data[0].lineStyle.width);
}
/**
* Renders the object using the WebGL renderer
* @param renderer - The renderer
*/
_render(renderer) {
this.finishPoly();
const geometry = this._geometry;
geometry.updateBatches(), geometry.batchable ? (this.batchDirty !== geometry.batchDirty && this._populateBatches(), this._renderBatched(renderer)) : (renderer.batch.flush(), this._renderDirect(renderer));
}
/** Populating batches for rendering. */
_populateBatches() {
const geometry = this._geometry, blendMode = this.blendMode, len = geometry.batches.length;
this.batchTint = -1, this._transformID = -1, this.batchDirty = geometry.batchDirty, this.batches.length = len, this.vertexData = new Float32Array(geometry.points);
for (let i = 0; i < len; i++) {
const gI = geometry.batches[i], color = gI.style.color, vertexData = new Float32Array(
this.vertexData.buffer,
gI.attribStart * 4 * 2,
gI.attribSize * 2
), uvs = new Float32Array(
geometry.uvsFloat32.buffer,
gI.attribStart * 4 * 2,
gI.attribSize * 2
), indices = new Uint16Array(
geometry.indicesUint16.buffer,
gI.start * 2,
gI.size
), batch = {
vertexData,
blendMode,
indices,
uvs,
_batchRGB: core.Color.shared.setValue(color).toRgbArray(),
_tintRGB: color,
_texture: gI.style.texture,
alpha: gI.style.alpha,
worldAlpha: 1
};
this.batches[i] = batch;
}
}
/**
* Renders the batches using the BathedRenderer plugin
* @param renderer - The renderer
*/
_renderBatched(renderer) {
if (this.batches.length) {
renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]), this.calculateVertices(), this.calculateTints();
for (let i = 0, l = this.batches.length; i < l; i++) {
const batch = this.batches[i];
batch.worldAlpha = this.worldAlpha * batch.alpha, renderer.plugins[this.pluginName].render(batch);
}
}
}
/**
* Renders the graphics direct
* @param renderer - The renderer
*/
_renderDirect(renderer) {
const shader = this._resolveDirectShader(renderer), geometry = this._geometry, worldAlpha = this.worldAlpha, uniforms = shader.uniforms, drawCalls = geometry.drawCalls;
uniforms.translationMatrix = this.transform.worldTransform, core.Color.shared.setValue(this._tintColor).premultiply(worldAlpha).toArray(uniforms.tint), renderer.shader.bind(shader), renderer.geometry.bind(geometry, shader), renderer.state.set(this.state);
for (let i = 0, l = drawCalls.length; i < l; i++)
this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);
}
/**
* Renders specific DrawCall
* @param renderer
* @param drawCall
*/
_renderDrawCallDirect(renderer, drawCall) {
const { texArray, type, size, start } = drawCall, groupTextureCount = texArray.count;
for (let j = 0; j < groupTextureCount; j++)
renderer.texture.bind(texArray.elements[j], j);
renderer.geometry.draw(type, size, start);
}
/**
* Resolves shader for direct rendering
* @param renderer - The renderer
*/
_resolveDirectShader(renderer) {
let shader = this.shader;
const pluginName = this.pluginName;
if (!shader) {
if (!DEFAULT_SHADERS[pluginName]) {
const { maxTextures } = renderer.plugins[pluginName], sampleValues = new Int32Array(maxTextures);
for (let i = 0; i < maxTextures; i++)
sampleValues[i] = i;
const uniforms = {
tint: new Float32Array([1, 1, 1, 1]),
translationMatrix: new core.Matrix(),
default: core.UniformGroup.from({ uSamplers: sampleValues }, !0)
}, program = renderer.plugins[pluginName]._shader.program;
DEFAULT_SHADERS[pluginName] = new core.Shader(program, uniforms);
}
shader = DEFAULT_SHADERS[pluginName];
}
return shader;
}
/**
* Retrieves the bounds of the graphic shape as a rectangle object.
* @see PIXI.GraphicsGeometry#bounds
*/
_calculateBounds() {
this.finishPoly();
const geometry = this._geometry;
if (!geometry.graphicsData.length)
return;
const { minX, minY, maxX, maxY } = geometry.bounds;
this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
}
/**
* Tests if a point is inside this graphics object
* @param point - the point to test
* @returns - the result of the test
*/
containsPoint(point) {
return this.worldTransform.applyInverse(point, _Graphics2._TEMP_POINT), this._geometry.containsPoint(_Graphics2._TEMP_POINT);
}
/** Recalculate the tint by applying tint to batches using Graphics tint. */
calculateTints() {
if (this.batchTint !== this.tint) {
this.batchTint = this._tintColor.toNumber();
for (let i = 0; i < this.batches.length; i++) {
const batch = this.batches[i];
batch._tintRGB = core.Color.shared.setValue(this._tintColor).multiply(batch._batchRGB).toLittleEndianNumber();
}
}
}
/** If there's a transform update or a change to the shape of the geometry, recalculate the vertices. */
calculateVertices() {
const wtID = this.transform._worldID;
if (this._transformID === wtID)
return;
this._transformID = wtID;
const wt = this.transform.worldTransform, a = wt.a, b = wt.b, c = wt.c, d = wt.d, tx = wt.tx, ty = wt.ty, data = this._geometry.points, vertexData = this.vertexData;
let count = 0;
for (let i = 0; i < data.length; i += 2) {
const x = data[i], y = data[i + 1];
vertexData[count++] = a * x + c * y + tx, vertexData[count++] = d * y + b * x + ty;
}
}
/**
* Closes the current path.
* @returns - Returns itself.
*/
closePath() {
const currentPath = this.currentPath;
return currentPath && (currentPath.closeStroke = !0, this.finishPoly()), this;
}
/**
* Apply a matrix to the positional data.
* @param matrix - Matrix to use for transform current shape.
* @returns - Returns itself.
*/
setMatrix(matrix) {
return this._matrix = matrix, this;
}
/**
* Begin adding holes to the last draw shape
* IMPORTANT: holes must be fully inside a shape to work
* Also weirdness ensues if holes overlap!
* Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,
* please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.
* @returns - Returns itself.
*/
beginHole() {
return this.finishPoly(), this._holeMode = !0, this;
}
/**
* End adding holes to the last draw shape.
* @returns - Returns itself.
*/
endHole() {
return this.finishPoly(), this._holeMode = !1, this;
}
/**
* Destroys the Graphics object.
* @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) {
this._geometry.refCount--, this._geometry.refCount === 0 && this._geometry.dispose(), this._matrix = null, this.currentPath = null, this._lineStyle.destroy(), this._lineStyle = null, this._fillStyle.destroy(), this._fillStyle = null, this._geometry = null, this.shader = null, this.vertexData = null, this.batches.length = 0, this.batches = null, super.destroy(options);
}
};
_Graphics.curves = _const.curves, /**
* Temporary point to use for containsPoint.
* @private
*/
_Graphics._TEMP_POINT = new core.Point();
let Graphics = _Graphics;
exports.Graphics = Graphics;
//# sourceMappingURL=Graphics.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,562 @@
import { State, Color, BLEND_MODES, Texture, Polygon, PI_2, Rectangle, RoundedRectangle, Circle, Ellipse, SHAPES, Matrix, UniformGroup, Shader, Point } from "@pixi/core";
import { Container } from "@pixi/display";
import { LINE_CAP, LINE_JOIN, curves } from "./const.mjs";
import { GraphicsGeometry } from "./GraphicsGeometry.mjs";
import { FillStyle } from "./styles/FillStyle.mjs";
import { LineStyle } from "./styles/LineStyle.mjs";
import "./utils/index.mjs";
import { QuadraticUtils } from "./utils/QuadraticUtils.mjs";
import { BezierUtils } from "./utils/BezierUtils.mjs";
import { ArcUtils } from "./utils/ArcUtils.mjs";
const DEFAULT_SHADERS = {}, _Graphics = class _Graphics2 extends Container {
/**
* @param geometry - Geometry to use, if omitted will create a new GraphicsGeometry instance.
*/
constructor(geometry = null) {
super(), this.shader = null, this.pluginName = "batch", this.currentPath = null, this.batches = [], this.batchTint = -1, this.batchDirty = -1, this.vertexData = null, this._fillStyle = new FillStyle(), this._lineStyle = new LineStyle(), this._matrix = null, this._holeMode = !1, this.state = State.for2d(), this._geometry = geometry || new GraphicsGeometry(), this._geometry.refCount++, this._transformID = -1, this._tintColor = new Color(16777215), this.blendMode = BLEND_MODES.NORMAL;
}
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh or Graphics objects.
* @readonly
*/
get geometry() {
return this._geometry;
}
/**
* Creates a new Graphics object with the same values as this one.
* Note that only the geometry of the object is cloned, not its transform (position,scale,etc)
* @returns - A clone of the graphics object
*/
clone() {
return this.finishPoly(), new _Graphics2(this._geometry);
}
/**
* The blend mode to be applied to the graphic shape. Apply a value of
* `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. Note that, since each
* primitive in the GraphicsGeometry list is rendered sequentially, modes
* such as `PIXI.BLEND_MODES.ADD` and `PIXI.BLEND_MODES.MULTIPLY` will
* be applied per-primitive.
* @default PIXI.BLEND_MODES.NORMAL
*/
set blendMode(value) {
this.state.blendMode = value;
}
get blendMode() {
return this.state.blendMode;
}
/**
* The tint applied to each graphic shape. This is a hex value. A value of
* 0xFFFFFF will remove any tint effect.
* @default 0xFFFFFF
*/
get tint() {
return this._tintColor.value;
}
set tint(value) {
this._tintColor.setValue(value);
}
/**
* The current fill style.
* @readonly
*/
get fill() {
return this._fillStyle;
}
/**
* The current line style.
* @readonly
*/
get line() {
return this._lineStyle;
}
lineStyle(options = null, color = 0, alpha, alignment = 0.5, native = !1) {
return typeof options == "number" && (options = { width: options, color, alpha, alignment, native }), this.lineTextureStyle(options);
}
/**
* Like line style but support texture for line fill.
* @param [options] - Collection of options for setting line style.
* @param {number} [options.width=0] - width of the line to draw, will update the objects stored style
* @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use
* @param {PIXI.ColorSource} [options.color=0x0] - color of the line to draw, will update the objects stored style.
* Default 0xFFFFFF if texture present.
* @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style
* @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture
* @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer).
* WebGL only.
* @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP
* @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style
* @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style
* @param {number}[options.miterLimit=10] - miter limit ratio
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls
*/
lineTextureStyle(options) {
const defaultLineStyleOptions = {
width: 0,
texture: Texture.WHITE,
color: options?.texture ? 16777215 : 0,
matrix: null,
alignment: 0.5,
native: !1,
cap: LINE_CAP.BUTT,
join: LINE_JOIN.MITER,
miterLimit: 10
};
options = Object.assign(defaultLineStyleOptions, options), this.normalizeColor(options), this.currentPath && this.startPoly();
const visible = options.width > 0 && options.alpha > 0;
return visible ? (options.matrix && (options.matrix = options.matrix.clone(), options.matrix.invert()), Object.assign(this._lineStyle, { visible }, options)) : this._lineStyle.reset(), this;
}
/**
* Start a polygon object internally.
* @protected
*/
startPoly() {
if (this.currentPath) {
const points = this.currentPath.points, len = this.currentPath.points.length;
len > 2 && (this.drawShape(this.currentPath), this.currentPath = new Polygon(), this.currentPath.closeStroke = !1, this.currentPath.points.push(points[len - 2], points[len - 1]));
} else
this.currentPath = new Polygon(), this.currentPath.closeStroke = !1;
}
/**
* Finish the polygon object.
* @protected
*/
finishPoly() {
this.currentPath && (this.currentPath.points.length > 2 ? (this.drawShape(this.currentPath), this.currentPath = null) : this.currentPath.points.length = 0);
}
/**
* Moves the current drawing position to x, y.
* @param x - the X coordinate to move to
* @param y - the Y coordinate to move to
* @returns - This Graphics object. Good for chaining method calls
*/
moveTo(x, y) {
return this.startPoly(), this.currentPath.points[0] = x, this.currentPath.points[1] = y, this;
}
/**
* Draws a line using the current line style from the current drawing position to (x, y);
* The current drawing position is then set to (x, y).
* @param x - the X coordinate to draw to
* @param y - the Y coordinate to draw to
* @returns - This Graphics object. Good for chaining method calls
*/
lineTo(x, y) {
this.currentPath || this.moveTo(0, 0);
const points = this.currentPath.points, fromX = points[points.length - 2], fromY = points[points.length - 1];
return (fromX !== x || fromY !== y) && points.push(x, y), this;
}
/**
* Initialize the curve
* @param x
* @param y
*/
_initCurve(x = 0, y = 0) {
this.currentPath ? this.currentPath.points.length === 0 && (this.currentPath.points = [x, y]) : this.moveTo(x, y);
}
/**
* Calculate the points for a quadratic bezier curve and then draws it.
* Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
* @param cpX - Control point x
* @param cpY - Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @returns - This Graphics object. Good for chaining method calls
*/
quadraticCurveTo(cpX, cpY, toX, toY) {
this._initCurve();
const points = this.currentPath.points;
return points.length === 0 && this.moveTo(0, 0), QuadraticUtils.curveTo(cpX, cpY, toX, toY, points), this;
}
/**
* Calculate the points for a bezier curve and then draws it.
* @param cpX - Control point x
* @param cpY - Control point y
* @param cpX2 - Second Control point x
* @param cpY2 - Second Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @returns This Graphics object. Good for chaining method calls
*/
bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) {
return this._initCurve(), BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points), this;
}
/**
* The `arcTo` method creates an arc/curve between two tangents on the canvas.
* The first tangent is from the start point to the first control point,
* and the second tangent is from the first control point to the second control point.
* Note that the second control point is not necessarily the end point of the arc.
*
* "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
* @param x1 - The x-coordinate of the first control point of the arc
* @param y1 - The y-coordinate of the first control point of the arc
* @param x2 - The x-coordinate of the second control point of the arc
* @param y2 - The y-coordinate of the second control point of the arc
* @param radius - The radius of the arc
* @returns - This Graphics object. Good for chaining method calls
*/
arcTo(x1, y1, x2, y2, radius) {
this._initCurve(x1, y1);
const points = this.currentPath.points, result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);
if (result) {
const { cx, cy, radius: radius2, startAngle, endAngle, anticlockwise } = result;
this.arc(cx, cy, radius2, startAngle, endAngle, anticlockwise);
}
return this;
}
/**
* The arc method creates an arc/curve (used to create circles, or parts of circles).
* @param cx - The x-coordinate of the center of the circle
* @param cy - The y-coordinate of the center of the circle
* @param radius - The radius of the circle
* @param startAngle - The starting angle, in radians (0 is at the 3 o'clock position
* of the arc's circle)
* @param endAngle - The ending angle, in radians
* @param anticlockwise - Specifies whether the drawing should be
* counter-clockwise or clockwise. False is default, and indicates clockwise, while true
* indicates counter-clockwise.
* @returns - This Graphics object. Good for chaining method calls
*/
arc(cx, cy, radius, startAngle, endAngle, anticlockwise = !1) {
if (startAngle === endAngle)
return this;
if (!anticlockwise && endAngle <= startAngle ? endAngle += PI_2 : anticlockwise && startAngle <= endAngle && (startAngle += PI_2), endAngle - startAngle === 0)
return this;
const startX = cx + Math.cos(startAngle) * radius, startY = cy + Math.sin(startAngle) * radius, eps = this._geometry.closePointEps;
let points = this.currentPath ? this.currentPath.points : null;
if (points) {
const xDiff = Math.abs(points[points.length - 2] - startX), yDiff = Math.abs(points[points.length - 1] - startY);
xDiff < eps && yDiff < eps || points.push(startX, startY);
} else
this.moveTo(startX, startY), points = this.currentPath.points;
return ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points), this;
}
/**
* Specifies a simple one-color fill that subsequent calls to other Graphics methods
* (such as lineTo() or drawCircle()) use when drawing.
* @param {PIXI.ColorSource} color - the color of the fill
* @param alpha - the alpha of the fill, will override the color's alpha
* @returns - This Graphics object. Suitable for chaining method calls
*/
beginFill(color = 0, alpha) {
return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });
}
/**
* Normalize the color input from options for line style or fill
* @param {PIXI.IFillStyleOptions} options - Fill style object.
*/
normalizeColor(options) {
const temp = Color.shared.setValue(options.color ?? 0);
options.color = temp.toNumber(), options.alpha ?? (options.alpha = temp.alpha);
}
/**
* Begin the texture fill.
* Note: The wrap mode of the texture is forced to REPEAT on render.
* @param options - Fill style object.
* @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill
* @param {PIXI.ColorSource} [options.color=0xffffff] - Background to fill behind texture
* @param {number} [options.alpha] - Alpha of fill, overrides the color's alpha
* @param {PIXI.Matrix} [options.matrix=null] - Transform matrix
* @returns {PIXI.Graphics} This Graphics object. Good for chaining method calls
*/
beginTextureFill(options) {
const defaultOptions = {
texture: Texture.WHITE,
color: 16777215,
matrix: null
};
options = Object.assign(defaultOptions, options), this.normalizeColor(options), this.currentPath && this.startPoly();
const visible = options.alpha > 0;
return visible ? (options.matrix && (options.matrix = options.matrix.clone(), options.matrix.invert()), Object.assign(this._fillStyle, { visible }, options)) : this._fillStyle.reset(), this;
}
/**
* Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.
* @returns - This Graphics object. Good for chaining method calls
*/
endFill() {
return this.finishPoly(), this._fillStyle.reset(), this;
}
/**
* Draws a rectangle shape.
* @param x - The X coord of the top-left of the rectangle
* @param y - The Y coord of the top-left of the rectangle
* @param width - The width of the rectangle
* @param height - The height of the rectangle
* @returns - This Graphics object. Good for chaining method calls
*/
drawRect(x, y, width, height) {
return this.drawShape(new Rectangle(x, y, width, height));
}
/**
* Draw a rectangle shape with rounded/beveled corners.
* @param x - The X coord of the top-left of the rectangle
* @param y - The Y coord of the top-left of the rectangle
* @param width - The width of the rectangle
* @param height - The height of the rectangle
* @param radius - Radius of the rectangle corners
* @returns - This Graphics object. Good for chaining method calls
*/
drawRoundedRect(x, y, width, height, radius) {
return this.drawShape(new RoundedRectangle(x, y, width, height, radius));
}
/**
* Draws a circle.
* @param x - The X coordinate of the center of the circle
* @param y - The Y coordinate of the center of the circle
* @param radius - The radius of the circle
* @returns - This Graphics object. Good for chaining method calls
*/
drawCircle(x, y, radius) {
return this.drawShape(new Circle(x, y, radius));
}
/**
* Draws an ellipse.
* @param x - The X coordinate of the center of the ellipse
* @param y - The Y coordinate of the center of the ellipse
* @param width - The half width of the ellipse
* @param height - The half height of the ellipse
* @returns - This Graphics object. Good for chaining method calls
*/
drawEllipse(x, y, width, height) {
return this.drawShape(new Ellipse(x, y, width, height));
}
/**
* Draws a polygon using the given path.
* @param {number[]|PIXI.IPointData[]|PIXI.Polygon} path - The path data used to construct the polygon.
* @returns - This Graphics object. Good for chaining method calls
*/
drawPolygon(...path) {
let points, closeStroke = !0;
const poly = path[0];
poly.points ? (closeStroke = poly.closeStroke, points = poly.points) : Array.isArray(path[0]) ? points = path[0] : points = path;
const shape = new Polygon(points);
return shape.closeStroke = closeStroke, this.drawShape(shape), this;
}
/**
* Draw any shape.
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw
* @returns - This Graphics object. Good for chaining method calls
*/
drawShape(shape) {
return this._holeMode ? this._geometry.drawHole(shape, this._matrix) : this._geometry.drawShape(
shape,
this._fillStyle.clone(),
this._lineStyle.clone(),
this._matrix
), this;
}
/**
* Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
* @returns - This Graphics object. Good for chaining method calls
*/
clear() {
return this._geometry.clear(), this._lineStyle.reset(), this._fillStyle.reset(), this._boundsID++, this._matrix = null, this._holeMode = !1, this.currentPath = null, this;
}
/**
* True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and
* masked with gl.scissor.
* @returns - True if only 1 rect.
*/
isFastRect() {
const data = this._geometry.graphicsData;
return data.length === 1 && data[0].shape.type === SHAPES.RECT && !data[0].matrix && !data[0].holes.length && !(data[0].lineStyle.visible && data[0].lineStyle.width);
}
/**
* Renders the object using the WebGL renderer
* @param renderer - The renderer
*/
_render(renderer) {
this.finishPoly();
const geometry = this._geometry;
geometry.updateBatches(), geometry.batchable ? (this.batchDirty !== geometry.batchDirty && this._populateBatches(), this._renderBatched(renderer)) : (renderer.batch.flush(), this._renderDirect(renderer));
}
/** Populating batches for rendering. */
_populateBatches() {
const geometry = this._geometry, blendMode = this.blendMode, len = geometry.batches.length;
this.batchTint = -1, this._transformID = -1, this.batchDirty = geometry.batchDirty, this.batches.length = len, this.vertexData = new Float32Array(geometry.points);
for (let i = 0; i < len; i++) {
const gI = geometry.batches[i], color = gI.style.color, vertexData = new Float32Array(
this.vertexData.buffer,
gI.attribStart * 4 * 2,
gI.attribSize * 2
), uvs = new Float32Array(
geometry.uvsFloat32.buffer,
gI.attribStart * 4 * 2,
gI.attribSize * 2
), indices = new Uint16Array(
geometry.indicesUint16.buffer,
gI.start * 2,
gI.size
), batch = {
vertexData,
blendMode,
indices,
uvs,
_batchRGB: Color.shared.setValue(color).toRgbArray(),
_tintRGB: color,
_texture: gI.style.texture,
alpha: gI.style.alpha,
worldAlpha: 1
};
this.batches[i] = batch;
}
}
/**
* Renders the batches using the BathedRenderer plugin
* @param renderer - The renderer
*/
_renderBatched(renderer) {
if (this.batches.length) {
renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]), this.calculateVertices(), this.calculateTints();
for (let i = 0, l = this.batches.length; i < l; i++) {
const batch = this.batches[i];
batch.worldAlpha = this.worldAlpha * batch.alpha, renderer.plugins[this.pluginName].render(batch);
}
}
}
/**
* Renders the graphics direct
* @param renderer - The renderer
*/
_renderDirect(renderer) {
const shader = this._resolveDirectShader(renderer), geometry = this._geometry, worldAlpha = this.worldAlpha, uniforms = shader.uniforms, drawCalls = geometry.drawCalls;
uniforms.translationMatrix = this.transform.worldTransform, Color.shared.setValue(this._tintColor).premultiply(worldAlpha).toArray(uniforms.tint), renderer.shader.bind(shader), renderer.geometry.bind(geometry, shader), renderer.state.set(this.state);
for (let i = 0, l = drawCalls.length; i < l; i++)
this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);
}
/**
* Renders specific DrawCall
* @param renderer
* @param drawCall
*/
_renderDrawCallDirect(renderer, drawCall) {
const { texArray, type, size, start } = drawCall, groupTextureCount = texArray.count;
for (let j = 0; j < groupTextureCount; j++)
renderer.texture.bind(texArray.elements[j], j);
renderer.geometry.draw(type, size, start);
}
/**
* Resolves shader for direct rendering
* @param renderer - The renderer
*/
_resolveDirectShader(renderer) {
let shader = this.shader;
const pluginName = this.pluginName;
if (!shader) {
if (!DEFAULT_SHADERS[pluginName]) {
const { maxTextures } = renderer.plugins[pluginName], sampleValues = new Int32Array(maxTextures);
for (let i = 0; i < maxTextures; i++)
sampleValues[i] = i;
const uniforms = {
tint: new Float32Array([1, 1, 1, 1]),
translationMatrix: new Matrix(),
default: UniformGroup.from({ uSamplers: sampleValues }, !0)
}, program = renderer.plugins[pluginName]._shader.program;
DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);
}
shader = DEFAULT_SHADERS[pluginName];
}
return shader;
}
/**
* Retrieves the bounds of the graphic shape as a rectangle object.
* @see PIXI.GraphicsGeometry#bounds
*/
_calculateBounds() {
this.finishPoly();
const geometry = this._geometry;
if (!geometry.graphicsData.length)
return;
const { minX, minY, maxX, maxY } = geometry.bounds;
this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
}
/**
* Tests if a point is inside this graphics object
* @param point - the point to test
* @returns - the result of the test
*/
containsPoint(point) {
return this.worldTransform.applyInverse(point, _Graphics2._TEMP_POINT), this._geometry.containsPoint(_Graphics2._TEMP_POINT);
}
/** Recalculate the tint by applying tint to batches using Graphics tint. */
calculateTints() {
if (this.batchTint !== this.tint) {
this.batchTint = this._tintColor.toNumber();
for (let i = 0; i < this.batches.length; i++) {
const batch = this.batches[i];
batch._tintRGB = Color.shared.setValue(this._tintColor).multiply(batch._batchRGB).toLittleEndianNumber();
}
}
}
/** If there's a transform update or a change to the shape of the geometry, recalculate the vertices. */
calculateVertices() {
const wtID = this.transform._worldID;
if (this._transformID === wtID)
return;
this._transformID = wtID;
const wt = this.transform.worldTransform, a = wt.a, b = wt.b, c = wt.c, d = wt.d, tx = wt.tx, ty = wt.ty, data = this._geometry.points, vertexData = this.vertexData;
let count = 0;
for (let i = 0; i < data.length; i += 2) {
const x = data[i], y = data[i + 1];
vertexData[count++] = a * x + c * y + tx, vertexData[count++] = d * y + b * x + ty;
}
}
/**
* Closes the current path.
* @returns - Returns itself.
*/
closePath() {
const currentPath = this.currentPath;
return currentPath && (currentPath.closeStroke = !0, this.finishPoly()), this;
}
/**
* Apply a matrix to the positional data.
* @param matrix - Matrix to use for transform current shape.
* @returns - Returns itself.
*/
setMatrix(matrix) {
return this._matrix = matrix, this;
}
/**
* Begin adding holes to the last draw shape
* IMPORTANT: holes must be fully inside a shape to work
* Also weirdness ensues if holes overlap!
* Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,
* please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.
* @returns - Returns itself.
*/
beginHole() {
return this.finishPoly(), this._holeMode = !0, this;
}
/**
* End adding holes to the last draw shape.
* @returns - Returns itself.
*/
endHole() {
return this.finishPoly(), this._holeMode = !1, this;
}
/**
* Destroys the Graphics object.
* @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) {
this._geometry.refCount--, this._geometry.refCount === 0 && this._geometry.dispose(), this._matrix = null, this.currentPath = null, this._lineStyle.destroy(), this._lineStyle = null, this._fillStyle.destroy(), this._fillStyle = null, this._geometry = null, this.shader = null, this.vertexData = null, this.batches.length = 0, this.batches = null, super.destroy(options);
}
};
_Graphics.curves = curves, /**
* Temporary point to use for containsPoint.
* @private
*/
_Graphics._TEMP_POINT = new Point();
let Graphics = _Graphics;
export {
Graphics
};
//# sourceMappingURL=Graphics.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
"use strict";
class GraphicsData {
/**
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
* @param fillStyle - the width of the line to draw
* @param lineStyle - the color of the line to draw
* @param matrix - Transform matrix
*/
constructor(shape, fillStyle = null, lineStyle = null, matrix = null) {
this.points = [], this.holes = [], this.shape = shape, this.lineStyle = lineStyle, this.fillStyle = fillStyle, this.matrix = matrix, this.type = shape.type;
}
/**
* Creates a new GraphicsData object with the same values as this one.
* @returns - Cloned GraphicsData object
*/
clone() {
return new GraphicsData(
this.shape,
this.fillStyle,
this.lineStyle,
this.matrix
);
}
/** Destroys the Graphics data. */
destroy() {
this.shape = null, this.holes.length = 0, this.holes = null, this.points.length = 0, this.points = null, this.lineStyle = null, this.fillStyle = null;
}
}
exports.GraphicsData = GraphicsData;
//# sourceMappingURL=GraphicsData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GraphicsData.js","sources":["../src/GraphicsData.ts"],"sourcesContent":["import type { IShape, Matrix, SHAPES } from '@pixi/core';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n shape: IShape;\n\n /** The style of the line. */\n lineStyle: LineStyle;\n\n /** The style of the fill. */\n fillStyle: FillStyle;\n\n /** The transform matrix. */\n matrix: Matrix;\n\n /** The type of the shape, see the Const.Shapes file for all the existing types, */\n type: SHAPES;\n\n /** The collection of points. */\n points: number[] = [];\n\n /** The collection of holes. */\n\n holes: Array<GraphicsData> = [];\n\n /**\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param fillStyle - the width of the line to draw\n * @param lineStyle - the color of the line to draw\n * @param matrix - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n this.shape = shape;\n this.lineStyle = lineStyle;\n this.fillStyle = fillStyle;\n this.matrix = matrix;\n this.type = shape.type;\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n * @returns - Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /** Destroys the Graphics data. */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n"],"names":[],"mappings":";AAQO,MAAM,aACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCI,YAAY,OAAe,YAAuB,MAAM,YAAuB,MAAM,SAAiB,MACtG;AAbA,SAAA,SAAmB,IAInB,KAAA,QAA6B,IAUzB,KAAK,QAAQ,OACb,KAAK,YAAY,WACjB,KAAK,YAAY,WACjB,KAAK,SAAS,QACd,KAAK,OAAO,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,QACP;AACI,WAAO,IAAI;AAAA,MACP,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IAAA;AAAA,EAEb;AAAA;AAAA,EAGO,UACP;AACS,SAAA,QAAQ,MACb,KAAK,MAAM,SAAS,GACpB,KAAK,QAAQ,MACb,KAAK,OAAO,SAAS,GACrB,KAAK,SAAS,MACd,KAAK,YAAY,MACjB,KAAK,YAAY;AAAA,EACrB;AACJ;;"}

View File

@@ -0,0 +1,31 @@
class GraphicsData {
/**
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
* @param fillStyle - the width of the line to draw
* @param lineStyle - the color of the line to draw
* @param matrix - Transform matrix
*/
constructor(shape, fillStyle = null, lineStyle = null, matrix = null) {
this.points = [], this.holes = [], this.shape = shape, this.lineStyle = lineStyle, this.fillStyle = fillStyle, this.matrix = matrix, this.type = shape.type;
}
/**
* Creates a new GraphicsData object with the same values as this one.
* @returns - Cloned GraphicsData object
*/
clone() {
return new GraphicsData(
this.shape,
this.fillStyle,
this.lineStyle,
this.matrix
);
}
/** Destroys the Graphics data. */
destroy() {
this.shape = null, this.holes.length = 0, this.holes = null, this.points.length = 0, this.points = null, this.lineStyle = null, this.fillStyle = null;
}
}
export {
GraphicsData
};
//# sourceMappingURL=GraphicsData.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GraphicsData.mjs","sources":["../src/GraphicsData.ts"],"sourcesContent":["import type { IShape, Matrix, SHAPES } from '@pixi/core';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n shape: IShape;\n\n /** The style of the line. */\n lineStyle: LineStyle;\n\n /** The style of the fill. */\n fillStyle: FillStyle;\n\n /** The transform matrix. */\n matrix: Matrix;\n\n /** The type of the shape, see the Const.Shapes file for all the existing types, */\n type: SHAPES;\n\n /** The collection of points. */\n points: number[] = [];\n\n /** The collection of holes. */\n\n holes: Array<GraphicsData> = [];\n\n /**\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param fillStyle - the width of the line to draw\n * @param lineStyle - the color of the line to draw\n * @param matrix - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n this.shape = shape;\n this.lineStyle = lineStyle;\n this.fillStyle = fillStyle;\n this.matrix = matrix;\n this.type = shape.type;\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n * @returns - Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /** Destroys the Graphics data. */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n"],"names":[],"mappings":"AAQO,MAAM,aACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCI,YAAY,OAAe,YAAuB,MAAM,YAAuB,MAAM,SAAiB,MACtG;AAbA,SAAA,SAAmB,IAInB,KAAA,QAA6B,IAUzB,KAAK,QAAQ,OACb,KAAK,YAAY,WACjB,KAAK,YAAY,WACjB,KAAK,SAAS,QACd,KAAK,OAAO,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,QACP;AACI,WAAO,IAAI;AAAA,MACP,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IAAA;AAAA,EAEb;AAAA;AAAA,EAGO,UACP;AACS,SAAA,QAAQ,MACb,KAAK,MAAM,SAAS,GACpB,KAAK,QAAQ,MACb,KAAK,OAAO,SAAS,GACrB,KAAK,SAAS,MACd,KAAK,YAAY,MACjB,KAAK,YAAY;AAAA,EACrB;AACJ;"}

View File

@@ -0,0 +1,312 @@
"use strict";
var core = require("@pixi/core"), display = require("@pixi/display"), GraphicsData = require("./GraphicsData.js"), index = require("./utils/index.js"), BatchPart = require("./utils/BatchPart.js"), buildPoly = require("./utils/buildPoly.js"), buildLine = require("./utils/buildLine.js");
const tmpPoint = new core.Point(), _GraphicsGeometry = class _GraphicsGeometry2 extends core.BatchGeometry {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor() {
super(), this.closePointEps = 1e-4, this.boundsPadding = 0, this.uvsFloat32 = null, this.indicesUint16 = null, this.batchable = !1, this.points = [], this.colors = [], this.uvs = [], this.indices = [], this.textureIds = [], this.graphicsData = [], this.drawCalls = [], this.batchDirty = -1, this.batches = [], this.dirty = 0, this.cacheDirty = -1, this.clearDirty = 0, this.shapeIndex = 0, this._bounds = new display.Bounds(), this.boundsDirty = -1;
}
/**
* Get the current bounds of the graphic geometry.
*
* Since 6.5.0, bounds of the graphics geometry are calculated based on the vertices of generated geometry.
* Since shapes or strokes with full transparency (`alpha: 0`) will not generate geometry, they are not considered
* when calculating bounds for the graphics geometry. See PR [#8343]{@link https://github.com/pixijs/pixijs/pull/8343}
* and issue [#8623]{@link https://github.com/pixijs/pixijs/pull/8623}.
* @readonly
*/
get bounds() {
return this.updateBatches(), this.boundsDirty !== this.dirty && (this.boundsDirty = this.dirty, this.calculateBounds()), this._bounds;
}
/** Call if you changed graphicsData manually. Empties all batch buffers. */
invalidate() {
this.boundsDirty = -1, this.dirty++, this.batchDirty++, this.shapeIndex = 0, this.points.length = 0, this.colors.length = 0, this.uvs.length = 0, this.indices.length = 0, this.textureIds.length = 0;
for (let i = 0; i < this.drawCalls.length; i++)
this.drawCalls[i].texArray.clear(), index.DRAW_CALL_POOL.push(this.drawCalls[i]);
this.drawCalls.length = 0;
for (let i = 0; i < this.batches.length; i++) {
const batchPart = this.batches[i];
batchPart.reset(), index.BATCH_POOL.push(batchPart);
}
this.batches.length = 0;
}
/**
* Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
* @returns - This GraphicsGeometry object. Good for chaining method calls
*/
clear() {
return this.graphicsData.length > 0 && (this.invalidate(), this.clearDirty++, this.graphicsData.length = 0), this;
}
/**
* Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
* @param fillStyle - Defines style of the fill.
* @param lineStyle - Defines style of the lines.
* @param matrix - Transform applied to the points of the shape.
* @returns - Returns geometry for chaining.
*/
drawShape(shape, fillStyle = null, lineStyle = null, matrix = null) {
const data = new GraphicsData.GraphicsData(shape, fillStyle, lineStyle, matrix);
return this.graphicsData.push(data), this.dirty++, this;
}
/**
* Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
* @param matrix - Transform applied to the points of the shape.
* @returns - Returns geometry for chaining.
*/
drawHole(shape, matrix = null) {
if (!this.graphicsData.length)
return null;
const data = new GraphicsData.GraphicsData(shape, null, null, matrix), lastShape = this.graphicsData[this.graphicsData.length - 1];
return data.lineStyle = lastShape.lineStyle, lastShape.holes.push(data), this.dirty++, this;
}
/** Destroys the GraphicsGeometry object. */
destroy() {
super.destroy();
for (let i = 0; i < this.graphicsData.length; ++i)
this.graphicsData[i].destroy();
this.points.length = 0, this.points = null, this.colors.length = 0, this.colors = null, this.uvs.length = 0, this.uvs = null, this.indices.length = 0, this.indices = null, this.indexBuffer.destroy(), this.indexBuffer = null, this.graphicsData.length = 0, this.graphicsData = null, this.drawCalls.length = 0, this.drawCalls = null, this.batches.length = 0, this.batches = null, this._bounds = null;
}
/**
* Check to see if a point is contained within this geometry.
* @param point - Point to check if it's contained.
* @returns {boolean} `true` if the point is contained within geometry.
*/
containsPoint(point) {
const graphicsData = this.graphicsData;
for (let i = 0; i < graphicsData.length; ++i) {
const data = graphicsData[i];
if (data.fillStyle.visible && data.shape && (data.matrix ? data.matrix.applyInverse(point, tmpPoint) : tmpPoint.copyFrom(point), data.shape.contains(tmpPoint.x, tmpPoint.y))) {
let hitHole = !1;
if (data.holes) {
for (let i2 = 0; i2 < data.holes.length; i2++)
if (data.holes[i2].shape.contains(tmpPoint.x, tmpPoint.y)) {
hitHole = !0;
break;
}
}
if (!hitHole)
return !0;
}
}
return !1;
}
/**
* Generates intermediate batch data. Either gets converted to drawCalls
* or used to convert to batch objects directly by the Graphics object.
*/
updateBatches() {
if (!this.graphicsData.length) {
this.batchable = !0;
return;
}
if (!this.validateBatching())
return;
this.cacheDirty = this.dirty;
const uvs = this.uvs, graphicsData = this.graphicsData;
let batchPart = null, currentStyle = null;
this.batches.length > 0 && (batchPart = this.batches[this.batches.length - 1], currentStyle = batchPart.style);
for (let i = this.shapeIndex; i < graphicsData.length; i++) {
this.shapeIndex++;
const data = graphicsData[i], fillStyle = data.fillStyle, lineStyle = data.lineStyle;
index.FILL_COMMANDS[data.type].build(data), data.matrix && this.transformPoints(data.points, data.matrix), (fillStyle.visible || lineStyle.visible) && this.processHoles(data.holes);
for (let j = 0; j < 2; j++) {
const style = j === 0 ? fillStyle : lineStyle;
if (!style.visible)
continue;
const nextTexture = style.texture.baseTexture, index2 = this.indices.length, attribIndex = this.points.length / 2;
nextTexture.wrapMode = core.WRAP_MODES.REPEAT, j === 0 ? this.processFill(data) : this.processLine(data);
const size = this.points.length / 2 - attribIndex;
size !== 0 && (batchPart && !this._compareStyles(currentStyle, style) && (batchPart.end(index2, attribIndex), batchPart = null), batchPart || (batchPart = index.BATCH_POOL.pop() || new BatchPart.BatchPart(), batchPart.begin(style, index2, attribIndex), this.batches.push(batchPart), currentStyle = style), this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix));
}
}
const index$1 = this.indices.length, attrib = this.points.length / 2;
if (batchPart && batchPart.end(index$1, attrib), this.batches.length === 0) {
this.batchable = !0;
return;
}
const need32 = attrib > 65535;
this.indicesUint16 && this.indices.length === this.indicesUint16.length && need32 === this.indicesUint16.BYTES_PER_ELEMENT > 2 ? this.indicesUint16.set(this.indices) : this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices), this.batchable = this.isBatchable(), this.batchable ? this.packBatches() : this.buildDrawCalls();
}
/**
* Affinity check
* @param styleA
* @param styleB
*/
_compareStyles(styleA, styleB) {
return !(!styleA || !styleB || styleA.texture.baseTexture !== styleB.texture.baseTexture || styleA.color + styleA.alpha !== styleB.color + styleB.alpha || !!styleA.native != !!styleB.native);
}
/** Test geometry for batching process. */
validateBatching() {
if (this.dirty === this.cacheDirty || !this.graphicsData.length)
return !1;
for (let i = 0, l = this.graphicsData.length; i < l; i++) {
const data = this.graphicsData[i], fill = data.fillStyle, line = data.lineStyle;
if (fill && !fill.texture.baseTexture.valid || line && !line.texture.baseTexture.valid)
return !1;
}
return !0;
}
/** Offset the indices so that it works with the batcher. */
packBatches() {
this.batchDirty++, this.uvsFloat32 = new Float32Array(this.uvs);
const batches = this.batches;
for (let i = 0, l = batches.length; i < l; i++) {
const batch = batches[i];
for (let j = 0; j < batch.size; j++) {
const index2 = batch.start + j;
this.indicesUint16[index2] = this.indicesUint16[index2] - batch.attribStart;
}
}
}
/**
* Checks to see if this graphics geometry can be batched.
* Currently it needs to be small enough and not contain any native lines.
*/
isBatchable() {
if (this.points.length > 65535 * 2)
return !1;
const batches = this.batches;
for (let i = 0; i < batches.length; i++)
if (batches[i].style.native)
return !1;
return this.points.length < _GraphicsGeometry2.BATCHABLE_SIZE * 2;
}
/** Converts intermediate batches data to drawCalls. */
buildDrawCalls() {
let TICK = ++core.BaseTexture._globalBatch;
for (let i = 0; i < this.drawCalls.length; i++)
this.drawCalls[i].texArray.clear(), index.DRAW_CALL_POOL.push(this.drawCalls[i]);
this.drawCalls.length = 0;
const colors = this.colors, textureIds = this.textureIds;
let currentGroup = index.DRAW_CALL_POOL.pop();
currentGroup || (currentGroup = new core.BatchDrawCall(), currentGroup.texArray = new core.BatchTextureArray()), currentGroup.texArray.count = 0, currentGroup.start = 0, currentGroup.size = 0, currentGroup.type = core.DRAW_MODES.TRIANGLES;
let textureCount = 0, currentTexture = null, textureId = 0, native = !1, drawMode = core.DRAW_MODES.TRIANGLES, index$1 = 0;
this.drawCalls.push(currentGroup);
for (let i = 0; i < this.batches.length; i++) {
const data = this.batches[i], maxTextures = 8, style = data.style, nextTexture = style.texture.baseTexture;
native !== !!style.native && (native = !!style.native, drawMode = native ? core.DRAW_MODES.LINES : core.DRAW_MODES.TRIANGLES, currentTexture = null, textureCount = maxTextures, TICK++), currentTexture !== nextTexture && (currentTexture = nextTexture, nextTexture._batchEnabled !== TICK && (textureCount === maxTextures && (TICK++, textureCount = 0, currentGroup.size > 0 && (currentGroup = index.DRAW_CALL_POOL.pop(), currentGroup || (currentGroup = new core.BatchDrawCall(), currentGroup.texArray = new core.BatchTextureArray()), this.drawCalls.push(currentGroup)), currentGroup.start = index$1, currentGroup.size = 0, currentGroup.texArray.count = 0, currentGroup.type = drawMode), nextTexture.touched = 1, nextTexture._batchEnabled = TICK, nextTexture._batchLocation = textureCount, nextTexture.wrapMode = core.WRAP_MODES.REPEAT, currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture, textureCount++)), currentGroup.size += data.size, index$1 += data.size, textureId = nextTexture._batchLocation, this.addColors(colors, style.color, style.alpha, data.attribSize, data.attribStart), this.addTextureIds(textureIds, textureId, data.attribSize, data.attribStart);
}
core.BaseTexture._globalBatch = TICK, this.packAttributes();
}
/** Packs attributes to single buffer. */
packAttributes() {
const verts = this.points, uvs = this.uvs, colors = this.colors, textureIds = this.textureIds, glPoints = new ArrayBuffer(verts.length * 3 * 4), f32 = new Float32Array(glPoints), u32 = new Uint32Array(glPoints);
let p = 0;
for (let i = 0; i < verts.length / 2; i++)
f32[p++] = verts[i * 2], f32[p++] = verts[i * 2 + 1], f32[p++] = uvs[i * 2], f32[p++] = uvs[i * 2 + 1], u32[p++] = colors[i], f32[p++] = textureIds[i];
this._buffer.update(glPoints), this._indexBuffer.update(this.indicesUint16);
}
/**
* Process fill part of Graphics.
* @param data
*/
processFill(data) {
data.holes.length ? buildPoly.buildPoly.triangulate(data, this) : index.FILL_COMMANDS[data.type].triangulate(data, this);
}
/**
* Process line part of Graphics.
* @param data
*/
processLine(data) {
buildLine.buildLine(data, this);
for (let i = 0; i < data.holes.length; i++)
buildLine.buildLine(data.holes[i], this);
}
/**
* Process the holes data.
* @param holes
*/
processHoles(holes) {
for (let i = 0; i < holes.length; i++) {
const hole = holes[i];
index.FILL_COMMANDS[hole.type].build(hole), hole.matrix && this.transformPoints(hole.points, hole.matrix);
}
}
/** Update the local bounds of the object. Expensive to use performance-wise. */
calculateBounds() {
const bounds = this._bounds;
bounds.clear(), bounds.addVertexData(this.points, 0, this.points.length), bounds.pad(this.boundsPadding, this.boundsPadding);
}
/**
* Transform points using matrix.
* @param points - Points to transform
* @param matrix - Transform matrix
*/
transformPoints(points, matrix) {
for (let i = 0; i < points.length / 2; i++) {
const x = points[i * 2], y = points[i * 2 + 1];
points[i * 2] = matrix.a * x + matrix.c * y + matrix.tx, points[i * 2 + 1] = matrix.b * x + matrix.d * y + matrix.ty;
}
}
/**
* Add colors.
* @param colors - List of colors to add to
* @param color - Color to add
* @param alpha - Alpha to use
* @param size - Number of colors to add
* @param offset
*/
addColors(colors, color, alpha, size, offset = 0) {
const bgr = core.Color.shared.setValue(color).toLittleEndianNumber(), result = core.Color.shared.setValue(bgr).toPremultiplied(alpha);
colors.length = Math.max(colors.length, offset + size);
for (let i = 0; i < size; i++)
colors[offset + i] = result;
}
/**
* Add texture id that the shader/fragment wants to use.
* @param textureIds
* @param id
* @param size
* @param offset
*/
addTextureIds(textureIds, id, size, offset = 0) {
textureIds.length = Math.max(textureIds.length, offset + size);
for (let i = 0; i < size; i++)
textureIds[offset + i] = id;
}
/**
* Generates the UVs for a shape.
* @param verts - Vertices
* @param uvs - UVs
* @param texture - Reference to Texture
* @param start - Index buffer start index.
* @param size - The size/length for index buffer.
* @param matrix - Optional transform for all points.
*/
addUvs(verts, uvs, texture, start, size, matrix = null) {
let index2 = 0;
const uvsStart = uvs.length, frame = texture.frame;
for (; index2 < size; ) {
let x = verts[(start + index2) * 2], y = verts[(start + index2) * 2 + 1];
if (matrix) {
const nx = matrix.a * x + matrix.c * y + matrix.tx;
y = matrix.b * x + matrix.d * y + matrix.ty, x = nx;
}
index2++, uvs.push(x / frame.width, y / frame.height);
}
const baseTexture = texture.baseTexture;
(frame.width < baseTexture.width || frame.height < baseTexture.height) && this.adjustUvs(uvs, texture, uvsStart, size);
}
/**
* Modify uvs array according to position of texture region
* Does not work with rotated or trimmed textures
* @param uvs - array
* @param texture - region
* @param start - starting index for uvs
* @param size - how many points to adjust
*/
adjustUvs(uvs, texture, start, size) {
const baseTexture = texture.baseTexture, eps = 1e-6, finish = start + size * 2, frame = texture.frame, scaleX = frame.width / baseTexture.width, scaleY = frame.height / baseTexture.height;
let offsetX = frame.x / frame.width, offsetY = frame.y / frame.height, minX = Math.floor(uvs[start] + eps), minY = Math.floor(uvs[start + 1] + eps);
for (let i = start + 2; i < finish; i += 2)
minX = Math.min(minX, Math.floor(uvs[i] + eps)), minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));
offsetX -= minX, offsetY -= minY;
for (let i = start; i < finish; i += 2)
uvs[i] = (uvs[i] + offsetX) * scaleX, uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;
}
};
_GraphicsGeometry.BATCHABLE_SIZE = 100;
let GraphicsGeometry = _GraphicsGeometry;
exports.GraphicsGeometry = GraphicsGeometry;
//# sourceMappingURL=GraphicsGeometry.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,319 @@
import { Point, BatchGeometry, WRAP_MODES, BaseTexture, BatchDrawCall, BatchTextureArray, DRAW_MODES, Color } from "@pixi/core";
import { Bounds } from "@pixi/display";
import { GraphicsData } from "./GraphicsData.mjs";
import { DRAW_CALL_POOL, BATCH_POOL, FILL_COMMANDS } from "./utils/index.mjs";
import { BatchPart } from "./utils/BatchPart.mjs";
import { buildPoly } from "./utils/buildPoly.mjs";
import { buildLine } from "./utils/buildLine.mjs";
const tmpPoint = new Point(), _GraphicsGeometry = class _GraphicsGeometry2 extends BatchGeometry {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor() {
super(), this.closePointEps = 1e-4, this.boundsPadding = 0, this.uvsFloat32 = null, this.indicesUint16 = null, this.batchable = !1, this.points = [], this.colors = [], this.uvs = [], this.indices = [], this.textureIds = [], this.graphicsData = [], this.drawCalls = [], this.batchDirty = -1, this.batches = [], this.dirty = 0, this.cacheDirty = -1, this.clearDirty = 0, this.shapeIndex = 0, this._bounds = new Bounds(), this.boundsDirty = -1;
}
/**
* Get the current bounds of the graphic geometry.
*
* Since 6.5.0, bounds of the graphics geometry are calculated based on the vertices of generated geometry.
* Since shapes or strokes with full transparency (`alpha: 0`) will not generate geometry, they are not considered
* when calculating bounds for the graphics geometry. See PR [#8343]{@link https://github.com/pixijs/pixijs/pull/8343}
* and issue [#8623]{@link https://github.com/pixijs/pixijs/pull/8623}.
* @readonly
*/
get bounds() {
return this.updateBatches(), this.boundsDirty !== this.dirty && (this.boundsDirty = this.dirty, this.calculateBounds()), this._bounds;
}
/** Call if you changed graphicsData manually. Empties all batch buffers. */
invalidate() {
this.boundsDirty = -1, this.dirty++, this.batchDirty++, this.shapeIndex = 0, this.points.length = 0, this.colors.length = 0, this.uvs.length = 0, this.indices.length = 0, this.textureIds.length = 0;
for (let i = 0; i < this.drawCalls.length; i++)
this.drawCalls[i].texArray.clear(), DRAW_CALL_POOL.push(this.drawCalls[i]);
this.drawCalls.length = 0;
for (let i = 0; i < this.batches.length; i++) {
const batchPart = this.batches[i];
batchPart.reset(), BATCH_POOL.push(batchPart);
}
this.batches.length = 0;
}
/**
* Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
* @returns - This GraphicsGeometry object. Good for chaining method calls
*/
clear() {
return this.graphicsData.length > 0 && (this.invalidate(), this.clearDirty++, this.graphicsData.length = 0), this;
}
/**
* Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
* @param fillStyle - Defines style of the fill.
* @param lineStyle - Defines style of the lines.
* @param matrix - Transform applied to the points of the shape.
* @returns - Returns geometry for chaining.
*/
drawShape(shape, fillStyle = null, lineStyle = null, matrix = null) {
const data = new GraphicsData(shape, fillStyle, lineStyle, matrix);
return this.graphicsData.push(data), this.dirty++, this;
}
/**
* Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
* @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.
* @param matrix - Transform applied to the points of the shape.
* @returns - Returns geometry for chaining.
*/
drawHole(shape, matrix = null) {
if (!this.graphicsData.length)
return null;
const data = new GraphicsData(shape, null, null, matrix), lastShape = this.graphicsData[this.graphicsData.length - 1];
return data.lineStyle = lastShape.lineStyle, lastShape.holes.push(data), this.dirty++, this;
}
/** Destroys the GraphicsGeometry object. */
destroy() {
super.destroy();
for (let i = 0; i < this.graphicsData.length; ++i)
this.graphicsData[i].destroy();
this.points.length = 0, this.points = null, this.colors.length = 0, this.colors = null, this.uvs.length = 0, this.uvs = null, this.indices.length = 0, this.indices = null, this.indexBuffer.destroy(), this.indexBuffer = null, this.graphicsData.length = 0, this.graphicsData = null, this.drawCalls.length = 0, this.drawCalls = null, this.batches.length = 0, this.batches = null, this._bounds = null;
}
/**
* Check to see if a point is contained within this geometry.
* @param point - Point to check if it's contained.
* @returns {boolean} `true` if the point is contained within geometry.
*/
containsPoint(point) {
const graphicsData = this.graphicsData;
for (let i = 0; i < graphicsData.length; ++i) {
const data = graphicsData[i];
if (data.fillStyle.visible && data.shape && (data.matrix ? data.matrix.applyInverse(point, tmpPoint) : tmpPoint.copyFrom(point), data.shape.contains(tmpPoint.x, tmpPoint.y))) {
let hitHole = !1;
if (data.holes) {
for (let i2 = 0; i2 < data.holes.length; i2++)
if (data.holes[i2].shape.contains(tmpPoint.x, tmpPoint.y)) {
hitHole = !0;
break;
}
}
if (!hitHole)
return !0;
}
}
return !1;
}
/**
* Generates intermediate batch data. Either gets converted to drawCalls
* or used to convert to batch objects directly by the Graphics object.
*/
updateBatches() {
if (!this.graphicsData.length) {
this.batchable = !0;
return;
}
if (!this.validateBatching())
return;
this.cacheDirty = this.dirty;
const uvs = this.uvs, graphicsData = this.graphicsData;
let batchPart = null, currentStyle = null;
this.batches.length > 0 && (batchPart = this.batches[this.batches.length - 1], currentStyle = batchPart.style);
for (let i = this.shapeIndex; i < graphicsData.length; i++) {
this.shapeIndex++;
const data = graphicsData[i], fillStyle = data.fillStyle, lineStyle = data.lineStyle;
FILL_COMMANDS[data.type].build(data), data.matrix && this.transformPoints(data.points, data.matrix), (fillStyle.visible || lineStyle.visible) && this.processHoles(data.holes);
for (let j = 0; j < 2; j++) {
const style = j === 0 ? fillStyle : lineStyle;
if (!style.visible)
continue;
const nextTexture = style.texture.baseTexture, index2 = this.indices.length, attribIndex = this.points.length / 2;
nextTexture.wrapMode = WRAP_MODES.REPEAT, j === 0 ? this.processFill(data) : this.processLine(data);
const size = this.points.length / 2 - attribIndex;
size !== 0 && (batchPart && !this._compareStyles(currentStyle, style) && (batchPart.end(index2, attribIndex), batchPart = null), batchPart || (batchPart = BATCH_POOL.pop() || new BatchPart(), batchPart.begin(style, index2, attribIndex), this.batches.push(batchPart), currentStyle = style), this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix));
}
}
const index = this.indices.length, attrib = this.points.length / 2;
if (batchPart && batchPart.end(index, attrib), this.batches.length === 0) {
this.batchable = !0;
return;
}
const need32 = attrib > 65535;
this.indicesUint16 && this.indices.length === this.indicesUint16.length && need32 === this.indicesUint16.BYTES_PER_ELEMENT > 2 ? this.indicesUint16.set(this.indices) : this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices), this.batchable = this.isBatchable(), this.batchable ? this.packBatches() : this.buildDrawCalls();
}
/**
* Affinity check
* @param styleA
* @param styleB
*/
_compareStyles(styleA, styleB) {
return !(!styleA || !styleB || styleA.texture.baseTexture !== styleB.texture.baseTexture || styleA.color + styleA.alpha !== styleB.color + styleB.alpha || !!styleA.native != !!styleB.native);
}
/** Test geometry for batching process. */
validateBatching() {
if (this.dirty === this.cacheDirty || !this.graphicsData.length)
return !1;
for (let i = 0, l = this.graphicsData.length; i < l; i++) {
const data = this.graphicsData[i], fill = data.fillStyle, line = data.lineStyle;
if (fill && !fill.texture.baseTexture.valid || line && !line.texture.baseTexture.valid)
return !1;
}
return !0;
}
/** Offset the indices so that it works with the batcher. */
packBatches() {
this.batchDirty++, this.uvsFloat32 = new Float32Array(this.uvs);
const batches = this.batches;
for (let i = 0, l = batches.length; i < l; i++) {
const batch = batches[i];
for (let j = 0; j < batch.size; j++) {
const index = batch.start + j;
this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;
}
}
}
/**
* Checks to see if this graphics geometry can be batched.
* Currently it needs to be small enough and not contain any native lines.
*/
isBatchable() {
if (this.points.length > 65535 * 2)
return !1;
const batches = this.batches;
for (let i = 0; i < batches.length; i++)
if (batches[i].style.native)
return !1;
return this.points.length < _GraphicsGeometry2.BATCHABLE_SIZE * 2;
}
/** Converts intermediate batches data to drawCalls. */
buildDrawCalls() {
let TICK = ++BaseTexture._globalBatch;
for (let i = 0; i < this.drawCalls.length; i++)
this.drawCalls[i].texArray.clear(), DRAW_CALL_POOL.push(this.drawCalls[i]);
this.drawCalls.length = 0;
const colors = this.colors, textureIds = this.textureIds;
let currentGroup = DRAW_CALL_POOL.pop();
currentGroup || (currentGroup = new BatchDrawCall(), currentGroup.texArray = new BatchTextureArray()), currentGroup.texArray.count = 0, currentGroup.start = 0, currentGroup.size = 0, currentGroup.type = DRAW_MODES.TRIANGLES;
let textureCount = 0, currentTexture = null, textureId = 0, native = !1, drawMode = DRAW_MODES.TRIANGLES, index = 0;
this.drawCalls.push(currentGroup);
for (let i = 0; i < this.batches.length; i++) {
const data = this.batches[i], maxTextures = 8, style = data.style, nextTexture = style.texture.baseTexture;
native !== !!style.native && (native = !!style.native, drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES, currentTexture = null, textureCount = maxTextures, TICK++), currentTexture !== nextTexture && (currentTexture = nextTexture, nextTexture._batchEnabled !== TICK && (textureCount === maxTextures && (TICK++, textureCount = 0, currentGroup.size > 0 && (currentGroup = DRAW_CALL_POOL.pop(), currentGroup || (currentGroup = new BatchDrawCall(), currentGroup.texArray = new BatchTextureArray()), this.drawCalls.push(currentGroup)), currentGroup.start = index, currentGroup.size = 0, currentGroup.texArray.count = 0, currentGroup.type = drawMode), nextTexture.touched = 1, nextTexture._batchEnabled = TICK, nextTexture._batchLocation = textureCount, nextTexture.wrapMode = WRAP_MODES.REPEAT, currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture, textureCount++)), currentGroup.size += data.size, index += data.size, textureId = nextTexture._batchLocation, this.addColors(colors, style.color, style.alpha, data.attribSize, data.attribStart), this.addTextureIds(textureIds, textureId, data.attribSize, data.attribStart);
}
BaseTexture._globalBatch = TICK, this.packAttributes();
}
/** Packs attributes to single buffer. */
packAttributes() {
const verts = this.points, uvs = this.uvs, colors = this.colors, textureIds = this.textureIds, glPoints = new ArrayBuffer(verts.length * 3 * 4), f32 = new Float32Array(glPoints), u32 = new Uint32Array(glPoints);
let p = 0;
for (let i = 0; i < verts.length / 2; i++)
f32[p++] = verts[i * 2], f32[p++] = verts[i * 2 + 1], f32[p++] = uvs[i * 2], f32[p++] = uvs[i * 2 + 1], u32[p++] = colors[i], f32[p++] = textureIds[i];
this._buffer.update(glPoints), this._indexBuffer.update(this.indicesUint16);
}
/**
* Process fill part of Graphics.
* @param data
*/
processFill(data) {
data.holes.length ? buildPoly.triangulate(data, this) : FILL_COMMANDS[data.type].triangulate(data, this);
}
/**
* Process line part of Graphics.
* @param data
*/
processLine(data) {
buildLine(data, this);
for (let i = 0; i < data.holes.length; i++)
buildLine(data.holes[i], this);
}
/**
* Process the holes data.
* @param holes
*/
processHoles(holes) {
for (let i = 0; i < holes.length; i++) {
const hole = holes[i];
FILL_COMMANDS[hole.type].build(hole), hole.matrix && this.transformPoints(hole.points, hole.matrix);
}
}
/** Update the local bounds of the object. Expensive to use performance-wise. */
calculateBounds() {
const bounds = this._bounds;
bounds.clear(), bounds.addVertexData(this.points, 0, this.points.length), bounds.pad(this.boundsPadding, this.boundsPadding);
}
/**
* Transform points using matrix.
* @param points - Points to transform
* @param matrix - Transform matrix
*/
transformPoints(points, matrix) {
for (let i = 0; i < points.length / 2; i++) {
const x = points[i * 2], y = points[i * 2 + 1];
points[i * 2] = matrix.a * x + matrix.c * y + matrix.tx, points[i * 2 + 1] = matrix.b * x + matrix.d * y + matrix.ty;
}
}
/**
* Add colors.
* @param colors - List of colors to add to
* @param color - Color to add
* @param alpha - Alpha to use
* @param size - Number of colors to add
* @param offset
*/
addColors(colors, color, alpha, size, offset = 0) {
const bgr = Color.shared.setValue(color).toLittleEndianNumber(), result = Color.shared.setValue(bgr).toPremultiplied(alpha);
colors.length = Math.max(colors.length, offset + size);
for (let i = 0; i < size; i++)
colors[offset + i] = result;
}
/**
* Add texture id that the shader/fragment wants to use.
* @param textureIds
* @param id
* @param size
* @param offset
*/
addTextureIds(textureIds, id, size, offset = 0) {
textureIds.length = Math.max(textureIds.length, offset + size);
for (let i = 0; i < size; i++)
textureIds[offset + i] = id;
}
/**
* Generates the UVs for a shape.
* @param verts - Vertices
* @param uvs - UVs
* @param texture - Reference to Texture
* @param start - Index buffer start index.
* @param size - The size/length for index buffer.
* @param matrix - Optional transform for all points.
*/
addUvs(verts, uvs, texture, start, size, matrix = null) {
let index = 0;
const uvsStart = uvs.length, frame = texture.frame;
for (; index < size; ) {
let x = verts[(start + index) * 2], y = verts[(start + index) * 2 + 1];
if (matrix) {
const nx = matrix.a * x + matrix.c * y + matrix.tx;
y = matrix.b * x + matrix.d * y + matrix.ty, x = nx;
}
index++, uvs.push(x / frame.width, y / frame.height);
}
const baseTexture = texture.baseTexture;
(frame.width < baseTexture.width || frame.height < baseTexture.height) && this.adjustUvs(uvs, texture, uvsStart, size);
}
/**
* Modify uvs array according to position of texture region
* Does not work with rotated or trimmed textures
* @param uvs - array
* @param texture - region
* @param start - starting index for uvs
* @param size - how many points to adjust
*/
adjustUvs(uvs, texture, start, size) {
const baseTexture = texture.baseTexture, eps = 1e-6, finish = start + size * 2, frame = texture.frame, scaleX = frame.width / baseTexture.width, scaleY = frame.height / baseTexture.height;
let offsetX = frame.x / frame.width, offsetY = frame.y / frame.height, minX = Math.floor(uvs[start] + eps), minY = Math.floor(uvs[start + 1] + eps);
for (let i = start + 2; i < finish; i += 2)
minX = Math.min(minX, Math.floor(uvs[i] + eps)), minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));
offsetX -= minX, offsetY -= minY;
for (let i = start; i < finish; i += 2)
uvs[i] = (uvs[i] + offsetX) * scaleX, uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;
}
};
_GraphicsGeometry.BATCHABLE_SIZE = 100;
let GraphicsGeometry = _GraphicsGeometry;
export {
GraphicsGeometry
};
//# sourceMappingURL=GraphicsGeometry.mjs.map

File diff suppressed because one or more lines are too long

20
resources/app/node_modules/@pixi/graphics/lib/const.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
var LINE_JOIN = /* @__PURE__ */ ((LINE_JOIN2) => (LINE_JOIN2.MITER = "miter", LINE_JOIN2.BEVEL = "bevel", LINE_JOIN2.ROUND = "round", LINE_JOIN2))(LINE_JOIN || {}), LINE_CAP = /* @__PURE__ */ ((LINE_CAP2) => (LINE_CAP2.BUTT = "butt", LINE_CAP2.ROUND = "round", LINE_CAP2.SQUARE = "square", LINE_CAP2))(LINE_CAP || {});
const curves = {
adaptive: !0,
maxLength: 10,
minSegments: 8,
maxSegments: 2048,
epsilon: 1e-4,
_segmentsCount(length, defaultSegments = 20) {
if (!this.adaptive || !length || isNaN(length))
return defaultSegments;
let result = Math.ceil(length / this.maxLength);
return result < this.minSegments ? result = this.minSegments : result > this.maxSegments && (result = this.maxSegments), result;
}
}, GRAPHICS_CURVES = curves;
exports.GRAPHICS_CURVES = GRAPHICS_CURVES;
exports.LINE_CAP = LINE_CAP;
exports.LINE_JOIN = LINE_JOIN;
exports.curves = curves;
//# sourceMappingURL=const.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"const.js","sources":["../src/const.ts"],"sourcesContent":["/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n * @memberof PIXI\n * @static\n * @enum {string}\n */\nexport enum LINE_JOIN\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * 'miter': make a sharp corner where outer part of lines meet\n * @default miter\n */\n MITER = 'miter',\n /**\n * 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @default bevel\n */\n BEVEL = 'bevel',\n /**\n * 'round': add an arc at the joint\n * @default round\n */\n ROUND = 'round'\n}\n\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n * @see PIXI.Graphics#lineStyle\n * @memberof PIXI\n * @static\n * @enum {string}\n */\nexport enum LINE_CAP\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @default butt\n */\n BUTT = 'butt',\n /**\n * 'round': add semicircle at ends\n * @default round\n */\n ROUND = 'round',\n /**\n * 'square': add square at end (like `BUTT` except more length at end)\n * @default square\n */\n SQUARE = 'square'\n}\n\n/**\n * @memberof PIXI\n * @deprecated\n */\nexport interface IGraphicsCurvesSettings\n{\n adaptive: boolean;\n maxLength: number;\n minSegments: number;\n maxSegments: number;\n\n epsilon: number;\n\n _segmentsCount(length: number, defaultSegments?: number): number;\n}\n\n/**\n * @private\n */\nexport const curves = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n\n epsilon: 0.0001,\n\n _segmentsCount(length: number, defaultSegments = 20)\n {\n if (!this.adaptive || !length || isNaN(length))\n {\n return defaultSegments;\n }\n\n let result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n\n/**\n * @static\n * @readonly\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @deprecated since 7.1.0\n * @see PIXI.Graphics.curves\n */\nexport const GRAPHICS_CURVES = curves;\n"],"names":["LINE_JOIN","LINE_CAP"],"mappings":";AAQY,IAAA,YAAAA,kBAAAA,gBAORA,WAAA,QAAQ,SAKRA,WAAA,QAAQ,SAKRA,WAAA,QAAQ,SAjBAA,aAAA,kBA2BA,WAAL,kBAAKC,eAORA,UAAA,OAAO,QAKPA,UAAA,QAAQ,SAKRA,UAAA,SAAS,UAjBDA,YAAA,YAAA,EAAA;AAuCL,MAAM,SAAS;AAAA,EAClB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAc;AAAA,EAEd,SAAS;AAAA,EAET,eAAe,QAAgB,kBAAkB,IACjD;AACI,QAAI,CAAC,KAAK,YAAY,CAAC,UAAU,MAAM,MAAM;AAElC,aAAA;AAGX,QAAI,SAAS,KAAK,KAAK,SAAS,KAAK,SAAS;AAE1C,WAAA,SAAS,KAAK,cAEd,SAAS,KAAK,cAET,SAAS,KAAK,gBAEnB,SAAS,KAAK,cAGX;AAAA,EACX;AACJ,GAWa,kBAAkB;;;;;"}

View File

@@ -0,0 +1,21 @@
var LINE_JOIN = /* @__PURE__ */ ((LINE_JOIN2) => (LINE_JOIN2.MITER = "miter", LINE_JOIN2.BEVEL = "bevel", LINE_JOIN2.ROUND = "round", LINE_JOIN2))(LINE_JOIN || {}), LINE_CAP = /* @__PURE__ */ ((LINE_CAP2) => (LINE_CAP2.BUTT = "butt", LINE_CAP2.ROUND = "round", LINE_CAP2.SQUARE = "square", LINE_CAP2))(LINE_CAP || {});
const curves = {
adaptive: !0,
maxLength: 10,
minSegments: 8,
maxSegments: 2048,
epsilon: 1e-4,
_segmentsCount(length, defaultSegments = 20) {
if (!this.adaptive || !length || isNaN(length))
return defaultSegments;
let result = Math.ceil(length / this.maxLength);
return result < this.minSegments ? result = this.minSegments : result > this.maxSegments && (result = this.maxSegments), result;
}
}, GRAPHICS_CURVES = curves;
export {
GRAPHICS_CURVES,
LINE_CAP,
LINE_JOIN,
curves
};
//# sourceMappingURL=const.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"const.mjs","sources":["../src/const.ts"],"sourcesContent":["/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n * @memberof PIXI\n * @static\n * @enum {string}\n */\nexport enum LINE_JOIN\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * 'miter': make a sharp corner where outer part of lines meet\n * @default miter\n */\n MITER = 'miter',\n /**\n * 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @default bevel\n */\n BEVEL = 'bevel',\n /**\n * 'round': add an arc at the joint\n * @default round\n */\n ROUND = 'round'\n}\n\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n * @see PIXI.Graphics#lineStyle\n * @memberof PIXI\n * @static\n * @enum {string}\n */\nexport enum LINE_CAP\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @default butt\n */\n BUTT = 'butt',\n /**\n * 'round': add semicircle at ends\n * @default round\n */\n ROUND = 'round',\n /**\n * 'square': add square at end (like `BUTT` except more length at end)\n * @default square\n */\n SQUARE = 'square'\n}\n\n/**\n * @memberof PIXI\n * @deprecated\n */\nexport interface IGraphicsCurvesSettings\n{\n adaptive: boolean;\n maxLength: number;\n minSegments: number;\n maxSegments: number;\n\n epsilon: number;\n\n _segmentsCount(length: number, defaultSegments?: number): number;\n}\n\n/**\n * @private\n */\nexport const curves = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n\n epsilon: 0.0001,\n\n _segmentsCount(length: number, defaultSegments = 20)\n {\n if (!this.adaptive || !length || isNaN(length))\n {\n return defaultSegments;\n }\n\n let result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n\n/**\n * @static\n * @readonly\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @deprecated since 7.1.0\n * @see PIXI.Graphics.curves\n */\nexport const GRAPHICS_CURVES = curves;\n"],"names":["LINE_JOIN","LINE_CAP"],"mappings":"AAQY,IAAA,YAAAA,kBAAAA,gBAORA,WAAA,QAAQ,SAKRA,WAAA,QAAQ,SAKRA,WAAA,QAAQ,SAjBAA,aAAA,kBA2BA,WAAL,kBAAKC,eAORA,UAAA,OAAO,QAKPA,UAAA,QAAQ,SAKRA,UAAA,SAAS,UAjBDA,YAAA,YAAA,EAAA;AAuCL,MAAM,SAAS;AAAA,EAClB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAc;AAAA,EAEd,SAAS;AAAA,EAET,eAAe,QAAgB,kBAAkB,IACjD;AACI,QAAI,CAAC,KAAK,YAAY,CAAC,UAAU,MAAM,MAAM;AAElC,aAAA;AAGX,QAAI,SAAS,KAAK,KAAK,SAAS,KAAK,SAAS;AAE1C,WAAA,SAAS,KAAK,cAEd,SAAS,KAAK,cAET,SAAS,KAAK,gBAEnB,SAAS,KAAK,cAGX;AAAA,EACX;AACJ,GAWa,kBAAkB;"}

27
resources/app/node_modules/@pixi/graphics/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";
var index = require("./utils/index.js"), _const = require("./const.js"), Graphics = require("./Graphics.js"), GraphicsData = require("./GraphicsData.js"), GraphicsGeometry = require("./GraphicsGeometry.js"), FillStyle = require("./styles/FillStyle.js"), LineStyle = require("./styles/LineStyle.js"), buildPoly = require("./utils/buildPoly.js"), buildCircle = require("./utils/buildCircle.js"), buildRectangle = require("./utils/buildRectangle.js"), buildRoundedRectangle = require("./utils/buildRoundedRectangle.js"), buildLine = require("./utils/buildLine.js"), ArcUtils = require("./utils/ArcUtils.js"), BezierUtils = require("./utils/BezierUtils.js"), QuadraticUtils = require("./utils/QuadraticUtils.js"), BatchPart = require("./utils/BatchPart.js");
const graphicsUtils = {
buildPoly: buildPoly.buildPoly,
buildCircle: buildCircle.buildCircle,
buildRectangle: buildRectangle.buildRectangle,
buildRoundedRectangle: buildRoundedRectangle.buildRoundedRectangle,
buildLine: buildLine.buildLine,
ArcUtils: ArcUtils.ArcUtils,
BezierUtils: BezierUtils.BezierUtils,
QuadraticUtils: QuadraticUtils.QuadraticUtils,
BatchPart: BatchPart.BatchPart,
FILL_COMMANDS: index.FILL_COMMANDS,
BATCH_POOL: index.BATCH_POOL,
DRAW_CALL_POOL: index.DRAW_CALL_POOL
};
exports.GRAPHICS_CURVES = _const.GRAPHICS_CURVES;
exports.LINE_CAP = _const.LINE_CAP;
exports.LINE_JOIN = _const.LINE_JOIN;
exports.curves = _const.curves;
exports.Graphics = Graphics.Graphics;
exports.GraphicsData = GraphicsData.GraphicsData;
exports.GraphicsGeometry = GraphicsGeometry.GraphicsGeometry;
exports.FillStyle = FillStyle.FillStyle;
exports.LineStyle = LineStyle.LineStyle;
exports.graphicsUtils = graphicsUtils;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/// <reference path=\"../global.d.ts\" />\nimport {\n ArcUtils,\n BATCH_POOL,\n BatchPart,\n BezierUtils,\n buildCircle,\n buildLine,\n buildPoly,\n buildRectangle,\n buildRoundedRectangle,\n DRAW_CALL_POOL,\n FILL_COMMANDS,\n QuadraticUtils,\n} from './utils';\n\nimport type { BatchDrawCall, SHAPES } from '@pixi/core';\nimport type { IShapeBuildCommand } from './utils/IShapeBuildCommand';\n\nexport * from './const';\nexport * from './Graphics';\nexport * from './GraphicsData';\nexport * from './GraphicsGeometry';\nexport * from './styles/FillStyle';\nexport * from './styles/LineStyle';\n\nexport const graphicsUtils = {\n buildPoly: buildPoly as IShapeBuildCommand,\n buildCircle: buildCircle as IShapeBuildCommand,\n buildRectangle: buildRectangle as IShapeBuildCommand,\n buildRoundedRectangle: buildRoundedRectangle as IShapeBuildCommand,\n buildLine,\n ArcUtils,\n BezierUtils,\n QuadraticUtils,\n BatchPart,\n FILL_COMMANDS: FILL_COMMANDS as Record<SHAPES, IShapeBuildCommand>,\n BATCH_POOL: BATCH_POOL as Array<BatchPart>,\n DRAW_CALL_POOL: DRAW_CALL_POOL as Array<BatchDrawCall>\n};\n"],"names":["buildPoly","buildCircle","buildRectangle","buildRoundedRectangle","buildLine","ArcUtils","BezierUtils","QuadraticUtils","BatchPart","FILL_COMMANDS","BATCH_POOL","DRAW_CALL_POOL"],"mappings":";;AA0BO,MAAM,gBAAgB;AAAA,EAAA,WACzBA,UAAA;AAAA,EAAA,aACAC,YAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,uBACAC,sBAAA;AAAA,EAAA,WACAC,UAAA;AAAA,EAAA,UACAC,SAAA;AAAA,EAAA,aACAC,YAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,WACAC,UAAA;AAAA,EAAA,eACAC,MAAA;AAAA,EAAA,YACAC,MAAA;AAAA,EAAA,gBACAC,MAAA;AACJ;;;;;;;;;;;"}

View File

@@ -0,0 +1,43 @@
import { FILL_COMMANDS, BATCH_POOL, DRAW_CALL_POOL } from "./utils/index.mjs";
import { GRAPHICS_CURVES, LINE_CAP, LINE_JOIN, curves } from "./const.mjs";
import { Graphics } from "./Graphics.mjs";
import { GraphicsData } from "./GraphicsData.mjs";
import { GraphicsGeometry } from "./GraphicsGeometry.mjs";
import { FillStyle } from "./styles/FillStyle.mjs";
import { LineStyle } from "./styles/LineStyle.mjs";
import { buildPoly } from "./utils/buildPoly.mjs";
import { buildCircle } from "./utils/buildCircle.mjs";
import { buildRectangle } from "./utils/buildRectangle.mjs";
import { buildRoundedRectangle } from "./utils/buildRoundedRectangle.mjs";
import { buildLine } from "./utils/buildLine.mjs";
import { ArcUtils } from "./utils/ArcUtils.mjs";
import { BezierUtils } from "./utils/BezierUtils.mjs";
import { QuadraticUtils } from "./utils/QuadraticUtils.mjs";
import { BatchPart } from "./utils/BatchPart.mjs";
const graphicsUtils = {
buildPoly,
buildCircle,
buildRectangle,
buildRoundedRectangle,
buildLine,
ArcUtils,
BezierUtils,
QuadraticUtils,
BatchPart,
FILL_COMMANDS,
BATCH_POOL,
DRAW_CALL_POOL
};
export {
FillStyle,
GRAPHICS_CURVES,
Graphics,
GraphicsData,
GraphicsGeometry,
LINE_CAP,
LINE_JOIN,
LineStyle,
curves,
graphicsUtils
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/// <reference path=\"../global.d.ts\" />\nimport {\n ArcUtils,\n BATCH_POOL,\n BatchPart,\n BezierUtils,\n buildCircle,\n buildLine,\n buildPoly,\n buildRectangle,\n buildRoundedRectangle,\n DRAW_CALL_POOL,\n FILL_COMMANDS,\n QuadraticUtils,\n} from './utils';\n\nimport type { BatchDrawCall, SHAPES } from '@pixi/core';\nimport type { IShapeBuildCommand } from './utils/IShapeBuildCommand';\n\nexport * from './const';\nexport * from './Graphics';\nexport * from './GraphicsData';\nexport * from './GraphicsGeometry';\nexport * from './styles/FillStyle';\nexport * from './styles/LineStyle';\n\nexport const graphicsUtils = {\n buildPoly: buildPoly as IShapeBuildCommand,\n buildCircle: buildCircle as IShapeBuildCommand,\n buildRectangle: buildRectangle as IShapeBuildCommand,\n buildRoundedRectangle: buildRoundedRectangle as IShapeBuildCommand,\n buildLine,\n ArcUtils,\n BezierUtils,\n QuadraticUtils,\n BatchPart,\n FILL_COMMANDS: FILL_COMMANDS as Record<SHAPES, IShapeBuildCommand>,\n BATCH_POOL: BATCH_POOL as Array<BatchPart>,\n DRAW_CALL_POOL: DRAW_CALL_POOL as Array<BatchDrawCall>\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA0BO,MAAM,gBAAgB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;"}

View File

@@ -0,0 +1,22 @@
"use strict";
var core = require("@pixi/core");
class FillStyle {
constructor() {
this.color = 16777215, this.alpha = 1, this.texture = core.Texture.WHITE, this.matrix = null, this.visible = !1, this.reset();
}
/** Clones the object */
clone() {
const obj = new FillStyle();
return obj.color = this.color, obj.alpha = this.alpha, obj.texture = this.texture, obj.matrix = this.matrix, obj.visible = this.visible, obj;
}
/** Reset */
reset() {
this.color = 16777215, this.alpha = 1, this.texture = core.Texture.WHITE, this.matrix = null, this.visible = !1;
}
/** Destroy and don't use after this. */
destroy() {
this.texture = null, this.matrix = null;
}
}
exports.FillStyle = FillStyle;
//# sourceMappingURL=FillStyle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"FillStyle.js","sources":["../../src/styles/FillStyle.ts"],"sourcesContent":["import { Texture } from '@pixi/core';\n\nimport type { Matrix } from '@pixi/core';\n\n/**\n * Fill style object for Graphics.\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /** The alpha value used when filling the Graphics object. */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform applied to the texture.\n * @default null\n */\n public matrix: Matrix = null;\n\n /** If the current fill is visible. */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /** Clones the object */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /** Reset */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /** Destroy and don't use after this. */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n"],"names":["Texture"],"mappings":";;AAQO,MAAM,UACb;AAAA,EAyBI,cACA;AArBA,SAAO,QAAQ,UAGf,KAAO,QAAQ,GAMf,KAAO,UAAmBA,KAAQ,QAAA,OAMlC,KAAO,SAAiB,MAGxB,KAAO,UAAU,IAIb,KAAK,MAAM;AAAA,EACf;AAAA;AAAA,EAGO,QACP;AACU,UAAA,MAAM,IAAI;AAEhB,WAAA,IAAI,QAAQ,KAAK,OACjB,IAAI,QAAQ,KAAK,OACjB,IAAI,UAAU,KAAK,SACnB,IAAI,SAAS,KAAK,QAClB,IAAI,UAAU,KAAK,SAEZ;AAAA,EACX;AAAA;AAAA,EAGO,QACP;AACI,SAAK,QAAQ,UACb,KAAK,QAAQ,GACb,KAAK,UAAUA,KAAA,QAAQ,OACvB,KAAK,SAAS,MACd,KAAK,UAAU;AAAA,EACnB;AAAA;AAAA,EAGO,UACP;AACS,SAAA,UAAU,MACf,KAAK,SAAS;AAAA,EAClB;AACJ;;"}

View File

@@ -0,0 +1,23 @@
import { Texture } from "@pixi/core";
class FillStyle {
constructor() {
this.color = 16777215, this.alpha = 1, this.texture = Texture.WHITE, this.matrix = null, this.visible = !1, this.reset();
}
/** Clones the object */
clone() {
const obj = new FillStyle();
return obj.color = this.color, obj.alpha = this.alpha, obj.texture = this.texture, obj.matrix = this.matrix, obj.visible = this.visible, obj;
}
/** Reset */
reset() {
this.color = 16777215, this.alpha = 1, this.texture = Texture.WHITE, this.matrix = null, this.visible = !1;
}
/** Destroy and don't use after this. */
destroy() {
this.texture = null, this.matrix = null;
}
}
export {
FillStyle
};
//# sourceMappingURL=FillStyle.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"FillStyle.mjs","sources":["../../src/styles/FillStyle.ts"],"sourcesContent":["import { Texture } from '@pixi/core';\n\nimport type { Matrix } from '@pixi/core';\n\n/**\n * Fill style object for Graphics.\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /** The alpha value used when filling the Graphics object. */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform applied to the texture.\n * @default null\n */\n public matrix: Matrix = null;\n\n /** If the current fill is visible. */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /** Clones the object */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /** Reset */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /** Destroy and don't use after this. */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n"],"names":[],"mappings":";AAQO,MAAM,UACb;AAAA,EAyBI,cACA;AArBA,SAAO,QAAQ,UAGf,KAAO,QAAQ,GAMf,KAAO,UAAmB,QAAQ,OAMlC,KAAO,SAAiB,MAGxB,KAAO,UAAU,IAIb,KAAK,MAAM;AAAA,EACf;AAAA;AAAA,EAGO,QACP;AACU,UAAA,MAAM,IAAI;AAEhB,WAAA,IAAI,QAAQ,KAAK,OACjB,IAAI,QAAQ,KAAK,OACjB,IAAI,UAAU,KAAK,SACnB,IAAI,SAAS,KAAK,QAClB,IAAI,UAAU,KAAK,SAEZ;AAAA,EACX;AAAA;AAAA,EAGO,QACP;AACI,SAAK,QAAQ,UACb,KAAK,QAAQ,GACb,KAAK,UAAU,QAAQ,OACvB,KAAK,SAAS,MACd,KAAK,UAAU;AAAA,EACnB;AAAA;AAAA,EAGO,UACP;AACS,SAAA,UAAU,MACf,KAAK,SAAS;AAAA,EAClB;AACJ;"}

View File

@@ -0,0 +1,18 @@
"use strict";
var _const = require("../const.js"), FillStyle = require("./FillStyle.js");
class LineStyle extends FillStyle.FillStyle {
constructor() {
super(...arguments), this.width = 0, this.alignment = 0.5, this.native = !1, this.cap = _const.LINE_CAP.BUTT, this.join = _const.LINE_JOIN.MITER, this.miterLimit = 10;
}
/** Clones the object. */
clone() {
const obj = new LineStyle();
return obj.color = this.color, obj.alpha = this.alpha, obj.texture = this.texture, obj.matrix = this.matrix, obj.visible = this.visible, obj.width = this.width, obj.alignment = this.alignment, obj.native = this.native, obj.cap = this.cap, obj.join = this.join, obj.miterLimit = this.miterLimit, obj;
}
/** Reset the line style to default. */
reset() {
super.reset(), this.color = 0, this.alignment = 0.5, this.width = 0, this.native = !1, this.cap = _const.LINE_CAP.BUTT, this.join = _const.LINE_JOIN.MITER, this.miterLimit = 10;
}
}
exports.LineStyle = LineStyle;
//# sourceMappingURL=LineStyle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LineStyle.js","sources":["../../src/styles/LineStyle.ts"],"sourcesContent":["import { LINE_CAP, LINE_JOIN } from '../const';\nimport { FillStyle } from './FillStyle';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n */\nexport class LineStyle extends FillStyle\n{\n /** The width (thickness) of any lines drawn. */\n public width = 0;\n\n /** The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). WebGL only. */\n public alignment = 0.5;\n\n /** If true the lines will be draw using LINES instead of TRIANGLE_STRIP. */\n public native = false;\n\n /**\n * Line cap style.\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /** Miter limit. */\n public miterLimit = 10;\n\n /** Clones the object. */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /** Reset the line style to default. */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n this.cap = LINE_CAP.BUTT;\n this.join = LINE_JOIN.MITER;\n this.miterLimit = 10;\n }\n}\n"],"names":["FillStyle","LINE_CAP","LINE_JOIN"],"mappings":";;AAOO,MAAM,kBAAkBA,UAAAA,UAC/B;AAAA,EADO,cAAA;AAAA,UAAA,GAAA,SAAA,GAGH,KAAO,QAAQ,GAGf,KAAO,YAAY,KAGnB,KAAO,SAAS,IAOhB,KAAO,MAAMC,OAAS,SAAA,MAOtB,KAAO,OAAOC,OAAU,UAAA,OAGxB,KAAO,aAAa;AAAA,EAAA;AAAA;AAAA,EAGb,QACP;AACU,UAAA,MAAM,IAAI;AAEhB,WAAA,IAAI,QAAQ,KAAK,OACjB,IAAI,QAAQ,KAAK,OACjB,IAAI,UAAU,KAAK,SACnB,IAAI,SAAS,KAAK,QAClB,IAAI,UAAU,KAAK,SACnB,IAAI,QAAQ,KAAK,OACjB,IAAI,YAAY,KAAK,WACrB,IAAI,SAAS,KAAK,QAClB,IAAI,MAAM,KAAK,KACf,IAAI,OAAO,KAAK,MAChB,IAAI,aAAa,KAAK,YAEf;AAAA,EACX;AAAA;AAAA,EAGO,QACP;AACU,UAAA,MAAA,GAGN,KAAK,QAAQ,GAEb,KAAK,YAAY,KACjB,KAAK,QAAQ,GACb,KAAK,SAAS,IACd,KAAK,MAAMD,OAAAA,SAAS,MACpB,KAAK,OAAOC,OAAA,UAAU,OACtB,KAAK,aAAa;AAAA,EACtB;AACJ;;"}

View File

@@ -0,0 +1,20 @@
import { LINE_CAP, LINE_JOIN } from "../const.mjs";
import { FillStyle } from "./FillStyle.mjs";
class LineStyle extends FillStyle {
constructor() {
super(...arguments), this.width = 0, this.alignment = 0.5, this.native = !1, this.cap = LINE_CAP.BUTT, this.join = LINE_JOIN.MITER, this.miterLimit = 10;
}
/** Clones the object. */
clone() {
const obj = new LineStyle();
return obj.color = this.color, obj.alpha = this.alpha, obj.texture = this.texture, obj.matrix = this.matrix, obj.visible = this.visible, obj.width = this.width, obj.alignment = this.alignment, obj.native = this.native, obj.cap = this.cap, obj.join = this.join, obj.miterLimit = this.miterLimit, obj;
}
/** Reset the line style to default. */
reset() {
super.reset(), this.color = 0, this.alignment = 0.5, this.width = 0, this.native = !1, this.cap = LINE_CAP.BUTT, this.join = LINE_JOIN.MITER, this.miterLimit = 10;
}
}
export {
LineStyle
};
//# sourceMappingURL=LineStyle.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LineStyle.mjs","sources":["../../src/styles/LineStyle.ts"],"sourcesContent":["import { LINE_CAP, LINE_JOIN } from '../const';\nimport { FillStyle } from './FillStyle';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n */\nexport class LineStyle extends FillStyle\n{\n /** The width (thickness) of any lines drawn. */\n public width = 0;\n\n /** The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). WebGL only. */\n public alignment = 0.5;\n\n /** If true the lines will be draw using LINES instead of TRIANGLE_STRIP. */\n public native = false;\n\n /**\n * Line cap style.\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /** Miter limit. */\n public miterLimit = 10;\n\n /** Clones the object. */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /** Reset the line style to default. */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n this.cap = LINE_CAP.BUTT;\n this.join = LINE_JOIN.MITER;\n this.miterLimit = 10;\n }\n}\n"],"names":[],"mappings":";;AAOO,MAAM,kBAAkB,UAC/B;AAAA,EADO,cAAA;AAAA,UAAA,GAAA,SAAA,GAGH,KAAO,QAAQ,GAGf,KAAO,YAAY,KAGnB,KAAO,SAAS,IAOhB,KAAO,MAAM,SAAS,MAOtB,KAAO,OAAO,UAAU,OAGxB,KAAO,aAAa;AAAA,EAAA;AAAA;AAAA,EAGb,QACP;AACU,UAAA,MAAM,IAAI;AAEhB,WAAA,IAAI,QAAQ,KAAK,OACjB,IAAI,QAAQ,KAAK,OACjB,IAAI,UAAU,KAAK,SACnB,IAAI,SAAS,KAAK,QAClB,IAAI,UAAU,KAAK,SACnB,IAAI,QAAQ,KAAK,OACjB,IAAI,YAAY,KAAK,WACrB,IAAI,SAAS,KAAK,QAClB,IAAI,MAAM,KAAK,KACf,IAAI,OAAO,KAAK,MAChB,IAAI,aAAa,KAAK,YAEf;AAAA,EACX;AAAA;AAAA,EAGO,QACP;AACU,UAAA,MAAA,GAGN,KAAK,QAAQ,GAEb,KAAK,YAAY,KACjB,KAAK,QAAQ,GACb,KAAK,SAAS,IACd,KAAK,MAAM,SAAS,MACpB,KAAK,OAAO,UAAU,OACtB,KAAK,aAAa;AAAA,EACtB;AACJ;"}

View File

@@ -0,0 +1,60 @@
"use strict";
var core = require("@pixi/core"), _const = require("../const.js");
class ArcUtils {
/**
* Calculate information of the arc for {@link PIXI.Graphics.arcTo}.
* @private
* @param x1 - The x-coordinate of the first control point of the arc
* @param y1 - The y-coordinate of the first control point of the arc
* @param x2 - The x-coordinate of the second control point of the arc
* @param y2 - The y-coordinate of the second control point of the arc
* @param radius - The radius of the arc
* @param points - Collection of points to add to
* @returns - If the arc length is valid, return center of circle, radius and other info otherwise `null`.
*/
static curveTo(x1, y1, x2, y2, radius, points) {
const fromX = points[points.length - 2], a1 = points[points.length - 1] - y1, b1 = fromX - x1, a2 = y2 - y1, b2 = x2 - x1, mm = Math.abs(a1 * b2 - b1 * a2);
if (mm < 1e-8 || radius === 0)
return (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) && points.push(x1, y1), null;
const dd = a1 * a1 + b1 * b1, cc = a2 * a2 + b2 * b2, tt = a1 * a2 + b1 * b2, k1 = radius * Math.sqrt(dd) / mm, k2 = radius * Math.sqrt(cc) / mm, j1 = k1 * tt / dd, j2 = k2 * tt / cc, cx = k1 * b2 + k2 * b1, cy = k1 * a2 + k2 * a1, px = b1 * (k2 + j1), py = a1 * (k2 + j1), qx = b2 * (k1 + j2), qy = a2 * (k1 + j2), startAngle = Math.atan2(py - cy, px - cx), endAngle = Math.atan2(qy - cy, qx - cx);
return {
cx: cx + x1,
cy: cy + y1,
radius,
startAngle,
endAngle,
anticlockwise: b1 * a2 > b2 * a1
};
}
/**
* The arc method creates an arc/curve (used to create circles, or parts of circles).
* @private
* @param _startX - Start x location of arc
* @param _startY - Start y location of arc
* @param cx - The x-coordinate of the center of the circle
* @param cy - The y-coordinate of the center of the circle
* @param radius - The radius of the circle
* @param startAngle - The starting angle, in radians (0 is at the 3 o'clock position
* of the arc's circle)
* @param endAngle - The ending angle, in radians
* @param _anticlockwise - Specifies whether the drawing should be
* counter-clockwise or clockwise. False is default, and indicates clockwise, while true
* indicates counter-clockwise.
* @param points - Collection of points to add to
*/
static arc(_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) {
const sweep = endAngle - startAngle, n = _const.curves._segmentsCount(
Math.abs(sweep) * radius,
Math.ceil(Math.abs(sweep) / core.PI_2) * 40
), theta = sweep / (n * 2), theta2 = theta * 2, cTheta = Math.cos(theta), sTheta = Math.sin(theta), segMinus = n - 1, remainder = segMinus % 1 / segMinus;
for (let i = 0; i <= segMinus; ++i) {
const real = i + remainder * i, angle = theta + startAngle + theta2 * real, c = Math.cos(angle), s = -Math.sin(angle);
points.push(
(cTheta * c + sTheta * s) * radius + cx,
(cTheta * -s + sTheta * c) * radius + cy
);
}
}
}
exports.ArcUtils = ArcUtils;
//# sourceMappingURL=ArcUtils.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,62 @@
import { PI_2 } from "@pixi/core";
import { curves } from "../const.mjs";
class ArcUtils {
/**
* Calculate information of the arc for {@link PIXI.Graphics.arcTo}.
* @private
* @param x1 - The x-coordinate of the first control point of the arc
* @param y1 - The y-coordinate of the first control point of the arc
* @param x2 - The x-coordinate of the second control point of the arc
* @param y2 - The y-coordinate of the second control point of the arc
* @param radius - The radius of the arc
* @param points - Collection of points to add to
* @returns - If the arc length is valid, return center of circle, radius and other info otherwise `null`.
*/
static curveTo(x1, y1, x2, y2, radius, points) {
const fromX = points[points.length - 2], a1 = points[points.length - 1] - y1, b1 = fromX - x1, a2 = y2 - y1, b2 = x2 - x1, mm = Math.abs(a1 * b2 - b1 * a2);
if (mm < 1e-8 || radius === 0)
return (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) && points.push(x1, y1), null;
const dd = a1 * a1 + b1 * b1, cc = a2 * a2 + b2 * b2, tt = a1 * a2 + b1 * b2, k1 = radius * Math.sqrt(dd) / mm, k2 = radius * Math.sqrt(cc) / mm, j1 = k1 * tt / dd, j2 = k2 * tt / cc, cx = k1 * b2 + k2 * b1, cy = k1 * a2 + k2 * a1, px = b1 * (k2 + j1), py = a1 * (k2 + j1), qx = b2 * (k1 + j2), qy = a2 * (k1 + j2), startAngle = Math.atan2(py - cy, px - cx), endAngle = Math.atan2(qy - cy, qx - cx);
return {
cx: cx + x1,
cy: cy + y1,
radius,
startAngle,
endAngle,
anticlockwise: b1 * a2 > b2 * a1
};
}
/**
* The arc method creates an arc/curve (used to create circles, or parts of circles).
* @private
* @param _startX - Start x location of arc
* @param _startY - Start y location of arc
* @param cx - The x-coordinate of the center of the circle
* @param cy - The y-coordinate of the center of the circle
* @param radius - The radius of the circle
* @param startAngle - The starting angle, in radians (0 is at the 3 o'clock position
* of the arc's circle)
* @param endAngle - The ending angle, in radians
* @param _anticlockwise - Specifies whether the drawing should be
* counter-clockwise or clockwise. False is default, and indicates clockwise, while true
* indicates counter-clockwise.
* @param points - Collection of points to add to
*/
static arc(_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) {
const sweep = endAngle - startAngle, n = curves._segmentsCount(
Math.abs(sweep) * radius,
Math.ceil(Math.abs(sweep) / PI_2) * 40
), theta = sweep / (n * 2), theta2 = theta * 2, cTheta = Math.cos(theta), sTheta = Math.sin(theta), segMinus = n - 1, remainder = segMinus % 1 / segMinus;
for (let i = 0; i <= segMinus; ++i) {
const real = i + remainder * i, angle = theta + startAngle + theta2 * real, c = Math.cos(angle), s = -Math.sin(angle);
points.push(
(cTheta * c + sTheta * s) * radius + cx,
(cTheta * -s + sTheta * c) * radius + cy
);
}
}
}
export {
ArcUtils
};
//# sourceMappingURL=ArcUtils.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
"use strict";
class BatchPart {
constructor() {
this.reset();
}
/**
* Begin batch part.
* @param style
* @param startIndex
* @param attribStart
*/
begin(style, startIndex, attribStart) {
this.reset(), this.style = style, this.start = startIndex, this.attribStart = attribStart;
}
/**
* End batch part.
* @param endIndex
* @param endAttrib
*/
end(endIndex, endAttrib) {
this.attribSize = endAttrib - this.attribStart, this.size = endIndex - this.start;
}
reset() {
this.style = null, this.size = 0, this.start = 0, this.attribStart = 0, this.attribSize = 0;
}
}
exports.BatchPart = BatchPart;
//# sourceMappingURL=BatchPart.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BatchPart.js","sources":["../../src/utils/BatchPart.ts"],"sourcesContent":["import type { FillStyle } from '../styles/FillStyle';\nimport type { LineStyle } from '../styles/LineStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part.\n * @param style\n * @param startIndex\n * @param attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part.\n * @param endIndex\n * @param endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n"],"names":[],"mappings":";AAOO,MAAM,UACb;AAAA,EAOI,cACA;AACI,SAAK,MAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,MAAM,OAA8B,YAAoB,aAC/D;AACS,SAAA,MAAA,GACL,KAAK,QAAQ,OACb,KAAK,QAAQ,YACb,KAAK,cAAc;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,IAAI,UAAkB,WAC7B;AACI,SAAK,aAAa,YAAY,KAAK,aACnC,KAAK,OAAO,WAAW,KAAK;AAAA,EAChC;AAAA,EAEO,QACP;AACI,SAAK,QAAQ,MACb,KAAK,OAAO,GACZ,KAAK,QAAQ,GACb,KAAK,cAAc,GACnB,KAAK,aAAa;AAAA,EACtB;AACJ;;"}

View File

@@ -0,0 +1,29 @@
class BatchPart {
constructor() {
this.reset();
}
/**
* Begin batch part.
* @param style
* @param startIndex
* @param attribStart
*/
begin(style, startIndex, attribStart) {
this.reset(), this.style = style, this.start = startIndex, this.attribStart = attribStart;
}
/**
* End batch part.
* @param endIndex
* @param endAttrib
*/
end(endIndex, endAttrib) {
this.attribSize = endAttrib - this.attribStart, this.size = endIndex - this.start;
}
reset() {
this.style = null, this.size = 0, this.start = 0, this.attribStart = 0, this.attribSize = 0;
}
}
export {
BatchPart
};
//# sourceMappingURL=BatchPart.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BatchPart.mjs","sources":["../../src/utils/BatchPart.ts"],"sourcesContent":["import type { FillStyle } from '../styles/FillStyle';\nimport type { LineStyle } from '../styles/LineStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part.\n * @param style\n * @param startIndex\n * @param attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part.\n * @param endIndex\n * @param endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n"],"names":[],"mappings":"AAOO,MAAM,UACb;AAAA,EAOI,cACA;AACI,SAAK,MAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,MAAM,OAA8B,YAAoB,aAC/D;AACS,SAAA,MAAA,GACL,KAAK,QAAQ,OACb,KAAK,QAAQ,YACb,KAAK,cAAc;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,IAAI,UAAkB,WAC7B;AACI,SAAK,aAAa,YAAY,KAAK,aACnC,KAAK,OAAO,WAAW,KAAK;AAAA,EAChC;AAAA,EAEO,QACP;AACI,SAAK,QAAQ,MACb,KAAK,OAAO,GACZ,KAAK,QAAQ,GACb,KAAK,cAAc,GACnB,KAAK,aAAa;AAAA,EACtB;AACJ;"}

View File

@@ -0,0 +1,54 @@
"use strict";
var _const = require("../const.js");
class BezierUtils {
/**
* Calculate length of bezier curve.
* Analytical solution is impossible, since it involves an integral that does not integrate in general.
* Therefore numerical solution is used.
* @private
* @param fromX - Starting point x
* @param fromY - Starting point y
* @param cpX - Control point x
* @param cpY - Control point y
* @param cpX2 - Second Control point x
* @param cpY2 - Second Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @returns - Length of bezier curve
*/
static curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {
let result = 0, t = 0, t2 = 0, t3 = 0, nt = 0, nt2 = 0, nt3 = 0, x = 0, y = 0, dx = 0, dy = 0, prevX = fromX, prevY = fromY;
for (let i = 1; i <= 10; ++i)
t = i / 10, t2 = t * t, t3 = t2 * t, nt = 1 - t, nt2 = nt * nt, nt3 = nt2 * nt, x = nt3 * fromX + 3 * nt2 * t * cpX + 3 * nt * t2 * cpX2 + t3 * toX, y = nt3 * fromY + 3 * nt2 * t * cpY + 3 * nt * t2 * cpY2 + t3 * toY, dx = prevX - x, dy = prevY - y, prevX = x, prevY = y, result += Math.sqrt(dx * dx + dy * dy);
return result;
}
/**
* Calculate the points for a bezier curve and then draws it.
*
* Ignored from docs since it is not directly exposed.
* @ignore
* @param cpX - Control point x
* @param cpY - Control point y
* @param cpX2 - Second Control point x
* @param cpY2 - Second Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @param points - Path array to push points into
*/
static curveTo(cpX, cpY, cpX2, cpY2, toX, toY, points) {
const fromX = points[points.length - 2], fromY = points[points.length - 1];
points.length -= 2;
const n = _const.curves._segmentsCount(
BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)
);
let dt = 0, dt2 = 0, dt3 = 0, t2 = 0, t3 = 0;
points.push(fromX, fromY);
for (let i = 1, j = 0; i <= n; ++i)
j = i / n, dt = 1 - j, dt2 = dt * dt, dt3 = dt2 * dt, t2 = j * j, t3 = t2 * j, points.push(
dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX,
dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY
);
}
}
exports.BezierUtils = BezierUtils;
//# sourceMappingURL=BezierUtils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BezierUtils.js","sources":["../../src/utils/BezierUtils.ts"],"sourcesContent":["import { curves } from '../const';\n\n/**\n * Utilities for bezier curves\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n * @private\n * @param fromX - Starting point x\n * @param fromY - Starting point y\n * @param cpX - Control point x\n * @param cpY - Control point y\n * @param cpX2 - Second Control point x\n * @param cpY2 - Second Control point y\n * @param toX - Destination point x\n * @param toY - Destination point y\n * @returns - Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @param cpX - Control point x\n * @param cpY - Control point y\n * @param cpX2 - Second Control point x\n * @param cpY2 - Second Control point y\n * @param toX - Destination point x\n * @param toY - Destination point y\n * @param points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array<number>): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = curves._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n"],"names":["curves"],"mappings":";;AAMO,MAAM,YACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBI,OAAO,YACH,OAAe,OACf,KAAa,KACb,MAAc,MACd,KAAa,KACjB;AAEQ,QAAA,SAAS,GACT,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,MAAM,GACN,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,QAAQ,OACR,QAAQ;AAEZ,aAAS,IAAI,GAAG,KAAK,IAAG,EAAE;AAElB,UAAA,IAAI,IACR,KAAK,IAAI,GACT,KAAK,KAAK,GACV,KAAM,IAAM,GACZ,MAAM,KAAK,IACX,MAAM,MAAM,IAEZ,IAAK,MAAM,QAAU,IAAM,MAAM,IAAI,MAAQ,IAAM,KAAK,KAAK,OAAS,KAAK,KAC3E,IAAK,MAAM,QAAU,IAAM,MAAM,IAAI,MAAQ,IAAI,KAAK,KAAK,OAAS,KAAK,KACzE,KAAK,QAAQ,GACb,KAAK,QAAQ,GACb,QAAQ,GACR,QAAQ,GAER,UAAU,KAAK,KAAM,KAAK,KAAO,KAAK,EAAG;AAGtC,WAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,OAAO,QACH,KAAa,KACb,MAAc,MACd,KAAa,KACb,QACJ;AACU,UAAA,QAAQ,OAAO,OAAO,SAAS,CAAC,GAChC,QAAQ,OAAO,OAAO,SAAS,CAAC;AAEtC,WAAO,UAAU;AAEjB,UAAM,IAAIA,OAAAA,OAAO;AAAA,MACb,YAAY,YAAY,OAAO,OAAO,KAAK,KAAK,MAAM,MAAM,KAAK,GAAG;AAAA,IAAA;AAGpE,QAAA,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,KAAK;AAEF,WAAA,KAAK,OAAO,KAAK;AAExB,aAAS,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE;AAE7B,UAAI,IAAI,GAER,KAAM,IAAI,GACV,MAAM,KAAK,IACX,MAAM,MAAM,IAEZ,KAAK,IAAI,GACT,KAAK,KAAK,GAEV,OAAO;AAAA,QACF,MAAM,QAAU,IAAI,MAAM,IAAI,MAAQ,IAAI,KAAK,KAAK,OAAS,KAAK;AAAA,QAClE,MAAM,QAAU,IAAI,MAAM,IAAI,MAAQ,IAAI,KAAK,KAAK,OAAS,KAAK;AAAA,MAAA;AAAA,EAG/E;AACJ;;"}

View File

@@ -0,0 +1,55 @@
import { curves } from "../const.mjs";
class BezierUtils {
/**
* Calculate length of bezier curve.
* Analytical solution is impossible, since it involves an integral that does not integrate in general.
* Therefore numerical solution is used.
* @private
* @param fromX - Starting point x
* @param fromY - Starting point y
* @param cpX - Control point x
* @param cpY - Control point y
* @param cpX2 - Second Control point x
* @param cpY2 - Second Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @returns - Length of bezier curve
*/
static curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {
let result = 0, t = 0, t2 = 0, t3 = 0, nt = 0, nt2 = 0, nt3 = 0, x = 0, y = 0, dx = 0, dy = 0, prevX = fromX, prevY = fromY;
for (let i = 1; i <= 10; ++i)
t = i / 10, t2 = t * t, t3 = t2 * t, nt = 1 - t, nt2 = nt * nt, nt3 = nt2 * nt, x = nt3 * fromX + 3 * nt2 * t * cpX + 3 * nt * t2 * cpX2 + t3 * toX, y = nt3 * fromY + 3 * nt2 * t * cpY + 3 * nt * t2 * cpY2 + t3 * toY, dx = prevX - x, dy = prevY - y, prevX = x, prevY = y, result += Math.sqrt(dx * dx + dy * dy);
return result;
}
/**
* Calculate the points for a bezier curve and then draws it.
*
* Ignored from docs since it is not directly exposed.
* @ignore
* @param cpX - Control point x
* @param cpY - Control point y
* @param cpX2 - Second Control point x
* @param cpY2 - Second Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @param points - Path array to push points into
*/
static curveTo(cpX, cpY, cpX2, cpY2, toX, toY, points) {
const fromX = points[points.length - 2], fromY = points[points.length - 1];
points.length -= 2;
const n = curves._segmentsCount(
BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)
);
let dt = 0, dt2 = 0, dt3 = 0, t2 = 0, t3 = 0;
points.push(fromX, fromY);
for (let i = 1, j = 0; i <= n; ++i)
j = i / n, dt = 1 - j, dt2 = dt * dt, dt3 = dt2 * dt, t2 = j * j, t3 = t2 * j, points.push(
dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX,
dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY
);
}
}
export {
BezierUtils
};
//# sourceMappingURL=BezierUtils.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BezierUtils.mjs","sources":["../../src/utils/BezierUtils.ts"],"sourcesContent":["import { curves } from '../const';\n\n/**\n * Utilities for bezier curves\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n * @private\n * @param fromX - Starting point x\n * @param fromY - Starting point y\n * @param cpX - Control point x\n * @param cpY - Control point y\n * @param cpX2 - Second Control point x\n * @param cpY2 - Second Control point y\n * @param toX - Destination point x\n * @param toY - Destination point y\n * @returns - Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @param cpX - Control point x\n * @param cpY - Control point y\n * @param cpX2 - Second Control point x\n * @param cpY2 - Second Control point y\n * @param toX - Destination point x\n * @param toY - Destination point y\n * @param points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array<number>): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = curves._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n"],"names":[],"mappings":";AAMO,MAAM,YACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBI,OAAO,YACH,OAAe,OACf,KAAa,KACb,MAAc,MACd,KAAa,KACjB;AAEQ,QAAA,SAAS,GACT,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,MAAM,GACN,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,QAAQ,OACR,QAAQ;AAEZ,aAAS,IAAI,GAAG,KAAK,IAAG,EAAE;AAElB,UAAA,IAAI,IACR,KAAK,IAAI,GACT,KAAK,KAAK,GACV,KAAM,IAAM,GACZ,MAAM,KAAK,IACX,MAAM,MAAM,IAEZ,IAAK,MAAM,QAAU,IAAM,MAAM,IAAI,MAAQ,IAAM,KAAK,KAAK,OAAS,KAAK,KAC3E,IAAK,MAAM,QAAU,IAAM,MAAM,IAAI,MAAQ,IAAI,KAAK,KAAK,OAAS,KAAK,KACzE,KAAK,QAAQ,GACb,KAAK,QAAQ,GACb,QAAQ,GACR,QAAQ,GAER,UAAU,KAAK,KAAM,KAAK,KAAO,KAAK,EAAG;AAGtC,WAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,OAAO,QACH,KAAa,KACb,MAAc,MACd,KAAa,KACb,QACJ;AACU,UAAA,QAAQ,OAAO,OAAO,SAAS,CAAC,GAChC,QAAQ,OAAO,OAAO,SAAS,CAAC;AAEtC,WAAO,UAAU;AAEjB,UAAM,IAAI,OAAO;AAAA,MACb,YAAY,YAAY,OAAO,OAAO,KAAK,KAAK,MAAM,MAAM,KAAK,GAAG;AAAA,IAAA;AAGpE,QAAA,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,KAAK;AAEF,WAAA,KAAK,OAAO,KAAK;AAExB,aAAS,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE;AAE7B,UAAI,IAAI,GAER,KAAM,IAAI,GACV,MAAM,KAAK,IACX,MAAM,MAAM,IAEZ,KAAK,IAAI,GACT,KAAK,KAAK,GAEV,OAAO;AAAA,QACF,MAAM,QAAU,IAAI,MAAM,IAAI,MAAQ,IAAI,KAAK,KAAK,OAAS,KAAK;AAAA,QAClE,MAAM,QAAU,IAAI,MAAM,IAAI,MAAQ,IAAI,KAAK,KAAK,OAAS,KAAK;AAAA,MAAA;AAAA,EAG/E;AACJ;"}

View File

@@ -0,0 +1,46 @@
"use strict";
var _const = require("../const.js");
class QuadraticUtils {
/**
* Calculate length of quadratic curve
* @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}
* for the detailed explanation of math behind this.
* @private
* @param fromX - x-coordinate of curve start point
* @param fromY - y-coordinate of curve start point
* @param cpX - x-coordinate of curve control point
* @param cpY - y-coordinate of curve control point
* @param toX - x-coordinate of curve end point
* @param toY - y-coordinate of curve end point
* @returns - Length of quadratic curve
*/
static curveLength(fromX, fromY, cpX, cpY, toX, toY) {
const ax = fromX - 2 * cpX + toX, ay = fromY - 2 * cpY + toY, bx = 2 * cpX - 2 * fromX, by = 2 * cpY - 2 * fromY, a = 4 * (ax * ax + ay * ay), b = 4 * (ax * bx + ay * by), c = bx * bx + by * by, s = 2 * Math.sqrt(a + b + c), a2 = Math.sqrt(a), a32 = 2 * a * a2, c2 = 2 * Math.sqrt(c), ba = b / a2;
return (a32 * s + a2 * b * (s - c2) + (4 * c * a - b * b) * Math.log((2 * a2 + ba + s) / (ba + c2))) / (4 * a32);
}
/**
* Calculate the points for a quadratic bezier curve and then draws it.
* Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
* @private
* @param cpX - Control point x
* @param cpY - Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @param points - Points to add segments to.
*/
static curveTo(cpX, cpY, toX, toY, points) {
const fromX = points[points.length - 2], fromY = points[points.length - 1], n = _const.curves._segmentsCount(
QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)
);
let xa = 0, ya = 0;
for (let i = 1; i <= n; ++i) {
const j = i / n;
xa = fromX + (cpX - fromX) * j, ya = fromY + (cpY - fromY) * j, points.push(
xa + (cpX + (toX - cpX) * j - xa) * j,
ya + (cpY + (toY - cpY) * j - ya) * j
);
}
}
}
exports.QuadraticUtils = QuadraticUtils;
//# sourceMappingURL=QuadraticUtils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"QuadraticUtils.js","sources":["../../src/utils/QuadraticUtils.ts"],"sourcesContent":["import { curves } from '../const';\n\n/**\n * Utilities for quadratic curves.\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n * @private\n * @param fromX - x-coordinate of curve start point\n * @param fromY - y-coordinate of curve start point\n * @param cpX - x-coordinate of curve control point\n * @param cpY - y-coordinate of curve control point\n * @param toX - x-coordinate of curve end point\n * @param toY - y-coordinate of curve end point\n * @returns - Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n * @private\n * @param cpX - Control point x\n * @param cpY - Control point y\n * @param toX - Destination point x\n * @param toY - Destination point y\n * @param points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array<number>): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = curves._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n"],"names":["curves"],"mappings":";;AAMO,MAAM,eACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcI,OAAO,YACH,OAAe,OACf,KAAa,KACb,KAAa,KACjB;AACI,UAAM,KAAK,QAAS,IAAM,MAAO,KAC3B,KAAK,QAAS,IAAM,MAAO,KAC3B,KAAM,IAAM,MAAQ,IAAM,OAC1B,KAAM,IAAM,MAAQ,IAAM,OAC1B,IAAI,KAAQ,KAAK,KAAO,KAAK,KAC7B,IAAI,KAAQ,KAAK,KAAO,KAAK,KAC7B,IAAK,KAAK,KAAO,KAAK,IAEtB,IAAI,IAAM,KAAK,KAAK,IAAI,IAAI,CAAC,GAC7B,KAAK,KAAK,KAAK,CAAC,GAChB,MAAM,IAAM,IAAI,IAChB,KAAK,IAAM,KAAK,KAAK,CAAC,GACtB,KAAK,IAAI;AAGV,YAAA,MAAM,IACA,KAAK,KAAK,IAAI,OAEX,IAAM,IAAI,IAAM,IAAI,KACrB,KAAK,KAAM,IAAM,KAAM,KAAK,MAAM,KAAK,GAAG,MAElD,IAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,OAAO,QAAQ,KAAa,KAAa,KAAa,KAAa,QACnE;AACI,UAAM,QAAQ,OAAO,OAAO,SAAS,CAAC,GAChC,QAAQ,OAAO,OAAO,SAAS,CAAC,GAEhC,IAAIA,OAAO,OAAA;AAAA,MACb,eAAe,YAAY,OAAO,OAAO,KAAK,KAAK,KAAK,GAAG;AAAA,IAAA;AAG3D,QAAA,KAAK,GACL,KAAK;AAET,aAAS,IAAI,GAAG,KAAK,GAAG,EAAE,GAC1B;AACI,YAAM,IAAI,IAAI;AAET,WAAA,SAAU,MAAM,SAAS,GAC9B,KAAK,SAAU,MAAM,SAAS,GAE9B,OAAO;AAAA,QAAK,MAAQ,OAAQ,MAAM,OAAO,IAAM,MAAM;AAAA,QACjD,MAAQ,OAAQ,MAAM,OAAO,IAAM,MAAM;AAAA,MAAA;AAAA,IACjD;AAAA,EACJ;AACJ;;"}

View File

@@ -0,0 +1,47 @@
import { curves } from "../const.mjs";
class QuadraticUtils {
/**
* Calculate length of quadratic curve
* @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}
* for the detailed explanation of math behind this.
* @private
* @param fromX - x-coordinate of curve start point
* @param fromY - y-coordinate of curve start point
* @param cpX - x-coordinate of curve control point
* @param cpY - y-coordinate of curve control point
* @param toX - x-coordinate of curve end point
* @param toY - y-coordinate of curve end point
* @returns - Length of quadratic curve
*/
static curveLength(fromX, fromY, cpX, cpY, toX, toY) {
const ax = fromX - 2 * cpX + toX, ay = fromY - 2 * cpY + toY, bx = 2 * cpX - 2 * fromX, by = 2 * cpY - 2 * fromY, a = 4 * (ax * ax + ay * ay), b = 4 * (ax * bx + ay * by), c = bx * bx + by * by, s = 2 * Math.sqrt(a + b + c), a2 = Math.sqrt(a), a32 = 2 * a * a2, c2 = 2 * Math.sqrt(c), ba = b / a2;
return (a32 * s + a2 * b * (s - c2) + (4 * c * a - b * b) * Math.log((2 * a2 + ba + s) / (ba + c2))) / (4 * a32);
}
/**
* Calculate the points for a quadratic bezier curve and then draws it.
* Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
* @private
* @param cpX - Control point x
* @param cpY - Control point y
* @param toX - Destination point x
* @param toY - Destination point y
* @param points - Points to add segments to.
*/
static curveTo(cpX, cpY, toX, toY, points) {
const fromX = points[points.length - 2], fromY = points[points.length - 1], n = curves._segmentsCount(
QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)
);
let xa = 0, ya = 0;
for (let i = 1; i <= n; ++i) {
const j = i / n;
xa = fromX + (cpX - fromX) * j, ya = fromY + (cpY - fromY) * j, points.push(
xa + (cpX + (toX - cpX) * j - xa) * j,
ya + (cpY + (toY - cpY) * j - ya) * j
);
}
}
}
export {
QuadraticUtils
};
//# sourceMappingURL=QuadraticUtils.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"QuadraticUtils.mjs","sources":["../../src/utils/QuadraticUtils.ts"],"sourcesContent":["import { curves } from '../const';\n\n/**\n * Utilities for quadratic curves.\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n * @private\n * @param fromX - x-coordinate of curve start point\n * @param fromY - y-coordinate of curve start point\n * @param cpX - x-coordinate of curve control point\n * @param cpY - y-coordinate of curve control point\n * @param toX - x-coordinate of curve end point\n * @param toY - y-coordinate of curve end point\n * @returns - Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n * @private\n * @param cpX - Control point x\n * @param cpY - Control point y\n * @param toX - Destination point x\n * @param toY - Destination point y\n * @param points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array<number>): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = curves._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n"],"names":[],"mappings":";AAMO,MAAM,eACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcI,OAAO,YACH,OAAe,OACf,KAAa,KACb,KAAa,KACjB;AACI,UAAM,KAAK,QAAS,IAAM,MAAO,KAC3B,KAAK,QAAS,IAAM,MAAO,KAC3B,KAAM,IAAM,MAAQ,IAAM,OAC1B,KAAM,IAAM,MAAQ,IAAM,OAC1B,IAAI,KAAQ,KAAK,KAAO,KAAK,KAC7B,IAAI,KAAQ,KAAK,KAAO,KAAK,KAC7B,IAAK,KAAK,KAAO,KAAK,IAEtB,IAAI,IAAM,KAAK,KAAK,IAAI,IAAI,CAAC,GAC7B,KAAK,KAAK,KAAK,CAAC,GAChB,MAAM,IAAM,IAAI,IAChB,KAAK,IAAM,KAAK,KAAK,CAAC,GACtB,KAAK,IAAI;AAGV,YAAA,MAAM,IACA,KAAK,KAAK,IAAI,OAEX,IAAM,IAAI,IAAM,IAAI,KACrB,KAAK,KAAM,IAAM,KAAM,KAAK,MAAM,KAAK,GAAG,MAElD,IAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,OAAO,QAAQ,KAAa,KAAa,KAAa,KAAa,QACnE;AACI,UAAM,QAAQ,OAAO,OAAO,SAAS,CAAC,GAChC,QAAQ,OAAO,OAAO,SAAS,CAAC,GAEhC,IAAI,OAAO;AAAA,MACb,eAAe,YAAY,OAAO,OAAO,KAAK,KAAK,KAAK,GAAG;AAAA,IAAA;AAG3D,QAAA,KAAK,GACL,KAAK;AAET,aAAS,IAAI,GAAG,KAAK,GAAG,EAAE,GAC1B;AACI,YAAM,IAAI,IAAI;AAET,WAAA,SAAU,MAAM,SAAS,GAC9B,KAAK,SAAU,MAAM,SAAS,GAE9B,OAAO;AAAA,QAAK,MAAQ,OAAQ,MAAM,OAAO,IAAM,MAAM;AAAA,QACjD,MAAQ,OAAQ,MAAM,OAAO,IAAM,MAAM;AAAA,MAAA;AAAA,IACjD;AAAA,EACJ;AACJ;"}

View File

@@ -0,0 +1,70 @@
"use strict";
var core = require("@pixi/core");
const buildCircle = {
build(graphicsData) {
const points = graphicsData.points;
let x, y, dx, dy, rx, ry;
if (graphicsData.type === core.SHAPES.CIRC) {
const circle = graphicsData.shape;
x = circle.x, y = circle.y, rx = ry = circle.radius, dx = dy = 0;
} else if (graphicsData.type === core.SHAPES.ELIP) {
const ellipse = graphicsData.shape;
x = ellipse.x, y = ellipse.y, rx = ellipse.width, ry = ellipse.height, dx = dy = 0;
} else {
const roundedRect = graphicsData.shape, halfWidth = roundedRect.width / 2, halfHeight = roundedRect.height / 2;
x = roundedRect.x + halfWidth, y = roundedRect.y + halfHeight, rx = ry = Math.max(0, Math.min(roundedRect.radius, Math.min(halfWidth, halfHeight))), dx = halfWidth - rx, dy = halfHeight - ry;
}
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
points.length = 0;
return;
}
const n = Math.ceil(2.3 * Math.sqrt(rx + ry)), m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
if (points.length = m, m === 0)
return;
if (n === 0) {
points.length = 8, points[0] = points[6] = x + dx, points[1] = points[3] = y + dy, points[2] = points[4] = x - dx, points[5] = points[7] = y - dy;
return;
}
let j1 = 0, j2 = n * 4 + (dx ? 2 : 0) + 2, j3 = j2, j4 = m;
{
const x0 = dx + rx, y0 = dy, x1 = x + x0, x2 = x - x0, y1 = y + y0;
if (points[j1++] = x1, points[j1++] = y1, points[--j2] = y1, points[--j2] = x2, dy) {
const y2 = y - y0;
points[j3++] = x2, points[j3++] = y2, points[--j4] = y2, points[--j4] = x1;
}
}
for (let i = 1; i < n; i++) {
const a = Math.PI / 2 * (i / n), x0 = dx + Math.cos(a) * rx, y0 = dy + Math.sin(a) * ry, x1 = x + x0, x2 = x - x0, y1 = y + y0, y2 = y - y0;
points[j1++] = x1, points[j1++] = y1, points[--j2] = y1, points[--j2] = x2, points[j3++] = x2, points[j3++] = y2, points[--j4] = y2, points[--j4] = x1;
}
{
const x0 = dx, y0 = dy + ry, x1 = x + x0, x2 = x - x0, y1 = y + y0, y2 = y - y0;
points[j1++] = x1, points[j1++] = y1, points[--j4] = y2, points[--j4] = x1, dx && (points[j1++] = x2, points[j1++] = y1, points[--j4] = y2, points[--j4] = x2);
}
},
triangulate(graphicsData, graphicsGeometry) {
const points = graphicsData.points, verts = graphicsGeometry.points, indices = graphicsGeometry.indices;
if (points.length === 0)
return;
let vertPos = verts.length / 2;
const center = vertPos;
let x, y;
if (graphicsData.type !== core.SHAPES.RREC) {
const circle = graphicsData.shape;
x = circle.x, y = circle.y;
} else {
const roundedRect = graphicsData.shape;
x = roundedRect.x + roundedRect.width / 2, y = roundedRect.y + roundedRect.height / 2;
}
const matrix = graphicsData.matrix;
verts.push(
graphicsData.matrix ? matrix.a * x + matrix.c * y + matrix.tx : x,
graphicsData.matrix ? matrix.b * x + matrix.d * y + matrix.ty : y
), vertPos++, verts.push(points[0], points[1]);
for (let i = 2; i < points.length; i += 2)
verts.push(points[i], points[i + 1]), indices.push(vertPos++, center, vertPos);
indices.push(center + 1, center, vertPos);
}
};
exports.buildCircle = buildCircle;
//# sourceMappingURL=buildCircle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,71 @@
import { SHAPES } from "@pixi/core";
const buildCircle = {
build(graphicsData) {
const points = graphicsData.points;
let x, y, dx, dy, rx, ry;
if (graphicsData.type === SHAPES.CIRC) {
const circle = graphicsData.shape;
x = circle.x, y = circle.y, rx = ry = circle.radius, dx = dy = 0;
} else if (graphicsData.type === SHAPES.ELIP) {
const ellipse = graphicsData.shape;
x = ellipse.x, y = ellipse.y, rx = ellipse.width, ry = ellipse.height, dx = dy = 0;
} else {
const roundedRect = graphicsData.shape, halfWidth = roundedRect.width / 2, halfHeight = roundedRect.height / 2;
x = roundedRect.x + halfWidth, y = roundedRect.y + halfHeight, rx = ry = Math.max(0, Math.min(roundedRect.radius, Math.min(halfWidth, halfHeight))), dx = halfWidth - rx, dy = halfHeight - ry;
}
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
points.length = 0;
return;
}
const n = Math.ceil(2.3 * Math.sqrt(rx + ry)), m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
if (points.length = m, m === 0)
return;
if (n === 0) {
points.length = 8, points[0] = points[6] = x + dx, points[1] = points[3] = y + dy, points[2] = points[4] = x - dx, points[5] = points[7] = y - dy;
return;
}
let j1 = 0, j2 = n * 4 + (dx ? 2 : 0) + 2, j3 = j2, j4 = m;
{
const x0 = dx + rx, y0 = dy, x1 = x + x0, x2 = x - x0, y1 = y + y0;
if (points[j1++] = x1, points[j1++] = y1, points[--j2] = y1, points[--j2] = x2, dy) {
const y2 = y - y0;
points[j3++] = x2, points[j3++] = y2, points[--j4] = y2, points[--j4] = x1;
}
}
for (let i = 1; i < n; i++) {
const a = Math.PI / 2 * (i / n), x0 = dx + Math.cos(a) * rx, y0 = dy + Math.sin(a) * ry, x1 = x + x0, x2 = x - x0, y1 = y + y0, y2 = y - y0;
points[j1++] = x1, points[j1++] = y1, points[--j2] = y1, points[--j2] = x2, points[j3++] = x2, points[j3++] = y2, points[--j4] = y2, points[--j4] = x1;
}
{
const x0 = dx, y0 = dy + ry, x1 = x + x0, x2 = x - x0, y1 = y + y0, y2 = y - y0;
points[j1++] = x1, points[j1++] = y1, points[--j4] = y2, points[--j4] = x1, dx && (points[j1++] = x2, points[j1++] = y1, points[--j4] = y2, points[--j4] = x2);
}
},
triangulate(graphicsData, graphicsGeometry) {
const points = graphicsData.points, verts = graphicsGeometry.points, indices = graphicsGeometry.indices;
if (points.length === 0)
return;
let vertPos = verts.length / 2;
const center = vertPos;
let x, y;
if (graphicsData.type !== SHAPES.RREC) {
const circle = graphicsData.shape;
x = circle.x, y = circle.y;
} else {
const roundedRect = graphicsData.shape;
x = roundedRect.x + roundedRect.width / 2, y = roundedRect.y + roundedRect.height / 2;
}
const matrix = graphicsData.matrix;
verts.push(
graphicsData.matrix ? matrix.a * x + matrix.c * y + matrix.tx : x,
graphicsData.matrix ? matrix.b * x + matrix.d * y + matrix.ty : y
), vertPos++, verts.push(points[0], points[1]);
for (let i = 2; i < points.length; i += 2)
verts.push(points[i], points[i + 1]), indices.push(vertPos++, center, vertPos);
indices.push(center + 1, center, vertPos);
}
};
export {
buildCircle
};
//# sourceMappingURL=buildCircle.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,297 @@
"use strict";
var core = require("@pixi/core"), _const = require("../const.js");
function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {
const ix = x - nx * innerWeight, iy = y - ny * innerWeight, ox = x + nx * outerWeight, oy = y + ny * outerWeight;
let exx, eyy;
clockwise ? (exx = ny, eyy = -nx) : (exx = -ny, eyy = nx);
const eix = ix + exx, eiy = iy + eyy, eox = ox + exx, eoy = oy + eyy;
return verts.push(
eix,
eiy,
eox,
eoy
), 2;
}
function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
const cx2p0x = sx - cx, cy2p0y = sy - cy;
let angle0 = Math.atan2(cx2p0x, cy2p0y), angle1 = Math.atan2(ex - cx, ey - cy);
clockwise && angle0 < angle1 ? angle0 += Math.PI * 2 : !clockwise && angle0 > angle1 && (angle1 += Math.PI * 2);
let startAngle = angle0;
const angleDiff = angle1 - angle0, absAngleDiff = Math.abs(angleDiff), radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y), segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1, angleInc = angleDiff / segCount;
if (startAngle += angleInc, clockwise) {
verts.push(
cx,
cy,
sx,
sy
);
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)
verts.push(
cx,
cy,
cx + Math.sin(angle) * radius,
cy + Math.cos(angle) * radius
);
verts.push(
cx,
cy,
ex,
ey
);
} else {
verts.push(
sx,
sy,
cx,
cy
);
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)
verts.push(
cx + Math.sin(angle) * radius,
cy + Math.cos(angle) * radius,
cx,
cy
);
verts.push(
ex,
ey,
cx,
cy
);
}
return segCount * 2;
}
function buildNonNativeLine(graphicsData, graphicsGeometry) {
const shape = graphicsData.shape;
let points = graphicsData.points || shape.points.slice();
const eps = graphicsGeometry.closePointEps;
if (points.length === 0)
return;
const style = graphicsData.lineStyle, firstPoint = new core.Point(points[0], points[1]), lastPoint = new core.Point(points[points.length - 2], points[points.length - 1]), closedShape = shape.type !== core.SHAPES.POLY || shape.closeStroke, closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
if (closedShape) {
points = points.slice(), closedPath && (points.pop(), points.pop(), lastPoint.set(points[points.length - 2], points[points.length - 1]));
const midPointX = (firstPoint.x + lastPoint.x) * 0.5, midPointY = (lastPoint.y + firstPoint.y) * 0.5;
points.unshift(midPointX, midPointY), points.push(midPointX, midPointY);
}
const verts = graphicsGeometry.points, length = points.length / 2;
let indexCount = points.length;
const indexStart = verts.length / 2, width = style.width / 2, widthSquared = width * width, miterLimitSquared = style.miterLimit * style.miterLimit;
let x0 = points[0], y0 = points[1], x1 = points[2], y1 = points[3], x2 = 0, y2 = 0, perpx = -(y0 - y1), perpy = x0 - x1, perp1x = 0, perp1y = 0, dist = Math.sqrt(perpx * perpx + perpy * perpy);
perpx /= dist, perpy /= dist, perpx *= width, perpy *= width;
const ratio = style.alignment, innerWeight = (1 - ratio) * 2, outerWeight = ratio * 2;
closedShape || (style.cap === _const.LINE_CAP.ROUND ? indexCount += round(
x0 - perpx * (innerWeight - outerWeight) * 0.5,
y0 - perpy * (innerWeight - outerWeight) * 0.5,
x0 - perpx * innerWeight,
y0 - perpy * innerWeight,
x0 + perpx * outerWeight,
y0 + perpy * outerWeight,
verts,
!0
) + 2 : style.cap === _const.LINE_CAP.SQUARE && (indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, !0, verts))), verts.push(
x0 - perpx * innerWeight,
y0 - perpy * innerWeight,
x0 + perpx * outerWeight,
y0 + perpy * outerWeight
);
for (let i = 1; i < length - 1; ++i) {
x0 = points[(i - 1) * 2], y0 = points[(i - 1) * 2 + 1], x1 = points[i * 2], y1 = points[i * 2 + 1], x2 = points[(i + 1) * 2], y2 = points[(i + 1) * 2 + 1], perpx = -(y0 - y1), perpy = x0 - x1, dist = Math.sqrt(perpx * perpx + perpy * perpy), perpx /= dist, perpy /= dist, perpx *= width, perpy *= width, perp1x = -(y1 - y2), perp1y = x1 - x2, dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y), perp1x /= dist, perp1y /= dist, perp1x *= width, perp1y *= width;
const dx0 = x1 - x0, dy0 = y0 - y1, dx1 = x1 - x2, dy1 = y2 - y1, dot = dx0 * dx1 + dy0 * dy1, cross = dy0 * dx1 - dy1 * dx0, clockwise = cross < 0;
if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), dot >= 0 && (style.join === _const.LINE_JOIN.ROUND ? indexCount += round(
x1,
y1,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
verts,
!1
) + 4 : indexCount += 2, verts.push(
x1 - perp1x * outerWeight,
y1 - perp1y * outerWeight,
x1 + perp1x * innerWeight,
y1 + perp1y * innerWeight
));
continue;
}
const c1 = (-perpx + x0) * (-perpy + y1) - (-perpx + x1) * (-perpy + y0), c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2), px = (dx0 * c2 - dx1 * c1) / cross, py = (dy1 * c1 - dy0 * c2) / cross, pdist = (px - x1) * (px - x1) + (py - y1) * (py - y1), imx = x1 + (px - x1) * innerWeight, imy = y1 + (py - y1) * innerWeight, omx = x1 - (px - x1) * outerWeight, omy = y1 - (py - y1) * outerWeight, smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1), insideWeight = clockwise ? innerWeight : outerWeight, smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared, insideMiterOk = pdist <= smallerInsideDiagonalSq;
let join = style.join;
if (join === _const.LINE_JOIN.MITER && pdist / widthSquared > miterLimitSquared && (join = _const.LINE_JOIN.BEVEL), insideMiterOk)
switch (join) {
case _const.LINE_JOIN.MITER: {
verts.push(
imx,
imy,
omx,
omy
);
break;
}
case _const.LINE_JOIN.BEVEL: {
clockwise ? verts.push(
imx,
imy,
// inner miter point
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
// first segment's outer vertex
imx,
imy,
// inner miter point
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight
) : verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
// first segment's inner vertex
omx,
omy,
// outer miter point
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
// second segment's outer vertex
omx,
omy
), indexCount += 2;
break;
}
case _const.LINE_JOIN.ROUND: {
clockwise ? (verts.push(
imx,
imy,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), indexCount += round(
x1,
y1,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight,
verts,
!0
) + 4, verts.push(
imx,
imy,
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight
)) : (verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
omx,
omy
), indexCount += round(
x1,
y1,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
verts,
!1
) + 4, verts.push(
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
omx,
omy
));
break;
}
}
else {
switch (verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
// first segment's inner vertex
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), join) {
case _const.LINE_JOIN.MITER: {
clockwise ? verts.push(
omx,
omy,
// inner miter point
omx,
omy
) : verts.push(
imx,
imy,
// outer miter point
imx,
imy
), indexCount += 2;
break;
}
case _const.LINE_JOIN.ROUND: {
clockwise ? indexCount += round(
x1,
y1,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight,
verts,
!0
) + 2 : indexCount += round(
x1,
y1,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
verts,
!1
) + 2;
break;
}
}
verts.push(
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
// second segment's inner vertex
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight
), indexCount += 2;
}
}
x0 = points[(length - 2) * 2], y0 = points[(length - 2) * 2 + 1], x1 = points[(length - 1) * 2], y1 = points[(length - 1) * 2 + 1], perpx = -(y0 - y1), perpy = x0 - x1, dist = Math.sqrt(perpx * perpx + perpy * perpy), perpx /= dist, perpy /= dist, perpx *= width, perpy *= width, verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), closedShape || (style.cap === _const.LINE_CAP.ROUND ? indexCount += round(
x1 - perpx * (innerWeight - outerWeight) * 0.5,
y1 - perpy * (innerWeight - outerWeight) * 0.5,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
verts,
!1
) + 2 : style.cap === _const.LINE_CAP.SQUARE && (indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, !1, verts)));
const indices = graphicsGeometry.indices, eps2 = _const.curves.epsilon * _const.curves.epsilon;
for (let i = indexStart; i < indexCount + indexStart - 2; ++i)
x0 = verts[i * 2], y0 = verts[i * 2 + 1], x1 = verts[(i + 1) * 2], y1 = verts[(i + 1) * 2 + 1], x2 = verts[(i + 2) * 2], y2 = verts[(i + 2) * 2 + 1], !(Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) && indices.push(i, i + 1, i + 2);
}
function buildNativeLine(graphicsData, graphicsGeometry) {
let i = 0;
const shape = graphicsData.shape, points = graphicsData.points || shape.points, closedShape = shape.type !== core.SHAPES.POLY || shape.closeStroke;
if (points.length === 0)
return;
const verts = graphicsGeometry.points, indices = graphicsGeometry.indices, length = points.length / 2, startIndex = verts.length / 2;
let currentIndex = startIndex;
for (verts.push(points[0], points[1]), i = 1; i < length; i++)
verts.push(points[i * 2], points[i * 2 + 1]), indices.push(currentIndex, currentIndex + 1), currentIndex++;
closedShape && indices.push(currentIndex, startIndex);
}
function buildLine(graphicsData, graphicsGeometry) {
graphicsData.lineStyle.native ? buildNativeLine(graphicsData, graphicsGeometry) : buildNonNativeLine(graphicsData, graphicsGeometry);
}
exports.buildLine = buildLine;
//# sourceMappingURL=buildLine.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,299 @@
import { Point, SHAPES } from "@pixi/core";
import { LINE_CAP, LINE_JOIN, curves } from "../const.mjs";
function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {
const ix = x - nx * innerWeight, iy = y - ny * innerWeight, ox = x + nx * outerWeight, oy = y + ny * outerWeight;
let exx, eyy;
clockwise ? (exx = ny, eyy = -nx) : (exx = -ny, eyy = nx);
const eix = ix + exx, eiy = iy + eyy, eox = ox + exx, eoy = oy + eyy;
return verts.push(
eix,
eiy,
eox,
eoy
), 2;
}
function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
const cx2p0x = sx - cx, cy2p0y = sy - cy;
let angle0 = Math.atan2(cx2p0x, cy2p0y), angle1 = Math.atan2(ex - cx, ey - cy);
clockwise && angle0 < angle1 ? angle0 += Math.PI * 2 : !clockwise && angle0 > angle1 && (angle1 += Math.PI * 2);
let startAngle = angle0;
const angleDiff = angle1 - angle0, absAngleDiff = Math.abs(angleDiff), radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y), segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1, angleInc = angleDiff / segCount;
if (startAngle += angleInc, clockwise) {
verts.push(
cx,
cy,
sx,
sy
);
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)
verts.push(
cx,
cy,
cx + Math.sin(angle) * radius,
cy + Math.cos(angle) * radius
);
verts.push(
cx,
cy,
ex,
ey
);
} else {
verts.push(
sx,
sy,
cx,
cy
);
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)
verts.push(
cx + Math.sin(angle) * radius,
cy + Math.cos(angle) * radius,
cx,
cy
);
verts.push(
ex,
ey,
cx,
cy
);
}
return segCount * 2;
}
function buildNonNativeLine(graphicsData, graphicsGeometry) {
const shape = graphicsData.shape;
let points = graphicsData.points || shape.points.slice();
const eps = graphicsGeometry.closePointEps;
if (points.length === 0)
return;
const style = graphicsData.lineStyle, firstPoint = new Point(points[0], points[1]), lastPoint = new Point(points[points.length - 2], points[points.length - 1]), closedShape = shape.type !== SHAPES.POLY || shape.closeStroke, closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
if (closedShape) {
points = points.slice(), closedPath && (points.pop(), points.pop(), lastPoint.set(points[points.length - 2], points[points.length - 1]));
const midPointX = (firstPoint.x + lastPoint.x) * 0.5, midPointY = (lastPoint.y + firstPoint.y) * 0.5;
points.unshift(midPointX, midPointY), points.push(midPointX, midPointY);
}
const verts = graphicsGeometry.points, length = points.length / 2;
let indexCount = points.length;
const indexStart = verts.length / 2, width = style.width / 2, widthSquared = width * width, miterLimitSquared = style.miterLimit * style.miterLimit;
let x0 = points[0], y0 = points[1], x1 = points[2], y1 = points[3], x2 = 0, y2 = 0, perpx = -(y0 - y1), perpy = x0 - x1, perp1x = 0, perp1y = 0, dist = Math.sqrt(perpx * perpx + perpy * perpy);
perpx /= dist, perpy /= dist, perpx *= width, perpy *= width;
const ratio = style.alignment, innerWeight = (1 - ratio) * 2, outerWeight = ratio * 2;
closedShape || (style.cap === LINE_CAP.ROUND ? indexCount += round(
x0 - perpx * (innerWeight - outerWeight) * 0.5,
y0 - perpy * (innerWeight - outerWeight) * 0.5,
x0 - perpx * innerWeight,
y0 - perpy * innerWeight,
x0 + perpx * outerWeight,
y0 + perpy * outerWeight,
verts,
!0
) + 2 : style.cap === LINE_CAP.SQUARE && (indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, !0, verts))), verts.push(
x0 - perpx * innerWeight,
y0 - perpy * innerWeight,
x0 + perpx * outerWeight,
y0 + perpy * outerWeight
);
for (let i = 1; i < length - 1; ++i) {
x0 = points[(i - 1) * 2], y0 = points[(i - 1) * 2 + 1], x1 = points[i * 2], y1 = points[i * 2 + 1], x2 = points[(i + 1) * 2], y2 = points[(i + 1) * 2 + 1], perpx = -(y0 - y1), perpy = x0 - x1, dist = Math.sqrt(perpx * perpx + perpy * perpy), perpx /= dist, perpy /= dist, perpx *= width, perpy *= width, perp1x = -(y1 - y2), perp1y = x1 - x2, dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y), perp1x /= dist, perp1y /= dist, perp1x *= width, perp1y *= width;
const dx0 = x1 - x0, dy0 = y0 - y1, dx1 = x1 - x2, dy1 = y2 - y1, dot = dx0 * dx1 + dy0 * dy1, cross = dy0 * dx1 - dy1 * dx0, clockwise = cross < 0;
if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), dot >= 0 && (style.join === LINE_JOIN.ROUND ? indexCount += round(
x1,
y1,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
verts,
!1
) + 4 : indexCount += 2, verts.push(
x1 - perp1x * outerWeight,
y1 - perp1y * outerWeight,
x1 + perp1x * innerWeight,
y1 + perp1y * innerWeight
));
continue;
}
const c1 = (-perpx + x0) * (-perpy + y1) - (-perpx + x1) * (-perpy + y0), c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2), px = (dx0 * c2 - dx1 * c1) / cross, py = (dy1 * c1 - dy0 * c2) / cross, pdist = (px - x1) * (px - x1) + (py - y1) * (py - y1), imx = x1 + (px - x1) * innerWeight, imy = y1 + (py - y1) * innerWeight, omx = x1 - (px - x1) * outerWeight, omy = y1 - (py - y1) * outerWeight, smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1), insideWeight = clockwise ? innerWeight : outerWeight, smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared, insideMiterOk = pdist <= smallerInsideDiagonalSq;
let join = style.join;
if (join === LINE_JOIN.MITER && pdist / widthSquared > miterLimitSquared && (join = LINE_JOIN.BEVEL), insideMiterOk)
switch (join) {
case LINE_JOIN.MITER: {
verts.push(
imx,
imy,
omx,
omy
);
break;
}
case LINE_JOIN.BEVEL: {
clockwise ? verts.push(
imx,
imy,
// inner miter point
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
// first segment's outer vertex
imx,
imy,
// inner miter point
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight
) : verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
// first segment's inner vertex
omx,
omy,
// outer miter point
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
// second segment's outer vertex
omx,
omy
), indexCount += 2;
break;
}
case LINE_JOIN.ROUND: {
clockwise ? (verts.push(
imx,
imy,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), indexCount += round(
x1,
y1,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight,
verts,
!0
) + 4, verts.push(
imx,
imy,
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight
)) : (verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
omx,
omy
), indexCount += round(
x1,
y1,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
verts,
!1
) + 4, verts.push(
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
omx,
omy
));
break;
}
}
else {
switch (verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
// first segment's inner vertex
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), join) {
case LINE_JOIN.MITER: {
clockwise ? verts.push(
omx,
omy,
// inner miter point
omx,
omy
) : verts.push(
imx,
imy,
// outer miter point
imx,
imy
), indexCount += 2;
break;
}
case LINE_JOIN.ROUND: {
clockwise ? indexCount += round(
x1,
y1,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight,
verts,
!0
) + 2 : indexCount += round(
x1,
y1,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
verts,
!1
) + 2;
break;
}
}
verts.push(
x1 - perp1x * innerWeight,
y1 - perp1y * innerWeight,
// second segment's inner vertex
x1 + perp1x * outerWeight,
y1 + perp1y * outerWeight
), indexCount += 2;
}
}
x0 = points[(length - 2) * 2], y0 = points[(length - 2) * 2 + 1], x1 = points[(length - 1) * 2], y1 = points[(length - 1) * 2 + 1], perpx = -(y0 - y1), perpy = x0 - x1, dist = Math.sqrt(perpx * perpx + perpy * perpy), perpx /= dist, perpy /= dist, perpx *= width, perpy *= width, verts.push(
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight
), closedShape || (style.cap === LINE_CAP.ROUND ? indexCount += round(
x1 - perpx * (innerWeight - outerWeight) * 0.5,
y1 - perpy * (innerWeight - outerWeight) * 0.5,
x1 - perpx * innerWeight,
y1 - perpy * innerWeight,
x1 + perpx * outerWeight,
y1 + perpy * outerWeight,
verts,
!1
) + 2 : style.cap === LINE_CAP.SQUARE && (indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, !1, verts)));
const indices = graphicsGeometry.indices, eps2 = curves.epsilon * curves.epsilon;
for (let i = indexStart; i < indexCount + indexStart - 2; ++i)
x0 = verts[i * 2], y0 = verts[i * 2 + 1], x1 = verts[(i + 1) * 2], y1 = verts[(i + 1) * 2 + 1], x2 = verts[(i + 2) * 2], y2 = verts[(i + 2) * 2 + 1], !(Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) && indices.push(i, i + 1, i + 2);
}
function buildNativeLine(graphicsData, graphicsGeometry) {
let i = 0;
const shape = graphicsData.shape, points = graphicsData.points || shape.points, closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;
if (points.length === 0)
return;
const verts = graphicsGeometry.points, indices = graphicsGeometry.indices, length = points.length / 2, startIndex = verts.length / 2;
let currentIndex = startIndex;
for (verts.push(points[0], points[1]), i = 1; i < length; i++)
verts.push(points[i * 2], points[i * 2 + 1]), indices.push(currentIndex, currentIndex + 1), currentIndex++;
closedShape && indices.push(currentIndex, startIndex);
}
function buildLine(graphicsData, graphicsGeometry) {
graphicsData.lineStyle.native ? buildNativeLine(graphicsData, graphicsGeometry) : buildNonNativeLine(graphicsData, graphicsGeometry);
}
export {
buildLine
};
//# sourceMappingURL=buildLine.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
"use strict";
var core = require("@pixi/core");
function fixOrientation(points, hole = !1) {
const m = points.length;
if (m < 6)
return;
let area = 0;
for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
const x2 = points[i], y2 = points[i + 1];
area += (x2 - x1) * (y2 + y1), x1 = x2, y1 = y2;
}
if (!hole && area > 0 || hole && area <= 0) {
const n = m / 2;
for (let i = n + n % 2; i < m; i += 2) {
const i1 = m - i - 2, i2 = m - i - 1, i3 = i, i4 = i + 1;
[points[i1], points[i3]] = [points[i3], points[i1]], [points[i2], points[i4]] = [points[i4], points[i2]];
}
}
}
const buildPoly = {
build(graphicsData) {
graphicsData.points = graphicsData.shape.points.slice();
},
triangulate(graphicsData, graphicsGeometry) {
let points = graphicsData.points;
const holes = graphicsData.holes, verts = graphicsGeometry.points, indices = graphicsGeometry.indices;
if (points.length >= 6) {
fixOrientation(points, !1);
const holeArray = [];
for (let i = 0; i < holes.length; i++) {
const hole = holes[i];
fixOrientation(hole.points, !0), holeArray.push(points.length / 2), points = points.concat(hole.points);
}
const triangles = core.utils.earcut(points, holeArray, 2);
if (!triangles)
return;
const vertPos = verts.length / 2;
for (let i = 0; i < triangles.length; i += 3)
indices.push(triangles[i] + vertPos), indices.push(triangles[i + 1] + vertPos), indices.push(triangles[i + 2] + vertPos);
for (let i = 0; i < points.length; i++)
verts.push(points[i]);
}
}
};
exports.buildPoly = buildPoly;
//# sourceMappingURL=buildPoly.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildPoly.js","sources":["../../src/utils/buildPoly.ts"],"sourcesContent":["import { utils } from '@pixi/core';\n\nimport type { Polygon } from '@pixi/core';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\nfunction fixOrientation(points: number[], hole = false)\n{\n const m = points.length;\n\n if (m < 6)\n {\n return;\n }\n\n let area = 0;\n\n for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2)\n {\n const x2 = points[i];\n const y2 = points[i + 1];\n\n area += (x2 - x1) * (y2 + y1);\n\n x1 = x2;\n y1 = y2;\n }\n\n if ((!hole && area > 0) || (hole && area <= 0))\n {\n const n = m / 2;\n\n for (let i = n + (n % 2); i < m; i += 2)\n {\n const i1 = m - i - 2;\n const i2 = m - i - 1;\n const i3 = i;\n const i4 = i + 1;\n\n [points[i1], points[i3]] = [points[i3], points[i1]];\n [points[i2], points[i4]] = [points[i4], points[i2]];\n }\n }\n}\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n fixOrientation(points, false);\n\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n fixOrientation(hole.points, true);\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = utils.earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n"],"names":["utils"],"mappings":";;AAKA,SAAS,eAAe,QAAkB,OAAO,IACjD;AACI,QAAM,IAAI,OAAO;AAEjB,MAAI,IAAI;AAEJ;AAGJ,MAAI,OAAO;AAEX,WAAS,IAAI,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GACpE;AACI,UAAM,KAAK,OAAO,CAAC,GACb,KAAK,OAAO,IAAI,CAAC;AAEvB,aAAS,KAAK,OAAO,KAAK,KAE1B,KAAK,IACL,KAAK;AAAA,EACT;AAEA,MAAK,CAAC,QAAQ,OAAO,KAAO,QAAQ,QAAQ,GAC5C;AACI,UAAM,IAAI,IAAI;AAEd,aAAS,IAAI,IAAK,IAAI,GAAI,IAAI,GAAG,KAAK,GACtC;AACU,YAAA,KAAK,IAAI,IAAI,GACb,KAAK,IAAI,IAAI,GACb,KAAK,GACL,KAAK,IAAI;AAEf,OAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,GAClD,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;AAAA,IACtD;AAAA,EACJ;AACJ;AAWO,MAAM,YAAgC;AAAA,EAEzC,MAAM,cACN;AACI,iBAAa,SAAU,aAAa,MAAkB,OAAO,MAAM;AAAA,EACvE;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACI,QAAI,SAAS,aAAa;AAC1B,UAAM,QAAQ,aAAa,OACrB,QAAQ,iBAAiB,QACzB,UAAU,iBAAiB;AAE7B,QAAA,OAAO,UAAU,GACrB;AACI,qBAAe,QAAQ,EAAK;AAE5B,YAAM,YAAY,CAAA;AAGlB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAClC;AACU,cAAA,OAAO,MAAM,CAAC;AAEpB,uBAAe,KAAK,QAAQ,EAAI,GAEhC,UAAU,KAAK,OAAO,SAAS,CAAC,GAChC,SAAS,OAAO,OAAO,KAAK,MAAM;AAAA,MACtC;AAGA,YAAM,YAAYA,KAAAA,MAAM,OAAO,QAAQ,WAAW,CAAC;AAEnD,UAAI,CAAC;AAED;AAGE,YAAA,UAAU,MAAM,SAAS;AAE/B,eAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AAE/B,gBAAA,KAAK,UAAU,CAAC,IAAI,OAAO,GACnC,QAAQ,KAAK,UAAU,IAAI,CAAC,IAAI,OAAO,GACvC,QAAQ,KAAK,UAAU,IAAI,CAAC,IAAI,OAAO;AAG3C,eAAS,IAAI,GAAG,IAAI,OAAO,QAAQ;AAEzB,cAAA,KAAK,OAAO,CAAC,CAAC;AAAA,IAE5B;AAAA,EACJ;AACJ;;"}

View File

@@ -0,0 +1,47 @@
import { utils } from "@pixi/core";
function fixOrientation(points, hole = !1) {
const m = points.length;
if (m < 6)
return;
let area = 0;
for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
const x2 = points[i], y2 = points[i + 1];
area += (x2 - x1) * (y2 + y1), x1 = x2, y1 = y2;
}
if (!hole && area > 0 || hole && area <= 0) {
const n = m / 2;
for (let i = n + n % 2; i < m; i += 2) {
const i1 = m - i - 2, i2 = m - i - 1, i3 = i, i4 = i + 1;
[points[i1], points[i3]] = [points[i3], points[i1]], [points[i2], points[i4]] = [points[i4], points[i2]];
}
}
}
const buildPoly = {
build(graphicsData) {
graphicsData.points = graphicsData.shape.points.slice();
},
triangulate(graphicsData, graphicsGeometry) {
let points = graphicsData.points;
const holes = graphicsData.holes, verts = graphicsGeometry.points, indices = graphicsGeometry.indices;
if (points.length >= 6) {
fixOrientation(points, !1);
const holeArray = [];
for (let i = 0; i < holes.length; i++) {
const hole = holes[i];
fixOrientation(hole.points, !0), holeArray.push(points.length / 2), points = points.concat(hole.points);
}
const triangles = utils.earcut(points, holeArray, 2);
if (!triangles)
return;
const vertPos = verts.length / 2;
for (let i = 0; i < triangles.length; i += 3)
indices.push(triangles[i] + vertPos), indices.push(triangles[i + 1] + vertPos), indices.push(triangles[i + 2] + vertPos);
for (let i = 0; i < points.length; i++)
verts.push(points[i]);
}
}
};
export {
buildPoly
};
//# sourceMappingURL=buildPoly.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildPoly.mjs","sources":["../../src/utils/buildPoly.ts"],"sourcesContent":["import { utils } from '@pixi/core';\n\nimport type { Polygon } from '@pixi/core';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\nfunction fixOrientation(points: number[], hole = false)\n{\n const m = points.length;\n\n if (m < 6)\n {\n return;\n }\n\n let area = 0;\n\n for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2)\n {\n const x2 = points[i];\n const y2 = points[i + 1];\n\n area += (x2 - x1) * (y2 + y1);\n\n x1 = x2;\n y1 = y2;\n }\n\n if ((!hole && area > 0) || (hole && area <= 0))\n {\n const n = m / 2;\n\n for (let i = n + (n % 2); i < m; i += 2)\n {\n const i1 = m - i - 2;\n const i2 = m - i - 1;\n const i3 = i;\n const i4 = i + 1;\n\n [points[i1], points[i3]] = [points[i3], points[i1]];\n [points[i2], points[i4]] = [points[i4], points[i2]];\n }\n }\n}\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n fixOrientation(points, false);\n\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n fixOrientation(hole.points, true);\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = utils.earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n"],"names":[],"mappings":";AAKA,SAAS,eAAe,QAAkB,OAAO,IACjD;AACI,QAAM,IAAI,OAAO;AAEjB,MAAI,IAAI;AAEJ;AAGJ,MAAI,OAAO;AAEX,WAAS,IAAI,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GACpE;AACI,UAAM,KAAK,OAAO,CAAC,GACb,KAAK,OAAO,IAAI,CAAC;AAEvB,aAAS,KAAK,OAAO,KAAK,KAE1B,KAAK,IACL,KAAK;AAAA,EACT;AAEA,MAAK,CAAC,QAAQ,OAAO,KAAO,QAAQ,QAAQ,GAC5C;AACI,UAAM,IAAI,IAAI;AAEd,aAAS,IAAI,IAAK,IAAI,GAAI,IAAI,GAAG,KAAK,GACtC;AACU,YAAA,KAAK,IAAI,IAAI,GACb,KAAK,IAAI,IAAI,GACb,KAAK,GACL,KAAK,IAAI;AAEf,OAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,GAClD,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;AAAA,IACtD;AAAA,EACJ;AACJ;AAWO,MAAM,YAAgC;AAAA,EAEzC,MAAM,cACN;AACI,iBAAa,SAAU,aAAa,MAAkB,OAAO,MAAM;AAAA,EACvE;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACI,QAAI,SAAS,aAAa;AAC1B,UAAM,QAAQ,aAAa,OACrB,QAAQ,iBAAiB,QACzB,UAAU,iBAAiB;AAE7B,QAAA,OAAO,UAAU,GACrB;AACI,qBAAe,QAAQ,EAAK;AAE5B,YAAM,YAAY,CAAA;AAGlB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAClC;AACU,cAAA,OAAO,MAAM,CAAC;AAEpB,uBAAe,KAAK,QAAQ,EAAI,GAEhC,UAAU,KAAK,OAAO,SAAS,CAAC,GAChC,SAAS,OAAO,OAAO,KAAK,MAAM;AAAA,MACtC;AAGA,YAAM,YAAY,MAAM,OAAO,QAAQ,WAAW,CAAC;AAEnD,UAAI,CAAC;AAED;AAGE,YAAA,UAAU,MAAM,SAAS;AAE/B,eAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AAE/B,gBAAA,KAAK,UAAU,CAAC,IAAI,OAAO,GACnC,QAAQ,KAAK,UAAU,IAAI,CAAC,IAAI,OAAO,GACvC,QAAQ,KAAK,UAAU,IAAI,CAAC,IAAI,OAAO;AAG3C,eAAS,IAAI,GAAG,IAAI,OAAO,QAAQ;AAEzB,cAAA,KAAK,OAAO,CAAC,CAAC;AAAA,IAE5B;AAAA,EACJ;AACJ;"}

View File

@@ -0,0 +1,41 @@
"use strict";
const buildRectangle = {
build(graphicsData) {
const rectData = graphicsData.shape, x = rectData.x, y = rectData.y, width = rectData.width, height = rectData.height, points = graphicsData.points;
points.length = 0, width >= 0 && height >= 0 && points.push(
x,
y,
x + width,
y,
x + width,
y + height,
x,
y + height
);
},
triangulate(graphicsData, graphicsGeometry) {
const points = graphicsData.points, verts = graphicsGeometry.points;
if (points.length === 0)
return;
const vertPos = verts.length / 2;
verts.push(
points[0],
points[1],
points[2],
points[3],
points[6],
points[7],
points[4],
points[5]
), graphicsGeometry.indices.push(
vertPos,
vertPos + 1,
vertPos + 2,
vertPos + 1,
vertPos + 2,
vertPos + 3
);
}
};
exports.buildRectangle = buildRectangle;
//# sourceMappingURL=buildRectangle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildRectangle.js","sources":["../../src/utils/buildRectangle.ts"],"sourcesContent":["import type { Rectangle } from '@pixi/core';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n if (!(width >= 0 && height >= 0))\n {\n return;\n }\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n if (points.length === 0)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n"],"names":[],"mappings":";AAaO,MAAM,iBAAqC;AAAA,EAE9C,MAAM,cACN;AAII,UAAM,WAAW,aAAa,OACxB,IAAI,SAAS,GACb,IAAI,SAAS,GACb,QAAQ,SAAS,OACjB,SAAS,SAAS,QAElB,SAAS,aAAa;AAE5B,WAAO,SAAS,GAEV,SAAS,KAAK,UAAU,KAK9B,OAAO;AAAA,MAAK;AAAA,MAAG;AAAA,MACX,IAAI;AAAA,MAAO;AAAA,MACX,IAAI;AAAA,MAAO,IAAI;AAAA,MACf;AAAA,MAAG,IAAI;AAAA,IAAA;AAAA,EACf;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACI,UAAM,SAAS,aAAa,QACtB,QAAQ,iBAAiB;AAE/B,QAAI,OAAO,WAAW;AAElB;AAGE,UAAA,UAAU,MAAM,SAAS;AAEzB,UAAA;AAAA,MAAK,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MAC1B,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MACnB,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MACnB,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,IAAA,GAEvB,iBAAiB,QAAQ;AAAA,MAAK;AAAA,MAAS,UAAU;AAAA,MAAG,UAAU;AAAA,MAC1D,UAAU;AAAA,MAAG,UAAU;AAAA,MAAG,UAAU;AAAA,IAAA;AAAA,EAC5C;AACJ;;"}

View File

@@ -0,0 +1,42 @@
const buildRectangle = {
build(graphicsData) {
const rectData = graphicsData.shape, x = rectData.x, y = rectData.y, width = rectData.width, height = rectData.height, points = graphicsData.points;
points.length = 0, width >= 0 && height >= 0 && points.push(
x,
y,
x + width,
y,
x + width,
y + height,
x,
y + height
);
},
triangulate(graphicsData, graphicsGeometry) {
const points = graphicsData.points, verts = graphicsGeometry.points;
if (points.length === 0)
return;
const vertPos = verts.length / 2;
verts.push(
points[0],
points[1],
points[2],
points[3],
points[6],
points[7],
points[4],
points[5]
), graphicsGeometry.indices.push(
vertPos,
vertPos + 1,
vertPos + 2,
vertPos + 1,
vertPos + 2,
vertPos + 3
);
}
};
export {
buildRectangle
};
//# sourceMappingURL=buildRectangle.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildRectangle.mjs","sources":["../../src/utils/buildRectangle.ts"],"sourcesContent":["import type { Rectangle } from '@pixi/core';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n if (!(width >= 0 && height >= 0))\n {\n return;\n }\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n if (points.length === 0)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n"],"names":[],"mappings":"AAaO,MAAM,iBAAqC;AAAA,EAE9C,MAAM,cACN;AAII,UAAM,WAAW,aAAa,OACxB,IAAI,SAAS,GACb,IAAI,SAAS,GACb,QAAQ,SAAS,OACjB,SAAS,SAAS,QAElB,SAAS,aAAa;AAE5B,WAAO,SAAS,GAEV,SAAS,KAAK,UAAU,KAK9B,OAAO;AAAA,MAAK;AAAA,MAAG;AAAA,MACX,IAAI;AAAA,MAAO;AAAA,MACX,IAAI;AAAA,MAAO,IAAI;AAAA,MACf;AAAA,MAAG,IAAI;AAAA,IAAA;AAAA,EACf;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACI,UAAM,SAAS,aAAa,QACtB,QAAQ,iBAAiB;AAE/B,QAAI,OAAO,WAAW;AAElB;AAGE,UAAA,UAAU,MAAM,SAAS;AAEzB,UAAA;AAAA,MAAK,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MAC1B,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MACnB,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,MACnB,OAAO,CAAC;AAAA,MAAG,OAAO,CAAC;AAAA,IAAA,GAEvB,iBAAiB,QAAQ;AAAA,MAAK;AAAA,MAAS,UAAU;AAAA,MAAG,UAAU;AAAA,MAC1D,UAAU;AAAA,MAAG,UAAU;AAAA,MAAG,UAAU;AAAA,IAAA;AAAA,EAC5C;AACJ;"}

View File

@@ -0,0 +1,12 @@
"use strict";
var buildCircle = require("./buildCircle.js");
const buildRoundedRectangle = {
build(graphicsData) {
buildCircle.buildCircle.build(graphicsData);
},
triangulate(graphicsData, graphicsGeometry) {
buildCircle.buildCircle.triangulate(graphicsData, graphicsGeometry);
}
};
exports.buildRoundedRectangle = buildRoundedRectangle;
//# sourceMappingURL=buildRoundedRectangle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildRoundedRectangle.js","sources":["../../src/utils/buildRoundedRectangle.ts"],"sourcesContent":["// for type only\nimport { buildCircle } from './buildCircle';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n buildCircle.build(graphicsData);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n buildCircle.triangulate(graphicsData, graphicsGeometry);\n },\n};\n"],"names":["buildCircle"],"mappings":";;AAeO,MAAM,wBAA4C;AAAA,EAErD,MAAM,cACN;AACIA,4BAAY,MAAM,YAAY;AAAA,EAClC;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACgBA,gBAAAA,YAAA,YAAY,cAAc,gBAAgB;AAAA,EAC1D;AACJ;;"}

View File

@@ -0,0 +1,13 @@
import { buildCircle } from "./buildCircle.mjs";
const buildRoundedRectangle = {
build(graphicsData) {
buildCircle.build(graphicsData);
},
triangulate(graphicsData, graphicsGeometry) {
buildCircle.triangulate(graphicsData, graphicsGeometry);
}
};
export {
buildRoundedRectangle
};
//# sourceMappingURL=buildRoundedRectangle.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"buildRoundedRectangle.mjs","sources":["../../src/utils/buildRoundedRectangle.ts"],"sourcesContent":["// for type only\nimport { buildCircle } from './buildCircle';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n buildCircle.build(graphicsData);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n buildCircle.triangulate(graphicsData, graphicsGeometry);\n },\n};\n"],"names":[],"mappings":";AAeO,MAAM,wBAA4C;AAAA,EAErD,MAAM,cACN;AACI,gBAAY,MAAM,YAAY;AAAA,EAClC;AAAA,EAEA,YAAY,cAAc,kBAC1B;AACgB,gBAAA,YAAY,cAAc,gBAAgB;AAAA,EAC1D;AACJ;"}

View File

@@ -0,0 +1,22 @@
"use strict";
var core = require("@pixi/core"), buildCircle = require("./buildCircle.js"), buildPoly = require("./buildPoly.js"), buildRectangle = require("./buildRectangle.js"), buildRoundedRectangle = require("./buildRoundedRectangle.js"), ArcUtils = require("./ArcUtils.js"), BatchPart = require("./BatchPart.js"), BezierUtils = require("./BezierUtils.js"), buildLine = require("./buildLine.js"), QuadraticUtils = require("./QuadraticUtils.js");
const FILL_COMMANDS = {
[core.SHAPES.POLY]: buildPoly.buildPoly,
[core.SHAPES.CIRC]: buildCircle.buildCircle,
[core.SHAPES.ELIP]: buildCircle.buildCircle,
[core.SHAPES.RECT]: buildRectangle.buildRectangle,
[core.SHAPES.RREC]: buildRoundedRectangle.buildRoundedRectangle
}, BATCH_POOL = [], DRAW_CALL_POOL = [];
exports.buildCircle = buildCircle.buildCircle;
exports.buildPoly = buildPoly.buildPoly;
exports.buildRectangle = buildRectangle.buildRectangle;
exports.buildRoundedRectangle = buildRoundedRectangle.buildRoundedRectangle;
exports.ArcUtils = ArcUtils.ArcUtils;
exports.BatchPart = BatchPart.BatchPart;
exports.BezierUtils = BezierUtils.BezierUtils;
exports.buildLine = buildLine.buildLine;
exports.QuadraticUtils = QuadraticUtils.QuadraticUtils;
exports.BATCH_POOL = BATCH_POOL;
exports.DRAW_CALL_POOL = DRAW_CALL_POOL;
exports.FILL_COMMANDS = FILL_COMMANDS;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["/**\n * Generalized convenience utilities for Graphics.\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\n// for type only\nimport { SHAPES } from '@pixi/core';\nimport { buildCircle } from './buildCircle';\nimport { buildPoly } from './buildPoly';\nimport { buildRectangle } from './buildRectangle';\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\n\nimport type { BatchDrawCall } from '@pixi/core';\nimport type { BatchPart } from './BatchPart';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\nexport * from './ArcUtils';\nexport * from './BatchPart';\nexport * from './BezierUtils';\nexport * from './buildCircle';\nexport * from './buildLine';\nexport * from './buildPoly';\nexport * from './buildRectangle';\nexport * from './buildRoundedRectangle';\nexport * from './QuadraticUtils';\n\n/**\n * Map of fill commands for each shape type.\n * @memberof PIXI.graphicsUtils\n * @member {object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record<SHAPES, IShapeBuildCommand> = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n * @memberof PIXI.graphicsUtils\n * @member {Array<PIXI.graphicsUtils.BatchPart>} BATCH_POOL\n */\nexport const BATCH_POOL: Array<BatchPart> = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n * @memberof PIXI.graphicsUtils\n * @member {Array<PIXI.BatchDrawCall>} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array<BatchDrawCall> = [];\n"],"names":["SHAPES","buildPoly","buildCircle","buildRectangle","buildRoundedRectangle"],"mappings":";;AAgCO,MAAM,gBAAoD;AAAA,EAC7D,CAACA,KAAAA,OAAO,IAAI,GAAGC,UAAA;AAAA,EACf,CAACD,KAAAA,OAAO,IAAI,GAAGE,YAAA;AAAA,EACf,CAACF,KAAAA,OAAO,IAAI,GAAGE,YAAA;AAAA,EACf,CAACF,KAAAA,OAAO,IAAI,GAAGG,eAAA;AAAA,EACf,CAACH,KAAAA,OAAO,IAAI,GAAGI,sBAAA;AACnB,GAOa,aAA+B,IAO/B,iBAAuC,CAAA;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,32 @@
import { SHAPES } from "@pixi/core";
import { buildCircle } from "./buildCircle.mjs";
import { buildPoly } from "./buildPoly.mjs";
import { buildRectangle } from "./buildRectangle.mjs";
import { buildRoundedRectangle } from "./buildRoundedRectangle.mjs";
import { ArcUtils } from "./ArcUtils.mjs";
import { BatchPart } from "./BatchPart.mjs";
import { BezierUtils } from "./BezierUtils.mjs";
import { buildLine } from "./buildLine.mjs";
import { QuadraticUtils } from "./QuadraticUtils.mjs";
const FILL_COMMANDS = {
[SHAPES.POLY]: buildPoly,
[SHAPES.CIRC]: buildCircle,
[SHAPES.ELIP]: buildCircle,
[SHAPES.RECT]: buildRectangle,
[SHAPES.RREC]: buildRoundedRectangle
}, BATCH_POOL = [], DRAW_CALL_POOL = [];
export {
ArcUtils,
BATCH_POOL,
BatchPart,
BezierUtils,
DRAW_CALL_POOL,
FILL_COMMANDS,
QuadraticUtils,
buildCircle,
buildLine,
buildPoly,
buildRectangle,
buildRoundedRectangle
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../src/utils/index.ts"],"sourcesContent":["/**\n * Generalized convenience utilities for Graphics.\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\n// for type only\nimport { SHAPES } from '@pixi/core';\nimport { buildCircle } from './buildCircle';\nimport { buildPoly } from './buildPoly';\nimport { buildRectangle } from './buildRectangle';\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\n\nimport type { BatchDrawCall } from '@pixi/core';\nimport type { BatchPart } from './BatchPart';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\nexport * from './ArcUtils';\nexport * from './BatchPart';\nexport * from './BezierUtils';\nexport * from './buildCircle';\nexport * from './buildLine';\nexport * from './buildPoly';\nexport * from './buildRectangle';\nexport * from './buildRoundedRectangle';\nexport * from './QuadraticUtils';\n\n/**\n * Map of fill commands for each shape type.\n * @memberof PIXI.graphicsUtils\n * @member {object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record<SHAPES, IShapeBuildCommand> = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n * @memberof PIXI.graphicsUtils\n * @member {Array<PIXI.graphicsUtils.BatchPart>} BATCH_POOL\n */\nexport const BATCH_POOL: Array<BatchPart> = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n * @memberof PIXI.graphicsUtils\n * @member {Array<PIXI.BatchDrawCall>} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array<BatchDrawCall> = [];\n"],"names":[],"mappings":";;;;;;;;;;AAgCO,MAAM,gBAAoD;AAAA,EAC7D,CAAC,OAAO,IAAI,GAAG;AAAA,EACf,CAAC,OAAO,IAAI,GAAG;AAAA,EACf,CAAC,OAAO,IAAI,GAAG;AAAA,EACf,CAAC,OAAO,IAAI,GAAG;AAAA,EACf,CAAC,OAAO,IAAI,GAAG;AACnB,GAOa,aAA+B,IAO/B,iBAAuC,CAAA;"}

39
resources/app/node_modules/@pixi/graphics/package.json generated vendored Normal file
View File

@@ -0,0 +1,39 @@
{
"name": "@pixi/graphics",
"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": "Draw primitive shapes such as lines, circles and rectangles to the display",
"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",
"@pixi/display": "7.4.2",
"@pixi/sprite": "7.4.2"
}
}