pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
34 lines (30 loc) • 1.21 kB
JavaScript
;
var TextureStyle = require('../../rendering/renderers/shared/texture/TextureStyle.js');
var AbstractText = require('../text/AbstractText.js');
var HTMLTextStyle = require('./HTMLTextStyle.js');
var measureHtmlText = require('./utils/measureHtmlText.js');
;
class HTMLText extends AbstractText.AbstractText {
constructor(...args) {
const options = AbstractText.ensureTextOptions(args, "HtmlText");
super(options, HTMLTextStyle.HTMLTextStyle);
/** @internal */
this.renderPipeId = "htmlText";
if (options.textureStyle) {
this.textureStyle = options.textureStyle instanceof TextureStyle.TextureStyle ? options.textureStyle : new TextureStyle.TextureStyle(options.textureStyle);
}
}
/** @private */
updateBounds() {
const bounds = this._bounds;
const anchor = this._anchor;
const htmlMeasurement = measureHtmlText.measureHtmlText(this.text, this._style);
const { width, height } = htmlMeasurement;
bounds.minX = -anchor._x * width;
bounds.maxX = bounds.minX + width;
bounds.minY = -anchor._y * height;
bounds.maxY = bounds.minY + height;
}
}
exports.HTMLText = HTMLText;
//# sourceMappingURL=HTMLText.js.map