UNPKG

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">

32 lines (29 loc) 1.13 kB
import { TextureStyle } from '../../rendering/renderers/shared/texture/TextureStyle.mjs'; import { AbstractText, ensureTextOptions } from '../text/AbstractText.mjs'; import { HTMLTextStyle } from './HTMLTextStyle.mjs'; import { measureHtmlText } from './utils/measureHtmlText.mjs'; "use strict"; class HTMLText extends AbstractText { constructor(...args) { const options = ensureTextOptions(args, "HtmlText"); super(options, HTMLTextStyle); /** @internal */ this.renderPipeId = "htmlText"; if (options.textureStyle) { this.textureStyle = options.textureStyle instanceof TextureStyle ? options.textureStyle : new TextureStyle(options.textureStyle); } } /** @private */ updateBounds() { const bounds = this._bounds; const anchor = this._anchor; const htmlMeasurement = 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; } } export { HTMLText }; //# sourceMappingURL=HTMLText.mjs.map