231 lines
8.2 KiB
JavaScript
231 lines
8.2 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$Graphics = function(global, require, module, exports) {
|
|
var deprecation = require("module$node_modules$pixi_DOT_js$lib$utils$logging$deprecation");
|
|
global = require("module$node_modules$pixi_DOT_js$lib$scene$view$ViewContainer");
|
|
var GraphicsContext = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$GraphicsContext");
|
|
require("module$node_modules$pixi_DOT_js$lib$scene$graphics$init");
|
|
"use strict";
|
|
class Graphics extends global.ViewContainer {
|
|
constructor(options) {
|
|
options instanceof GraphicsContext.GraphicsContext && (options = {context:options});
|
|
const {context, roundPixels, ...rest} = options || {};
|
|
super({label:"Graphics", ...rest});
|
|
this.renderPipeId = "graphics";
|
|
context ? this.context = context : (this.context = this._ownedContext = new GraphicsContext.GraphicsContext(), this.context.autoGarbageCollect = this.autoGarbageCollect);
|
|
this.didViewUpdate = !0;
|
|
this.allowChildren = !1;
|
|
this.roundPixels = roundPixels ?? !1;
|
|
}
|
|
set context(context) {
|
|
context !== this._context && (this._context && (this._context.off("update", this.onViewUpdate, this), this._context.off("unload", this.unload, this)), this._context = context, this._context.on("update", this.onViewUpdate, this), this._context.on("unload", this.unload, this), this.onViewUpdate());
|
|
}
|
|
get context() {
|
|
return this._context;
|
|
}
|
|
get bounds() {
|
|
return this._context.bounds;
|
|
}
|
|
updateBounds() {
|
|
}
|
|
containsPoint(point) {
|
|
return this._context.containsPoint(point);
|
|
}
|
|
destroy(options) {
|
|
this._ownedContext && !options ? this._ownedContext.destroy(options) : (!0 === options || !0 === options?.context) && this._context.destroy(options);
|
|
this._context = this._ownedContext = null;
|
|
super.destroy(options);
|
|
}
|
|
_onTouch(now) {
|
|
this._gcLastUsed = now;
|
|
this._context._gcLastUsed = now;
|
|
}
|
|
_callContextMethod(method, args) {
|
|
this.context[method](...args);
|
|
return this;
|
|
}
|
|
setFillStyle(...args) {
|
|
return this._callContextMethod("setFillStyle", args);
|
|
}
|
|
setStrokeStyle(...args) {
|
|
return this._callContextMethod("setStrokeStyle", args);
|
|
}
|
|
fill(...args) {
|
|
return this._callContextMethod("fill", args);
|
|
}
|
|
stroke(...args) {
|
|
return this._callContextMethod("stroke", args);
|
|
}
|
|
texture(...args) {
|
|
return this._callContextMethod("texture", args);
|
|
}
|
|
beginPath() {
|
|
return this._callContextMethod("beginPath", []);
|
|
}
|
|
cut() {
|
|
return this._callContextMethod("cut", []);
|
|
}
|
|
arc(...args) {
|
|
return this._callContextMethod("arc", args);
|
|
}
|
|
arcTo(...args) {
|
|
return this._callContextMethod("arcTo", args);
|
|
}
|
|
arcToSvg(...args) {
|
|
return this._callContextMethod("arcToSvg", args);
|
|
}
|
|
bezierCurveTo(...args) {
|
|
return this._callContextMethod("bezierCurveTo", args);
|
|
}
|
|
closePath() {
|
|
return this._callContextMethod("closePath", []);
|
|
}
|
|
ellipse(...args) {
|
|
return this._callContextMethod("ellipse", args);
|
|
}
|
|
circle(...args) {
|
|
return this._callContextMethod("circle", args);
|
|
}
|
|
path(...args) {
|
|
return this._callContextMethod("path", args);
|
|
}
|
|
lineTo(...args) {
|
|
return this._callContextMethod("lineTo", args);
|
|
}
|
|
moveTo(...args) {
|
|
return this._callContextMethod("moveTo", args);
|
|
}
|
|
quadraticCurveTo(...args) {
|
|
return this._callContextMethod("quadraticCurveTo", args);
|
|
}
|
|
rect(...args) {
|
|
return this._callContextMethod("rect", args);
|
|
}
|
|
roundRect(...args) {
|
|
return this._callContextMethod("roundRect", args);
|
|
}
|
|
poly(...args) {
|
|
return this._callContextMethod("poly", args);
|
|
}
|
|
regularPoly(...args) {
|
|
return this._callContextMethod("regularPoly", args);
|
|
}
|
|
roundPoly(...args) {
|
|
return this._callContextMethod("roundPoly", args);
|
|
}
|
|
roundShape(...args) {
|
|
return this._callContextMethod("roundShape", args);
|
|
}
|
|
filletRect(...args) {
|
|
return this._callContextMethod("filletRect", args);
|
|
}
|
|
chamferRect(...args) {
|
|
return this._callContextMethod("chamferRect", args);
|
|
}
|
|
star(...args) {
|
|
return this._callContextMethod("star", args);
|
|
}
|
|
svg(...args) {
|
|
return this._callContextMethod("svg", args);
|
|
}
|
|
restore(...args) {
|
|
return this._callContextMethod("restore", args);
|
|
}
|
|
save() {
|
|
return this._callContextMethod("save", []);
|
|
}
|
|
getTransform() {
|
|
return this.context.getTransform();
|
|
}
|
|
resetTransform() {
|
|
return this._callContextMethod("resetTransform", []);
|
|
}
|
|
rotateTransform(...args) {
|
|
return this._callContextMethod("rotate", args);
|
|
}
|
|
scaleTransform(...args) {
|
|
return this._callContextMethod("scale", args);
|
|
}
|
|
setTransform(...args) {
|
|
return this._callContextMethod("setTransform", args);
|
|
}
|
|
transform(...args) {
|
|
return this._callContextMethod("transform", args);
|
|
}
|
|
translateTransform(...args) {
|
|
return this._callContextMethod("translate", args);
|
|
}
|
|
clear() {
|
|
return this._callContextMethod("clear", []);
|
|
}
|
|
get fillStyle() {
|
|
return this._context.fillStyle;
|
|
}
|
|
set fillStyle(value) {
|
|
this._context.fillStyle = value;
|
|
}
|
|
get strokeStyle() {
|
|
return this._context.strokeStyle;
|
|
}
|
|
set strokeStyle(value) {
|
|
this._context.strokeStyle = value;
|
|
}
|
|
clone(deep = !1) {
|
|
if (deep) {
|
|
return new Graphics(this._context.clone());
|
|
}
|
|
this._ownedContext = null;
|
|
return new Graphics(this._context);
|
|
}
|
|
lineStyle(width, color, alpha) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");
|
|
const strokeStyle = {};
|
|
width && (strokeStyle.width = width);
|
|
color && (strokeStyle.color = color);
|
|
alpha && (strokeStyle.alpha = alpha);
|
|
this.context.strokeStyle = strokeStyle;
|
|
return this;
|
|
}
|
|
beginFill(color, alpha) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");
|
|
const fillStyle = {};
|
|
void 0 !== color && (fillStyle.color = color);
|
|
void 0 !== alpha && (fillStyle.alpha = alpha);
|
|
this.context.fillStyle = fillStyle;
|
|
return this;
|
|
}
|
|
endFill() {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");
|
|
this.context.fill();
|
|
const strokeStyle = this.context.strokeStyle;
|
|
strokeStyle.width === GraphicsContext.GraphicsContext.defaultStrokeStyle.width && strokeStyle.color === GraphicsContext.GraphicsContext.defaultStrokeStyle.color && strokeStyle.alpha === GraphicsContext.GraphicsContext.defaultStrokeStyle.alpha || this.context.stroke();
|
|
return this;
|
|
}
|
|
drawCircle(...args) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#drawCircle has been renamed to Graphics#circle");
|
|
return this._callContextMethod("circle", args);
|
|
}
|
|
drawEllipse(...args) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#drawEllipse has been renamed to Graphics#ellipse");
|
|
return this._callContextMethod("ellipse", args);
|
|
}
|
|
drawPolygon(...args) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#drawPolygon has been renamed to Graphics#poly");
|
|
return this._callContextMethod("poly", args);
|
|
}
|
|
drawRect(...args) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#drawRect has been renamed to Graphics#rect");
|
|
return this._callContextMethod("rect", args);
|
|
}
|
|
drawRoundedRect(...args) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#drawRoundedRect has been renamed to Graphics#roundRect");
|
|
return this._callContextMethod("roundRect", args);
|
|
}
|
|
drawStar(...args) {
|
|
deprecation.deprecation(deprecation.v8_0_0, "Graphics#drawStar has been renamed to Graphics#star");
|
|
return this._callContextMethod("star", args);
|
|
}
|
|
}
|
|
exports.Graphics = Graphics;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$Graphics.js.map
|