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">
41 lines (37 loc) • 1.35 kB
JavaScript
'use strict';
var adapter = require('../../environment/adapter.js');
"use strict";
const nssvg = "http://www.w3.org/2000/svg";
const nsxhtml = "http://www.w3.org/1999/xhtml";
class HTMLTextRenderData {
constructor() {
this.svgRoot = document.createElementNS(nssvg, "svg");
this.foreignObject = document.createElementNS(nssvg, "foreignObject");
this.domElement = document.createElementNS(nsxhtml, "div");
this.styleElement = document.createElementNS(nsxhtml, "style");
const { foreignObject, svgRoot, styleElement, domElement } = this;
foreignObject.setAttribute("width", "10000");
foreignObject.setAttribute("height", "10000");
foreignObject.style.overflow = "hidden";
svgRoot.appendChild(foreignObject);
foreignObject.appendChild(styleElement);
foreignObject.appendChild(domElement);
this.image = adapter.DOMAdapter.get().createImage();
}
destroy() {
this.svgRoot.remove();
this.foreignObject.remove();
this.styleElement.remove();
this.domElement.remove();
this.image.src = "";
this.image.remove();
this.svgRoot = null;
this.foreignObject = null;
this.styleElement = null;
this.domElement = null;
this.image = null;
this.canvasAndContext = null;
}
}
exports.HTMLTextRenderData = HTMLTextRenderData;
//# sourceMappingURL=HTMLTextRenderData.js.map