49 lines
2.0 KiB
JavaScript
49 lines
2.0 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$fill$FillPattern = function(global, require, module, exports) {
|
|
var Matrix = require("module$node_modules$pixi_DOT_js$lib$maths$matrix$Matrix"), uid = require("module$node_modules$pixi_DOT_js$lib$utils$data$uid");
|
|
"use strict";
|
|
const repetitionMap = {repeat:{addressModeU:"repeat", addressModeV:"repeat"}, "repeat-x":{addressModeU:"repeat", addressModeV:"clamp-to-edge"}, "repeat-y":{addressModeU:"clamp-to-edge", addressModeV:"repeat"}, "no-repeat":{addressModeU:"clamp-to-edge", addressModeV:"clamp-to-edge"}};
|
|
class FillPattern {
|
|
constructor(textureOrOptions, repetition) {
|
|
this.uid = uid.uid("fillPattern");
|
|
this._tick = 0;
|
|
this.transform = new Matrix.Matrix();
|
|
textureOrOptions = void 0 !== textureOrOptions.texture ? textureOrOptions : {texture:textureOrOptions, repetition};
|
|
this.texture = textureOrOptions.texture;
|
|
this.textureSpace = textureOrOptions.textureSpace ?? "global";
|
|
if (textureOrOptions = textureOrOptions.repetition) {
|
|
this.texture.source.style.addressModeU = repetitionMap[textureOrOptions].addressModeU, this.texture.source.style.addressModeV = repetitionMap[textureOrOptions].addressModeV;
|
|
}
|
|
}
|
|
setTransform(transform) {
|
|
if (transform) {
|
|
if (this.transform.equals(transform)) {
|
|
return;
|
|
}
|
|
this.transform.copyFrom(transform);
|
|
} else {
|
|
if (this.transform.isIdentity()) {
|
|
return;
|
|
}
|
|
this.transform.identity();
|
|
}
|
|
this._tick++;
|
|
}
|
|
get texture() {
|
|
return this._texture;
|
|
}
|
|
set texture(value) {
|
|
this._texture !== value && (this._texture = value, this._tick++);
|
|
}
|
|
get styleKey() {
|
|
return `fill-pattern-${this.uid}-${this._tick}`;
|
|
}
|
|
destroy() {
|
|
this.texture.destroy(!0);
|
|
this.texture = null;
|
|
}
|
|
}
|
|
exports.FillPattern = FillPattern;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$fill$FillPattern.js.map
|