three-spritetext
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
// Version 1.0.0 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
// Version 1.0.1 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : |
@@ -1,2 +0,2 @@ | ||
// Version 1.0.0 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
// Version 1.0.1 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.SpriteText=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};return function(i){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,THREE.Sprite);function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";t(this,o);var s=n(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,new THREE.SpriteMaterial({map:new THREE.Texture})));return s._text=e,s._textHeight=i,s._color=r,s._fontFace="Arial",s._fontSize=90,s._canvas=document.createElement("canvas"),s._texture=s.material.map,s._texture.minFilter=THREE.LinearFilter,s._genCanvas(),s}return e(o,[{key:"_genCanvas",value:function(){var t=this._canvas,e=t.getContext("2d"),n="normal "+this.fontSize+"px "+this.fontFace;e.font=n;var i=e.measureText(this.text).width;t.width=i,t.height=this.fontSize,e.font=n,e.fillStyle=this.color,e.textBaseline="bottom",e.fillText(this.text,0,t.height),this._texture.image=t,this._texture.needsUpdate=!0,this.scale.set(this.textHeight*t.width/t.height,this.textHeight)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(t){return THREE.Sprite.prototype.copy.call(this,t),this.color=t.color,this.fontFace=t.fontFace,this.fontSize=t.fontSize,this}},{key:"text",get:function(){return this._text},set:function(t){this._text=t,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(t){this._textHeight=t,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(t){this._fontFace=t,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize=t,this._genCanvas()}}]),o}()}); |
{ | ||
"name": "three-spritetext", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A sprite based text component for ThreeJS", | ||
@@ -5,0 +5,0 @@ "unpkg": "dist/three-spritetext.min.js", |
# three-spritetext | ||
[![NPM](https://nodei.co/npm/three-forcegraph.png?compact=true)](https://nodei.co/npm/three-forcegraph/) | ||
[![NPM](https://nodei.co/npm/three-spritetext.png?compact=true)](https://nodei.co/npm/three-spritetext/) | ||
@@ -5,0 +5,0 @@ A sprite based text component for [ThreeJS](https://threejs.org/). The text is drawn to canvas, converted into a [Texture](https://threejs.org/docs/#api/textures/Texture) and then used as a material on a [Sprite](https://threejs.org/docs/#api/objects/Sprite). |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
123174
0