three-spritetext
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,2 @@ | ||
// Version 1.0.1 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
// Version 1.0.2 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.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}()}); | ||
// Version 1.0.2 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 r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function i(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(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}}(),s=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(t){function o(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";r(this,o);var i=s(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,new THREE.SpriteMaterial({map:new THREE.Texture})));return i._text=t,i._textHeight=e,i._color=n,i._fontFace="Arial",i._fontSize=90,i._canvas=document.createElement("canvas"),i._texture=i.material.map,i._texture.minFilter=THREE.LinearFilter,i._genCanvas(),i}return 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),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.1", | ||
"version": "1.0.2", | ||
"description": "A sprite based text component for ThreeJS", | ||
@@ -46,9 +46,9 @@ "unpkg": "dist/three-spritetext.min.js", | ||
"babel-preset-env": "^1.6.1", | ||
"rollup": "^0.56.2", | ||
"rollup": "^0.57.0", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-commonjs": "^8.3.0", | ||
"rollup-plugin-node-resolve": "^3.0.3", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"rollup-plugin-node-resolve": "^3.2.0", | ||
"rollup-watch": "^4.3.1", | ||
"uglify-js": "3.3.4" | ||
"uglify-js": "^3.3.15" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
126741