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.3.3 to 18.3.19

12

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

@@ -26,5 +26,5 @@ "main": "THREE.TextSprite.js",

"size",
"three",
"text",
"texture"
"texture",
"three"
],

@@ -38,7 +38,7 @@ "author": "Sergej Sintschilin",

"dependencies": {
"three": "^0.90.0",
"three.texttexture": "^18.3.3"
"three": "^0.91.0",
"three.texttexture": "^18.3.19"
},
"devDependencies": {
"rollup": "^0.56.3",
"rollup": "^0.57.1",
"rollup-plugin-buble": "^0.19.2",

@@ -45,0 +45,0 @@ "rollup-plugin-uglify": "^3.0.0"

@@ -24,2 +24,8 @@ # THREE.TextSprite

### ES module
```javascript
import TextSprite from 'three.textsprite';
```
### browser

@@ -33,2 +39,4 @@

The class `TextSprite` will be available under the namespace `THREE`.
## members

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