Socket
Socket
Sign inDemoInstall

three.texttexture

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three.texttexture - npm Package Compare versions

Comparing version 18.3.3 to 18.3.19

12

package.json
{
"name": "three.texttexture",
"version": "18.3.3",
"version": "18.3.19",
"description": "A texture for writing text on its canvas.",

@@ -24,5 +24,5 @@ "main": "THREE.TextTexture.js",

"sprite",
"three",
"text",
"texture"
"texture",
"three"
],

@@ -36,8 +36,8 @@ "author": "Sergej Sintschilin",

"dependencies": {
"three": "^0.90.0"
"three": "^0.91.0"
},
"devDependencies": {
"rollup": "^0.56.3",
"rollup": "^0.57.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-uglify": "^3.0.0",

@@ -44,0 +44,0 @@ "x": "github:SeregPie/MyJavaScriptHelpers"

@@ -23,2 +23,8 @@ # THREE.TextTexture

### ES module
```javascript
import TextTexture from 'three.texttexture';
```
### browser

@@ -31,2 +37,4 @@

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

@@ -33,0 +41,0 @@

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

!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("three")):"function"==typeof define&&define.amd?define(["three"],i):i(t.THREE)}(this,function(t){"use strict";function i(){return document.createElement("canvas")}function e(t,e){if(t.length){var n=i().getContext("2d");return n.font=e,function(t,i){if(t.length>0)return i&&(t=t.map(i)),t.reduce(function(t,i){return Math.max(t,i)})}(t,function(t){return n.measureText(t).width})}return 0}(t=t&&t.hasOwnProperty("default")?t.default:t).TextTexture=function(n){function o(e){void 0===e&&(e={});var o=e.autoRedraw;void 0===o&&(o=!0);var s=e.text;void 0===s&&(s="");var h=e.fontStyle;void 0===h&&(h="normal");var r=e.fontVariant;void 0===r&&(r="normal");var a=e.fontWeight;void 0===a&&(a="normal");var f=e.fontSize;void 0===f&&(f=16);var l=e.fontFamily;void 0===l&&(l="sans-serif");var g=e.textAlign;void 0===g&&(g="center");var d=e.lineHeight;void 0===d&&(d=1.15);var x=e.padding;void 0===x&&(x=.25);var u=e.magFilter;void 0===u&&(u=t.LinearFilter);var c=e.minFilter;void 0===c&&(c=t.LinearFilter);var _=e.mapping,p=e.wrapS,v=e.wrapT,I=e.format,P=e.type,B=e.anisotropy;n.call(this,i(),_,p,v,u,c,I,P,B),this.autoRedraw=o,this._text=s,this._fontStyle=h,this._fontVariant=r,this._fontWeight=a,this._fontSize=f,this._fontFamily=l,this._textAlign=g,this._lineHeight=d,this._padding=x,this.redraw()}n&&(o.__proto__=n),o.prototype=Object.create(n&&n.prototype),o.prototype.constructor=o;var s={text:{configurable:!0},lines:{configurable:!0},linesCount:{configurable:!0},fontStyle:{configurable:!0},fontVariant:{configurable:!0},fontWeight:{configurable:!0},fontSize:{configurable:!0},fontFamily:{configurable:!0},font:{configurable:!0},textAlign:{configurable:!0},lineHeight:{configurable:!0},lineHeightInPixels:{configurable:!0},textBoxWidthInPixels:{configurable:!0},textBoxHeight:{configurable:!0},textBoxHeightInPixels:{configurable:!0},padding:{configurable:!0},paddingInPixels:{configurable:!0},paddingBoxWidthInPixels:{configurable:!0},paddingBoxHeight:{configurable:!0},paddingBoxHeightInPixels:{configurable:!0},aspect:{configurable:!0}};return o.prototype.redraw=function(){var t=this,i=this.image.getContext("2d");if(i.clearRect(0,0,i.canvas.width,i.canvas.height),this.textBoxWidthInPixels&&this.textBoxHeightInPixels){var e;switch(i.canvas.width=this.paddingBoxWidthInPixels,i.canvas.height=this.paddingBoxHeightInPixels,i.font=this.font,i.textBaseline="middle",i.fillStyle="white",this.textAlign){case"left":i.textAlign="left",e=this.paddingInPixels;break;case"right":i.textAlign="right",e=this.paddingInPixels+this.textBoxWidthInPixels;break;case"center":i.textAlign="center",e=this.paddingInPixels+this.textBoxWidthInPixels/2}var n=this.paddingInPixels+this.fontSize/2;this.lines.forEach(function(o){i.fillText(o,e,n),n+=t.lineHeightInPixels})}else i.canvas.width=i.canvas.height=1;this.needsUpdate=!0},o.prototype._redrawIfAuto=function(){this.autoRedraw&&this.redraw()},s.text.get=function(){return this._text},s.text.set=function(t){this._text!==t&&(this._text=t,this._lines=void 0,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.lines.get=function(){var t;return void 0===this._lines&&(this._lines=(t=this.text)?t.split("\n"):[]),this._lines},s.linesCount.get=function(){return this.lines.length},s.fontStyle.get=function(){return this._fontStyle},s.fontStyle.set=function(t){this._fontStyle!==t&&(this._fontStyle=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontVariant.get=function(){return this._fontVariant},s.fontVariant.set=function(t){this._fontVariant!==t&&(this._fontVariant=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontWeight.get=function(){return this._fontWeight},s.fontWeight.set=function(t){this._fontWeight!==t&&(this._fontWeight=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontSize.get=function(){return this._fontSize},s.fontSize.set=function(t){this._fontSize!==t&&(this._fontSize=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontFamily.get=function(){return this._fontFamily},s.fontFamily.set=function(t){this._fontFamily!==t&&(this._fontFamily=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.font.get=function(){return t=this.fontStyle,i=this.fontVariant,e=this.fontWeight,n=this.fontSize,o=this.fontFamily,[t,i,e,n+"px",o].join(" ");var t,i,e,n,o},s.textAlign.get=function(){return this._textAlign},s.textAlign.set=function(t){this._textAlign!==t&&(this._textAlign=t,this._redrawIfAuto())},s.lineHeight.get=function(){return this._lineHeight},s.lineHeight.set=function(t){this._lineHeight!==t&&(this._lineHeight=t,this._redrawIfAuto())},s.lineHeightInPixels.get=function(){return this.fontSize*this.lineHeight},s.textBoxWidthInPixels.get=function(){return void 0===this._textBoxWidthInPixels&&(this._textBoxWidthInPixels=e(this.lines,this.font)),this._textBoxWidthInPixels},s.textBoxHeight.get=function(){return this.lineHeight*(this.linesCount-1)+1},s.textBoxHeightInPixels.get=function(){return this.fontSize*this.textBoxHeight},s.padding.get=function(){return this._padding},s.padding.set=function(t){this._padding!==t&&(this._padding=t,this._redrawIfAuto())},s.paddingInPixels.get=function(){return this.fontSize*this.padding},s.paddingBoxWidthInPixels.get=function(){return this.textBoxWidthInPixels+2*this.paddingInPixels},s.paddingBoxHeight.get=function(){return this.textBoxHeight+2*this.padding},s.paddingBoxHeightInPixels.get=function(){return this.textBoxHeightInPixels+2*this.paddingInPixels},s.aspect.get=function(){return this.image.width&&this.image.height?this.image.width/this.image.height:1},Object.defineProperties(o.prototype,s),o}(t.Texture)});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("three")):"function"==typeof define&&define.amd?define(["three"],i):(t.THREE=t.THREE||{},t.THREE.TextTexture=i(t.THREE))}(this,function(t){"use strict";function i(){return document.createElement("canvas")}function e(t,e){if(t.length){var n=i().getContext("2d");return n.font=e,function(t,i){if(t.length>0)return i&&(t=t.map(i)),t.reduce(function(t,i){return Math.max(t,i)})}(t,function(t){return n.measureText(t).width})}return 0}return function(n){function o(e){void 0===e&&(e={});var o=e.autoRedraw;void 0===o&&(o=!0);var s=e.text;void 0===s&&(s="");var h=e.fontStyle;void 0===h&&(h="normal");var r=e.fontVariant;void 0===r&&(r="normal");var a=e.fontWeight;void 0===a&&(a="normal");var f=e.fontSize;void 0===f&&(f=16);var l=e.fontFamily;void 0===l&&(l="sans-serif");var g=e.textAlign;void 0===g&&(g="center");var d=e.lineHeight;void 0===d&&(d=1.15);var x=e.padding;void 0===x&&(x=.25);var u=e.magFilter;void 0===u&&(u=t.LinearFilter);var c=e.minFilter;void 0===c&&(c=t.LinearFilter);var _=e.mapping,p=e.wrapS,v=e.wrapT,I=e.format,P=e.type,B=e.anisotropy;n.call(this,i(),_,p,v,u,c,I,P,B),this.autoRedraw=o,this._text=s,this._fontStyle=h,this._fontVariant=r,this._fontWeight=a,this._fontSize=f,this._fontFamily=l,this._textAlign=g,this._lineHeight=d,this._padding=x,this.redraw()}n&&(o.__proto__=n),o.prototype=Object.create(n&&n.prototype),o.prototype.constructor=o;var s={text:{configurable:!0},lines:{configurable:!0},fontStyle:{configurable:!0},fontVariant:{configurable:!0},fontWeight:{configurable:!0},fontSize:{configurable:!0},fontFamily:{configurable:!0},font:{configurable:!0},textAlign:{configurable:!0},lineHeight:{configurable:!0},lineHeightInPixels:{configurable:!0},textBoxWidthInPixels:{configurable:!0},textBoxHeight:{configurable:!0},textBoxHeightInPixels:{configurable:!0},padding:{configurable:!0},paddingInPixels:{configurable:!0},paddingBoxWidthInPixels:{configurable:!0},paddingBoxHeight:{configurable:!0},paddingBoxHeightInPixels:{configurable:!0},aspect:{configurable:!0}};return o.prototype.redraw=function(){var t=this,i=this.image.getContext("2d");if(i.clearRect(0,0,i.canvas.width,i.canvas.height),this.textBoxWidthInPixels&&this.textBoxHeightInPixels){var e;switch(i.canvas.width=this.paddingBoxWidthInPixels,i.canvas.height=this.paddingBoxHeightInPixels,i.font=this.font,i.textBaseline="middle",i.fillStyle="white",this.textAlign){case"left":i.textAlign="left",e=this.paddingInPixels;break;case"right":i.textAlign="right",e=this.paddingInPixels+this.textBoxWidthInPixels;break;case"center":i.textAlign="center",e=this.paddingInPixels+this.textBoxWidthInPixels/2}var n=this.paddingInPixels+this.fontSize/2;this.lines.forEach(function(o){i.fillText(o,e,n),n+=t.lineHeightInPixels})}else i.canvas.width=i.canvas.height=1;this.needsUpdate=!0},o.prototype._redrawIfAuto=function(){this.autoRedraw&&this.redraw()},s.text.get=function(){return this._text},s.text.set=function(t){this._text!==t&&(this._text=t,this._lines=void 0,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.lines.get=function(){var t;return void 0===this._lines&&(this._lines=(t=this.text)?t.split("\n"):[]),this._lines},s.fontStyle.get=function(){return this._fontStyle},s.fontStyle.set=function(t){this._fontStyle!==t&&(this._fontStyle=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontVariant.get=function(){return this._fontVariant},s.fontVariant.set=function(t){this._fontVariant!==t&&(this._fontVariant=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontWeight.get=function(){return this._fontWeight},s.fontWeight.set=function(t){this._fontWeight!==t&&(this._fontWeight=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontSize.get=function(){return this._fontSize},s.fontSize.set=function(t){this._fontSize!==t&&(this._fontSize=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.fontFamily.get=function(){return this._fontFamily},s.fontFamily.set=function(t){this._fontFamily!==t&&(this._fontFamily=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},s.font.get=function(){return t=this.fontStyle,i=this.fontVariant,e=this.fontWeight,n=this.fontSize,o=this.fontFamily,[t,i,e,n+"px",o].join(" ");var t,i,e,n,o},s.textAlign.get=function(){return this._textAlign},s.textAlign.set=function(t){this._textAlign!==t&&(this._textAlign=t,this._redrawIfAuto())},s.lineHeight.get=function(){return this._lineHeight},s.lineHeight.set=function(t){this._lineHeight!==t&&(this._lineHeight=t,this._redrawIfAuto())},s.lineHeightInPixels.get=function(){return this.fontSize*this.lineHeight},s.textBoxWidthInPixels.get=function(){return void 0===this._textBoxWidthInPixels&&(this._textBoxWidthInPixels=e(this.lines,this.font)),this._textBoxWidthInPixels},s.textBoxHeight.get=function(){return this.lineHeight*(this.lines.length-1)+1},s.textBoxHeightInPixels.get=function(){return this.fontSize*this.textBoxHeight},s.padding.get=function(){return this._padding},s.padding.set=function(t){this._padding!==t&&(this._padding=t,this._redrawIfAuto())},s.paddingInPixels.get=function(){return this.fontSize*this.padding},s.paddingBoxWidthInPixels.get=function(){return this.textBoxWidthInPixels+2*this.paddingInPixels},s.paddingBoxHeight.get=function(){return this.textBoxHeight+2*this.padding},s.paddingBoxHeightInPixels.get=function(){return this.textBoxHeightInPixels+2*this.paddingInPixels},s.aspect.get=function(){return this.image.width&&this.image.height?this.image.width/this.image.height:1},Object.defineProperties(o.prototype,s),o}(t.Texture)});
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