Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

three.textsprite

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three.textsprite - npm Package Compare versions

Comparing version 18.1.16 to 18.3.3

13

package.json
{
"name": "three.textsprite",
"version": "18.1.16",
"version": "18.3.3",
"description": "Automatically computes the optimal font size depending on the distance to the camera and the size of the renderer canvas.",

@@ -37,11 +37,10 @@ "main": "THREE.TextSprite.js",

"dependencies": {
"three": "^0.89.0",
"three.texttexture": "^18.1.14"
"three": "^0.90.0",
"three.texttexture": "^18.3.3"
},
"devDependencies": {
"eslint": "^4.15.0",
"rollup": "^0.54.0",
"rollup-plugin-buble": "^0.18.0",
"rollup-plugin-uglify": "^2.0.1"
"rollup": "^0.56.3",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-uglify": "^3.0.0"
}
}

@@ -32,10 +32,2 @@ # THREE.TextSprite

---
Include [polyfills](https://polyfill.io/) to support older browsers.
```html
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
```
## members

@@ -42,0 +34,0 @@

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("three"),require("three.texttexture")):"function"==typeof define&&define.amd?define(["three","three.texttexture"],e):e(t.THREE)}(this,function(t){"use strict";var e=function(t,e,i){this.redraw(t,i)};(t=t&&t.hasOwnProperty("default")?t.default:t).TextSprite=function(i){function r(r){void 0===r&&(r={});var a=r.textSize;void 0===a&&(a=1);var o=r.redrawInterval;void 0===o&&(o=1);var n=r.maxFontSize;void 0===n&&(n=1/0);var s=r.material;void 0===s&&(s={});var p=r.texture;void 0===p&&(p={}),i.call(this,new t.SpriteMaterial(Object.assign({},s,{map:new t.TextTexture(p)}))),this.textSize=a,this.redrawInterval=o,this.maxFontSize=n,this.lastRedraw=0,this._renderMesh=new t.Mesh,this._renderMesh.onBeforeRender=e.bind(this),this.add(this._renderMesh)}i&&(r.__proto__=i),r.prototype=Object.create(i&&i.prototype),r.prototype.constructor=r;var a={isTextSprite:{configurable:!0}};return a.isTextSprite.get=function(){return!0},r.prototype.updateScale=function(){this.scale.set(this.material.map.aspect,1,1).multiplyScalar(this.textSize*this.material.map.paddingBoxHeight)},r.prototype.updateMatrix=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return this.updateScale(),i.prototype.updateMatrix.apply(this,t)},r.prototype.computeOptimalFontSize=function(t,e){if(t.domElement.width&&t.domElement.height&&this.material.map.linesCount){var i=this.getWorldPosition().distanceTo(e.getWorldPosition());if(i){var r=this.getWorldScale().y*t.domElement.height/i;if(r)return Math.round(r/this.material.map.paddingBoxHeight)}}return 0},r.prototype.redraw=function(t,e){var i=this;this.lastRedraw+this.redrawInterval<Date.now()&&(this.redrawInterval?setTimeout(function(){i.redrawNow(t,e)},1):this.redrawNow(t,e))},r.prototype.redrawNow=function(e,i){this.updateScale();var r=this.computeOptimalFontSize(e,i);r=t.Math.ceilPowerOfTwo(r),r=Math.min(r,this.maxFontSize),this.material.map.fontSize=r,this.material.map.autoRedraw||this.material.map.redraw(),this.lastRedraw=Date.now()},r.prototype.dispose=function(){this.material.map.dispose(),this.material.dispose()},Object.defineProperties(r.prototype,a),r}(t.Sprite)});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("three"),require("three.texttexture")):"function"==typeof define&&define.amd?define(["three","three.texttexture"],e):e(t.THREE)}(this,function(t){"use strict";(t=t&&t.hasOwnProperty("default")?t.default:t).TextSprite=function(e){function i(i){void 0===i&&(i={});var r=i.textSize;void 0===r&&(r=1);var a=i.redrawInterval;void 0===a&&(a=1);var o=i.maxFontSize;void 0===o&&(o=1/0);var n=i.material;void 0===n&&(n={});var p=i.texture;void 0===p&&(p={}),e.call(this,new t.SpriteMaterial(Object.assign({},n,{map:new t.TextTexture(p)}))),this.textSize=r,this.redrawInterval=a,this.maxFontSize=o,this.lastRedraw=0}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var r={isTextSprite:{configurable:!0}};return r.isTextSprite.get=function(){return!0},i.prototype.onBeforeRender=function(t,e,i){this.redraw(t,i)},i.prototype.updateScale=function(){this.scale.set(this.material.map.aspect,1,1).multiplyScalar(this.textSize*this.material.map.paddingBoxHeight)},i.prototype.updateMatrix=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];return this.updateScale(),e.prototype.updateMatrix.apply(this,t)},i.prototype.computeOptimalFontSize=function(t,e){if(t.domElement.width&&t.domElement.height&&this.material.map.lines.length){var i=this.getWorldPosition().distanceTo(e.getWorldPosition());if(i){var r=this.getWorldScale().y*t.domElement.height/i;if(r)return Math.round(r/this.material.map.paddingBoxHeight)}}return 0},i.prototype.redraw=function(t,e){var i=this;this.lastRedraw+this.redrawInterval<Date.now()&&(this.redrawInterval?setTimeout(function(){i.redrawNow(t,e)},1):this.redrawNow(t,e))},i.prototype.redrawNow=function(e,i){this.updateScale();var r=this.computeOptimalFontSize(e,i);r=t.Math.ceilPowerOfTwo(r),r=Math.min(r,this.maxFontSize),this.material.map.fontSize=r,this.material.map.autoRedraw||this.material.map.redraw(),this.lastRedraw=Date.now()},i.prototype.dispose=function(){this.material.map.dispose(),this.material.dispose()},Object.defineProperties(i.prototype,r),i}(t.Sprite)});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc