shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$text_split$AbstractSplitText = function(global, require, module, exports) { global = require("module$node_modules$pixi_DOT_js$lib$scene$container$Container"); var TextStyle = require("module$node_modules$pixi_DOT_js$lib$scene$text$TextStyle"); "use strict"; class AbstractSplitText extends global.Container { constructor(config) { const {text, style, autoSplit, lineAnchor, wordAnchor, charAnchor, ...options} = config; super(options); this._canReuseChars = this._dirty = !1; this.chars = []; this.words = []; this.lines = []; this._originalText = text; this._autoSplit = autoSplit; this._lineAnchor = lineAnchor; this._wordAnchor = wordAnchor; this._charAnchor = charAnchor; this.style = style; } split() { const res = this.splitFn(); this.chars = res.chars; this.words = res.words; this.lines = res.lines; this.addChild(...this.lines); this.charAnchor = this._charAnchor; this.wordAnchor = this._wordAnchor; this.lineAnchor = this._lineAnchor; this._dirty = !1; this._canReuseChars = !0; } get text() { return this._originalText; } set text(value) { this._originalText = value; this.lines.forEach(line => line.destroy({children:!0})); this.lines.length = 0; this.words.length = 0; this.chars.length = 0; this._canReuseChars = !1; this.onTextUpdate(); } _setOrigin(value, elements, property) { var JSCompiler_object_inline_x_515; if ("number" === typeof value) { var JSCompiler_object_inline_y_516 = JSCompiler_object_inline_x_515 = value; } else { JSCompiler_object_inline_x_515 = value.x, JSCompiler_object_inline_y_516 = value.y; } elements.forEach(element => { const localBounds = element.getLocalBounds(); element.origin.set(localBounds.minX + localBounds.width * JSCompiler_object_inline_x_515, localBounds.minY + localBounds.height * JSCompiler_object_inline_y_516); }); this[property] = value; } get lineAnchor() { return this._lineAnchor; } set lineAnchor(value) { this._setOrigin(value, this.lines, "_lineAnchor"); } get wordAnchor() { return this._wordAnchor; } set wordAnchor(value) { this._setOrigin(value, this.words, "_wordAnchor"); } get charAnchor() { return this._charAnchor; } set charAnchor(value) { this._setOrigin(value, this.chars, "_charAnchor"); } get style() { return this._style; } set style(style) { style || (style = {}); this._style = new TextStyle.TextStyle(style); this.styleChanged(); } styleChanged() { this.words.forEach(word => word.destroy()); this.words.length = 0; this.lines.forEach(line => line.destroy()); this.lines.length = 0; this._canReuseChars = !0; this.onTextUpdate(); } onTextUpdate() { this._dirty = !0; this._autoSplit && this.split(); } destroy(options) { super.destroy(options); this.chars = []; this.words = []; this.lines = []; ("boolean" === typeof options ? options : options?.style) && this._style.destroy(options); this._style = null; this._originalText = ""; } } exports.AbstractSplitText = AbstractSplitText; }; //# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$text_split$AbstractSplitText.js.map