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 17.11.5 to 17.11.21

82

package.json
{
"name": "three.texttexture",
"version": "17.11.5",
"description": "A texture for writing text on its canvas.",
"main": "THREE.TextTexture.js",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SeregPie/THREE.TextTexture.git"
},
"keywords": [
"three",
"canvas",
"text",
"texture",
"image",
"font",
"sprite",
"material",
"3d",
"class",
"plugin"
],
"author": "Sergej Sintschilin",
"license": "MIT",
"bugs": {
"url": "https://github.com/SeregPie/THREE.TextTexture/issues"
},
"homepage": "https://github.com/SeregPie/THREE.TextTexture#readme",
"dependencies": {
"three": "^0.87.1"
},
"devDependencies": {
"eslint": "^4.10.0",
"rollup": "^0.50.0",
"rollup-plugin-buble": "^0.16.0",
"rollup-plugin-uglify": "^2.0.1"
}
"name": "three.texttexture",
"version": "17.11.21",
"description": "A texture for writing text on its canvas.",
"main": "THREE.TextTexture.js",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SeregPie/THREE.TextTexture.git"
},
"keywords": [
"three",
"canvas",
"text",
"texture",
"image",
"font",
"sprite",
"material",
"3d",
"class",
"plugin"
],
"author": "Sergej Sintschilin",
"license": "MIT",
"bugs": {
"url": "https://github.com/SeregPie/THREE.TextTexture/issues"
},
"homepage": "https://github.com/SeregPie/THREE.TextTexture#readme",
"dependencies": {
"three": "^0.88.0"
},
"devDependencies": {
"eslint": "^4.11.0",
"rollup": "^0.51.8",
"rollup-plugin-buble": "^0.18.0",
"rollup-plugin-uglify": "^2.0.1"
}
}

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