three-spritetext
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -119,3 +119,3 @@ 'use strict'; | ||
}))); | ||
_this._text = text; | ||
_this._text = "".concat(text); | ||
_this._textHeight = textHeight; | ||
@@ -122,0 +122,0 @@ _this._color = color; |
@@ -1,2 +0,2 @@ | ||
// Version 1.2.1 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
// Version 1.2.2 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
(function (global, factory) { | ||
@@ -122,3 +122,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) : | ||
}))); | ||
_this._text = text; | ||
_this._text = "".concat(text); | ||
_this._textHeight = textHeight; | ||
@@ -125,0 +125,0 @@ _this._color = color; |
@@ -1,2 +0,2 @@ | ||
// Version 1.2.1 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("three")):"function"==typeof define&&define.amd?define(["three"],e):(t=t||self).SpriteText=e(t.THREE)}(this,(function(t){"use strict";function e(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)}}function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var a=window.THREE?window.THREE:{LinearFilter:t.LinearFilter,Sprite:t.Sprite,SpriteMaterial:t.SpriteMaterial,Texture:t.Texture};return function(t){function c(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=r(this,n(c).call(this,new a.SpriteMaterial({map:new a.Texture}))))._text=e,t._textHeight=i,t._color=o,t._fontFace="Arial",t._fontSize=90,t._fontWeight="normal",t._canvas=document.createElement("canvas"),t._texture=t.material.map,t._texture.minFilter=a.LinearFilter,t._genCanvas(),t}var f,s,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(c,t),f=c,(s=[{key:"_genCanvas",value:function(){var t=this,e=this._canvas,n=e.getContext("2d"),i=this._text.split("\n"),r="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);n.font=r,e.width=Math.max.apply(Math,o(i.map((function(t){return n.measureText(t).width})))),e.height=this.fontSize*i.length,n.font=r,n.fillStyle=this.color,n.textBaseline="bottom",i.forEach((function(i,r){return n.fillText(i,(e.width-n.measureText(i).width)/2,(r+1)*t.fontSize)})),this._texture.image=e,this._texture.needsUpdate=!0;var a=this.textHeight*i.length;this.scale.set(a*e.width/e.height,a)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(t){return a.Sprite.prototype.copy.call(this,t),this.color=t.color,this.fontFace=t.fontFace,this.fontSize=t.fontSize,this.fontWeight=t.fontWeight,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()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(t){this._fontWeight=t,this._genCanvas()}}])&&e(f.prototype,s),u&&e(f,u),c}(a.Sprite)})); | ||
// Version 1.2.2 three-spritetext - https://github.com/vasturiano/three-spritetext | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("three")):"function"==typeof define&&define.amd?define(["three"],e):(t=t||self).SpriteText=e(t.THREE)}(this,(function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var c=window.THREE?window.THREE:{LinearFilter:t.LinearFilter,Sprite:t.Sprite,SpriteMaterial:t.SpriteMaterial,Texture:t.Texture};return function(t){function f(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";return e(this,f),(t=o(this,i(f).call(this,new c.SpriteMaterial({map:new c.Texture}))))._text="".concat(n),t._textHeight=r,t._color=a,t._fontFace="Arial",t._fontSize=90,t._fontWeight="normal",t._canvas=document.createElement("canvas"),t._texture=t.material.map,t._texture.minFilter=c.LinearFilter,t._genCanvas(),t}var s,u,h;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}(f,t),s=f,(u=[{key:"_genCanvas",value:function(){var t=this,e=this._canvas,n=e.getContext("2d"),i=this._text.split("\n"),r="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);n.font=r,e.width=Math.max.apply(Math,a(i.map((function(t){return n.measureText(t).width})))),e.height=this.fontSize*i.length,n.font=r,n.fillStyle=this.color,n.textBaseline="bottom",i.forEach((function(i,r){return n.fillText(i,(e.width-n.measureText(i).width)/2,(r+1)*t.fontSize)})),this._texture.image=e,this._texture.needsUpdate=!0;var o=this.textHeight*i.length;this.scale.set(o*e.width/e.height,o)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(t){return c.Sprite.prototype.copy.call(this,t),this.color=t.color,this.fontFace=t.fontFace,this.fontSize=t.fontSize,this.fontWeight=t.fontWeight,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()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(t){this._fontWeight=t,this._genCanvas()}}])&&n(s.prototype,u),h&&n(s,h),f}(c.Sprite)})); |
@@ -117,3 +117,3 @@ import { LinearFilter, Sprite, SpriteMaterial, Texture } from 'three'; | ||
}))); | ||
_this._text = text; | ||
_this._text = "".concat(text); | ||
_this._textHeight = textHeight; | ||
@@ -120,0 +120,0 @@ _this._color = color; |
{ | ||
"name": "three-spritetext", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A sprite based text component for ThreeJS", | ||
@@ -45,13 +45,13 @@ "unpkg": "dist/three-spritetext.min.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.7.2", | ||
"@babel/plugin-proposal-class-properties": "^7.7.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2", | ||
"@babel/preset-env": "^7.7.1", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.27.0", | ||
"@babel/core": "^7.8.4", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.8.3", | ||
"@babel/preset-env": "^7.8.4", | ||
"rimraf": "^3.0.1", | ||
"rollup": "^1.31.0", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"terser": "^4.4.0" | ||
"terser": "^4.6.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37805