{"version":3,"file":"three-spritetext.js","sources":["../src/index.js"],"sourcesContent":["import {\n LinearFilter,\n Sprite,\n SpriteMaterial,\n Texture\n} from 'three';\n\nconst three = typeof window !== 'undefined' && window.THREE\n ? window.THREE // Prefer consumption from global THREE, if exists\n : {\n LinearFilter,\n Sprite,\n SpriteMaterial,\n Texture\n};\n\nexport default class extends three.Sprite {\n constructor(text = '', textHeight = 10, color = 'rgba(255, 255, 255, 1)') {\n super(new three.SpriteMaterial({ map: new three.Texture() }));\n\n this._text = `${text}`;\n this._textHeight = textHeight;\n this._color = color;\n this._backgroundColor = false; // no background color\n\n this._padding = 0;\n this._borderWidth = 0;\n this._borderRadius = 0;\n this._borderColor = 'white';\n\n this._strokeWidth = 0;\n this._strokeColor = 'white';\n\n this._fontFace = 'Arial';\n this._fontSize = 90; // defines text resolution\n this._fontWeight = 'normal';\n\n this._canvas = document.createElement('canvas');\n this._texture = this.material.map;\n this._texture.minFilter = three.LinearFilter;\n\n this._genCanvas();\n }\n\n get text() { return this._text; }\n set text(text) { this._text = text; this._genCanvas(); }\n get textHeight() { return this._textHeight; }\n set textHeight(textHeight) { this._textHeight = textHeight; this._genCanvas(); }\n get color() { return this._color; }\n set color(color) { this._color = color; this._genCanvas(); }\n get backgroundColor() { return this._backgroundColor; }\n set backgroundColor(color) { this._backgroundColor = color; this._genCanvas(); }\n get padding() { return this._padding; }\n set padding(padding) { this._padding = padding; this._genCanvas(); }\n get borderWidth() { return this._borderWidth; }\n set borderWidth(borderWidth) { this._borderWidth = borderWidth; this._genCanvas(); }\n get borderRadius() { return this._borderRadius; }\n set borderRadius(borderRadius) { this._borderRadius = borderRadius; this._genCanvas(); }\n get borderColor() { return this._borderColor; }\n set borderColor(borderColor) { this._borderColor = borderColor; this._genCanvas(); }\n get fontFace() { return this._fontFace; }\n set fontFace(fontFace) { this._fontFace = fontFace; this._genCanvas(); }\n get fontSize() { return this._fontSize; }\n set fontSize(fontSize) { this._fontSize = fontSize; this._genCanvas(); }\n get fontWeight() { return this._fontWeight; }\n set fontWeight(fontWeight) { this._fontWeight = fontWeight; this._genCanvas(); }\n get strokeWidth() { return this._strokeWidth; }\n set strokeWidth(strokeWidth) { this._strokeWidth = strokeWidth; this._genCanvas(); }\n get strokeColor() { return this._strokeColor; }\n set strokeColor(strokeColor) { this._strokeColor = strokeColor; this._genCanvas(); }\n\n _genCanvas() {\n const canvas = this._canvas;\n const ctx = canvas.getContext('2d');\n\n const border = Array.isArray(this.borderWidth) ? this.borderWidth : [this.borderWidth, this.borderWidth]; // x,y border\n const relBorder = border.map(b => b * this.fontSize * 0.1); // border in canvas units\n\n const borderRadius = Array.isArray(this.borderRadius) ? this.borderRadius : [this.borderRadius, this.borderRadius, this.borderRadius, this.borderRadius]; // tl tr br bl corners\n const relBorderRadius = borderRadius.map(b => b * this.fontSize * 0.1); // border radius in canvas units\n\n const padding = Array.isArray(this.padding) ? this.padding : [this.padding, this.padding]; // x,y padding\n const relPadding = padding.map(p => p * this.fontSize * 0.1); // padding in canvas units\n\n const lines = this.text.split('\\n');\n const font = `${this.fontWeight} ${this.fontSize}px ${this.fontFace}`;\n\n ctx.font = font; // measure canvas with appropriate font\n const innerWidth = Math.max(...lines.map(line => ctx.measureText(line).width));\n const innerHeight = this.fontSize * lines.length;\n canvas.width = innerWidth + relBorder[0] * 2 + relPadding[0] * 2;\n canvas.height = innerHeight + relBorder[1] * 2 + relPadding[1] * 2;\n\n // paint border\n if (this.borderWidth) {\n ctx.strokeStyle = this.borderColor;\n\n if (relBorder[0]) { // left + right borders\n const hb = relBorder[0] / 2;\n ctx.lineWidth = relBorder[0];\n ctx.beginPath();\n ctx.moveTo(hb, relBorderRadius[0]);\n ctx.lineTo(hb, canvas.height - relBorderRadius[3]);\n ctx.moveTo(canvas.width - hb, relBorderRadius[1]);\n ctx.lineTo(canvas.width - hb, canvas.height - relBorderRadius[2]);\n ctx.stroke();\n }\n\n if (relBorder[1]) { // top + bottom borders\n const hb = relBorder[1] / 2;\n ctx.lineWidth = relBorder[1];\n ctx.beginPath();\n ctx.moveTo(Math.max(relBorder[0], relBorderRadius[0]), hb);\n ctx.lineTo(canvas.width - Math.max(relBorder[0], relBorderRadius[1]), hb);\n ctx.moveTo(Math.max(relBorder[0], relBorderRadius[3]), canvas.height - hb);\n ctx.lineTo(canvas.width - Math.max(relBorder[0], relBorderRadius[2]), canvas.height - hb);\n ctx.stroke();\n }\n\n if (this.borderRadius) { // strike rounded corners\n const cornerWidth = Math.max(...relBorder);\n const hb = cornerWidth / 2;\n ctx.lineWidth = cornerWidth;\n ctx.beginPath();\n [\n !!relBorderRadius[0] && [relBorderRadius[0], hb, hb, relBorderRadius[0]],\n !!relBorderRadius[1] && [canvas.width - relBorderRadius[1], canvas.width - hb, hb, relBorderRadius[1]],\n !!relBorderRadius[2] && [canvas.width - relBorderRadius[2], canvas.width - hb, canvas.height - hb, canvas.height - relBorderRadius[2]],\n !!relBorderRadius[3] && [relBorderRadius[3], hb, canvas.height - hb, canvas.height - relBorderRadius[3]]\n ].filter(d => d).forEach(([x0, x1, y0, y1]) => {\n ctx.moveTo(x0, y0);\n ctx.quadraticCurveTo(x1, y0, x1, y1);\n });\n ctx.stroke();\n }\n }\n\n // paint background\n if (this.backgroundColor) {\n ctx.fillStyle = this.backgroundColor;\n if (!this.borderRadius) {\n ctx.fillRect(relBorder[0], relBorder[1], canvas.width - relBorder[0] * 2, canvas.height - relBorder[1] * 2);\n } else { // fill with rounded corners\n ctx.beginPath();\n ctx.moveTo(relBorder[0], relBorderRadius[0]);\n [\n [relBorder[0], relBorderRadius[0], canvas.width - relBorderRadius[1], relBorder[1], relBorder[1], relBorder[1]], // t\n [canvas.width - relBorder[0], canvas.width - relBorder[0], canvas.width - relBorder[0], relBorder[1], relBorderRadius[1], canvas.height - relBorderRadius[2]], // r\n [canvas.width - relBorder[0], canvas.width - relBorderRadius[2], relBorderRadius[3], canvas.height - relBorder[1], canvas.height - relBorder[1], canvas.height - relBorder[1]], // b\n [relBorder[0], relBorder[0], relBorder[0], canvas.height - relBorder[1], canvas.height - relBorderRadius[3], relBorderRadius[0]], // t\n ].forEach(([x0, x1, x2, y0, y1, y2]) => {\n ctx.quadraticCurveTo(x0, y0, x1, y1);\n ctx.lineTo(x2, y2);\n });\n ctx.closePath();\n ctx.fill();\n }\n }\n\n ctx.translate(...relBorder);\n ctx.translate(...relPadding);\n\n // paint text\n ctx.font = font; // Set font again after canvas is resized, as context properties are reset\n ctx.fillStyle = this.color;\n ctx.textBaseline = 'bottom';\n\n const drawTextStroke = this.strokeWidth > 0;\n if (drawTextStroke) {\n ctx.lineWidth = this.strokeWidth * this.fontSize / 10;\n ctx.strokeStyle = this.strokeColor;\n }\n\n lines.forEach((line, index) => {\n const lineX = (innerWidth - ctx.measureText(line).width) / 2;\n const lineY = (index + 1) * this.fontSize;\n\n drawTextStroke && ctx.strokeText(line, lineX, lineY);\n ctx.fillText(line, lineX, lineY);\n });\n\n // Inject canvas into sprite\n this._texture.image = canvas;\n this._texture.needsUpdate = true;\n\n const yScale = this.textHeight * lines.length + border[1] * 2 + padding[1] * 2;\n this.scale.set(yScale * canvas.width / canvas.height, yScale, 0);\n }\n\n clone() {\n return new this.constructor(this.text, this.textHeight, this.color).copy(this);\n }\n\n copy(source) {\n three.Sprite.prototype.copy.call(this, source);\n\n this.color = source.color;\n this.backgroundColor = source.backgroundColor;\n this.padding = source.padding;\n this.borderWidth = source.borderWidth;\n this.borderColor = source.borderColor;\n this.fontFace = source.fontFace;\n this.fontSize = source.fontSize;\n this.fontWeight = source.fontWeight;\n this.strokeWidth = source.strokeWidth;\n this.strokeColor = source.strokeColor;\n\n return this;\n }\n}\n"],"names":["three","window","THREE","LinearFilter","Sprite","SpriteMaterial","Texture","text","textHeight","color","map","_text","_textHeight","_color","_backgroundColor","_padding","_borderWidth","_borderRadius","_borderColor","_strokeWidth","_strokeColor","_fontFace","_fontSize","_fontWeight","_canvas","document","createElement","_texture","material","minFilter","_genCanvas","padding","borderWidth","borderRadius","borderColor","fontFace","fontSize","fontWeight","strokeWidth","strokeColor","canvas","ctx","getContext","border","Array","isArray","relBorder","b","relBorderRadius","relPadding","p","lines","split","font","innerWidth","Math","max","line","measureText","width","innerHeight","length","height","strokeStyle","hb","lineWidth","beginPath","moveTo","lineTo","stroke","cornerWidth","filter","d","forEach","x0","x1","y0","y1","quadraticCurveTo","backgroundColor","fillStyle","fillRect","x2","y2","closePath","fill","translate","textBaseline","drawTextStroke","index","lineX","lineY","strokeText","fillText","image","needsUpdate","yScale","scale","set","constructor","copy","source","prototype","call"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOA,IAAMA,KAAK,GAAG,OAAOC,MAAP,KAAkB,WAAlB,IAAiCA,MAAM,CAACC,KAAxC,GACVD,MAAM,CAACC,KADG;EAAA,EAEV;EACFC,EAAAA,YAAY,EAAZA,oBADE;EAEFC,EAAAA,MAAM,EAANA,cAFE;EAGFC,EAAAA,cAAc,EAAdA,sBAHE;EAIFC,EAAAA,OAAO,EAAPA;EAJE,CAFJ;;;;;;;EAUE,sBAA0E;EAAA;;EAAA,QAA9DC,IAA8D,uEAAvD,EAAuD;EAAA,QAAnDC,UAAmD,uEAAtC,EAAsC;EAAA,QAAlCC,KAAkC,uEAA1B,wBAA0B;;EAAA;;EACxE,8BAAM,IAAIT,KAAK,CAACK,cAAV,CAAyB;EAAEK,MAAAA,GAAG,EAAE,IAAIV,KAAK,CAACM,OAAV;EAAP,KAAzB,CAAN;EAEA,UAAKK,KAAL,aAAgBJ,IAAhB;EACA,UAAKK,WAAL,GAAmBJ,UAAnB;EACA,UAAKK,MAAL,GAAcJ,KAAd;EACA,UAAKK,gBAAL,GAAwB,KAAxB,CANwE;;EAQ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