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.7.6 to 18.7.14

2

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

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

@@ -40,3 +40,3 @@ # THREE.TextTexture

`.constructor({autoRedraw, text, textAlign, lineHeight, fontFamily, fontSize, fontWeight, fontVariant, fontStyle, padding, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy})`
`.constructor({autoRedraw, text, textAlign, textLineHeight, fontFamily, fontSize, fontWeight, fontVariant, fontStyle, fillStyle, lineWidth, strokeStyle, padding, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy})`

@@ -52,3 +52,3 @@ ```javascript

let sprite = new THREE.Sprite(material);
sprite.scale.setX(texture.aspect).multiplyScalar(10);
sprite.scale.setX(texture.imageAspect).multiplyScalar(10);
scene.add(sprite);

@@ -69,3 +69,3 @@ ```

The horizontal alignment of the text lines. Possible values are `'center'`, `'left'` and `'right'`.
The horizontal alignment of the text. Possible values are `'center'`, `'left'` and `'right'`.

@@ -76,3 +76,3 @@ Changing the value will redraw the canvas if `autoRedraw` is `true`.

`.lines`
`.textLines`

@@ -85,3 +85,3 @@ *read-only*

`.lineHeight = 1.15`
`.textLineHeight = 1.15`

@@ -142,2 +142,26 @@ The height of a text line. The pixels are calculated relative to the font size.

`.fillStyle = 'White'`
The color or style to use inside shapes.
Changing the value will redraw the canvas if `autoRedraw` is `true`.
---
`.lineWidth = 0`
The thickness of lines. The pixels are calculated relative to the font size.
Changing the value will redraw the canvas if `autoRedraw` is `true`.
---
`.strokeStyle = 'Black'`
The color or style to use for the lines around shapes.
Changing the value will redraw the canvas if `autoRedraw` is `true`.
---
`.padding = 0.25`

@@ -174,3 +198,3 @@

`.aspect`
`.imageAspect`

@@ -177,0 +201,0 @@ *read-only*

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

!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(P){"use strict";function B(){return document.createElement("canvas")}function e(t){return void 0===t}function n(t,i){if(t.length){var e=B().getContext("2d");return e.font=i,function(t){if(0<t.length)return t.reduce(function(t,i){return Math.max(t,i)})}(t.map(function(t){return e.measureText(t).width}))}return 0}return function(I){function t(t){void 0===t&&(t={});var i=t.autoRedraw;void 0===i&&(i=!0);var e=t.text;void 0===e&&(e="");var n=t.textAlign;void 0===n&&(n="center");var o=t.lineHeight;void 0===o&&(o=1.15);var s=t.fontFamily;void 0===s&&(s="sans-serif");var h=t.fontSize;void 0===h&&(h=16);var r=t.fontWeight;void 0===r&&(r="normal");var a=t.fontVariant;void 0===a&&(a="normal");var f=t.fontStyle;void 0===f&&(f="normal");var l=t.padding;void 0===l&&(l=.25);var g=t.magFilter;void 0===g&&(g=P.LinearFilter);var d=t.minFilter;void 0===d&&(d=P.LinearFilter);var x=t.mapping,u=t.wrapS,c=t.wrapT,_=t.format,p=t.type,v=t.anisotropy;I.call(this,B(),x,u,c,g,d,_,p,v),this.autoRedraw=i,this._text=e,this._textAlign=n,this._lineHeight=o,this._fontFamily=s,this._fontSize=h,this._fontWeight=r,this._fontVariant=a,this._fontStyle=f,this._padding=l,this.redraw()}I&&(t.__proto__=I);var i={text:{configurable:!0},textAlign:{configurable:!0},lines:{configurable:!0},lineHeight:{configurable:!0},lineHeightInPixels:{configurable:!0},fontFamily:{configurable:!0},fontSize:{configurable:!0},fontWeight:{configurable:!0},fontVariant:{configurable:!0},fontStyle:{configurable:!0},font:{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((t.prototype=Object.create(I&&I.prototype)).constructor=t).prototype.redraw=function(){var i=this,e=this.image.getContext("2d");if(e.clearRect(0,0,e.canvas.width,e.canvas.height),this.textBoxWidthInPixels&&this.textBoxHeightInPixels){var n;switch(e.canvas.width=this.paddingBoxWidthInPixels,e.canvas.height=this.paddingBoxHeightInPixels,e.font=this.font,e.textBaseline="middle",e.fillStyle="White",this.textAlign){case"left":e.textAlign="left",n=this.paddingInPixels;break;case"right":e.textAlign="right",n=this.paddingInPixels+this.textBoxWidthInPixels;break;case"center":e.textAlign="center",n=this.paddingInPixels+this.textBoxWidthInPixels/2}var o=this.paddingInPixels+this.fontSize/2;this.lines.forEach(function(t){e.fillText(t,n,o),o+=i.lineHeightInPixels})}else e.canvas.width=e.canvas.height=1;this.needsUpdate=!0},t.prototype._redrawIfAuto=function(){this.autoRedraw&&this.redraw()},i.text.get=function(){return this._text},i.text.set=function(t){this._text!==t&&(this._text=t,this._lines=void 0,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.textAlign.get=function(){return this._textAlign},i.textAlign.set=function(t){this._textAlign!==t&&(this._textAlign=t,this._redrawIfAuto())},i.lines.get=function(){var t;return e(this._lines)&&(this._lines=(t=this.text)?t.split("\n"):[]),this._lines},i.lineHeight.get=function(){return this._lineHeight},i.lineHeight.set=function(t){this._lineHeight!==t&&(this._lineHeight=t,this._redrawIfAuto())},i.lineHeightInPixels.get=function(){return this.fontSize*this.lineHeight},i.fontFamily.get=function(){return this._fontFamily},i.fontFamily.set=function(t){this._fontFamily!==t&&(this._fontFamily=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontSize.get=function(){return this._fontSize},i.fontSize.set=function(t){this._fontSize!==t&&(this._fontSize=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontWeight.get=function(){return this._fontWeight},i.fontWeight.set=function(t){this._fontWeight!==t&&(this._fontWeight=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontVariant.get=function(){return this._fontVariant},i.fontVariant.set=function(t){this._fontVariant!==t&&(this._fontVariant=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontStyle.get=function(){return this._fontStyle},i.fontStyle.set=function(t){this._fontStyle!==t&&(this._fontStyle=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.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},i.textBoxWidthInPixels.get=function(){return e(this._textBoxWidthInPixels)&&(this._textBoxWidthInPixels=n(this.lines,this.font)),this._textBoxWidthInPixels},i.textBoxHeight.get=function(){return this.lineHeight*(this.lines.length-1)+1},i.textBoxHeightInPixels.get=function(){return this.fontSize*this.textBoxHeight},i.padding.get=function(){return this._padding},i.padding.set=function(t){this._padding!==t&&(this._padding=t,this._redrawIfAuto())},i.paddingInPixels.get=function(){return this.fontSize*this.padding},i.paddingBoxWidthInPixels.get=function(){return this.textBoxWidthInPixels+2*this.paddingInPixels},i.paddingBoxHeight.get=function(){return this.textBoxHeight+2*this.padding},i.paddingBoxHeightInPixels.get=function(){return this.textBoxHeightInPixels+2*this.paddingInPixels},i.aspect.get=function(){return this.image.width&&this.image.height?this.image.width/this.image.height:1},Object.defineProperties(t.prototype,i),t}(P.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(m){"use strict";function P(){return document.createElement("canvas")}function e(t){return void 0===t}function n(t,i){if(t.length){var e=P().getContext("2d");return e.font=i,function(t){if(0<t.length)return t.reduce(function(t,i){return Math.max(t,i)})}(t.map(function(t){return e.measureText(t).width}))}return 0}return function(S){function t(t){void 0===t&&(t={});var i=t.autoRedraw;void 0===i&&(i=!0);var e=t.text;void 0===e&&(e="");var n=t.textAlign;void 0===n&&(n="center");var o=t.textLineHeight;void 0===o&&(o=1.15);var s=t.fontFamily;void 0===s&&(s="sans-serif");var h=t.fontSize;void 0===h&&(h=16);var r=t.fontWeight;void 0===r&&(r="normal");var l=t.fontVariant;void 0===l&&(l="normal");var a=t.fontStyle;void 0===a&&(a="normal");var f=t.fillStyle;void 0===f&&(f="white");var g=t.lineWidth;void 0===g&&(g=0);var x=t.strokeStyle;void 0===x&&(x="black");var d=t.padding;void 0===d&&(d=.25);var u=t.magFilter;void 0===u&&(u=m.LinearFilter);var c=t.minFilter;void 0===c&&(c=m.LinearFilter);var _=t.mapping,I=t.wrapS,v=t.wrapT,y=t.format,W=t.type,p=t.anisotropy;S.call(this,P(),_,I,v,u,c,y,W,p),this.autoRedraw=i,this._text=e,this._textAlign=n,this._textLineHeight=o,this._fontFamily=s,this._fontSize=h,this._fontWeight=r,this._fontVariant=l,this._fontStyle=a,this._fillStyle=f,this._lineWidth=g,this._strokeStyle=x,this._padding=d,this.redraw()}S&&(t.__proto__=S);var i={text:{configurable:!0},textAlign:{configurable:!0},textLines:{configurable:!0},textLineHeight:{configurable:!0},textLineHeightInPixels:{configurable:!0},fontFamily:{configurable:!0},fontSize:{configurable:!0},fontWeight:{configurable:!0},fontVariant:{configurable:!0},fontStyle:{configurable:!0},font:{configurable:!0},fillStyle:{configurable:!0},lineWidth:{configurable:!0},lineWidthInPixels:{configurable:!0},strokeStyle:{configurable:!0},textBoxWidthInPixels:{configurable:!0},textBoxHeight:{configurable:!0},textBoxHeightInPixels:{configurable:!0},padding:{configurable:!0},paddingInPixels:{configurable:!0},imageWidthInPixels:{configurable:!0},imageHeight:{configurable:!0},imageHeightInPixels:{configurable:!0},imageAspect:{configurable:!0}};return((t.prototype=Object.create(S&&S.prototype)).constructor=t).prototype.redraw=function(){var i=this,e=this.image.getContext("2d");if(e.clearRect(0,0,e.canvas.width,e.canvas.height),this.textBoxWidthInPixels&&this.textBoxHeightInPixels){var n;switch(e.canvas.width=this.imageWidthInPixels,e.canvas.height=this.imageHeightInPixels,e.font=this.font,e.textBaseline="middle",this.textAlign){case"left":e.textAlign="left",n=this.paddingInPixels+this.lineWidthInPixels/2;break;case"right":e.textAlign="right",n=this.paddingInPixels+this.lineWidthInPixels/2+this.textBoxWidthInPixels;break;case"center":e.textAlign="center",n=this.paddingInPixels+this.lineWidthInPixels/4+this.textBoxWidthInPixels/2}var o=this.paddingInPixels+this.lineWidthInPixels/2+this.fontSize/2;e.fillStyle=this.fillStyle,e.miterLimit=1,e.lineWidth=this.lineWidthInPixels,e.strokeStyle=this.strokeStyle,this.textLines.forEach(function(t){i.lineWidth&&e.strokeText(t,n,o),e.fillText(t,n,o),o+=i.textLineHeightInPixels})}else e.canvas.width=e.canvas.height=1;this.needsUpdate=!0},t.prototype._redrawIfAuto=function(){this.autoRedraw&&this.redraw()},i.text.get=function(){return this._text},i.text.set=function(t){this._text!==t&&(this._text=t,this._textLines=void 0,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.textAlign.get=function(){return this._textAlign},i.textAlign.set=function(t){this._textAlign!==t&&(this._textAlign=t,this._redrawIfAuto())},i.textLines.get=function(){var t;return e(this._textLines)&&(this._textLines=(t=this.text)?t.split("\n"):[]),this._textLines},i.textLineHeight.get=function(){return this._textLineHeight},i.textLineHeight.set=function(t){this._textLineHeight!==t&&(this._textLineHeight=t,this._redrawIfAuto())},i.textLineHeightInPixels.get=function(){return this.fontSize*this.textLineHeight},i.fontFamily.get=function(){return this._fontFamily},i.fontFamily.set=function(t){this._fontFamily!==t&&(this._fontFamily=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontSize.get=function(){return this._fontSize},i.fontSize.set=function(t){this._fontSize!==t&&(this._fontSize=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontWeight.get=function(){return this._fontWeight},i.fontWeight.set=function(t){this._fontWeight!==t&&(this._fontWeight=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontVariant.get=function(){return this._fontVariant},i.fontVariant.set=function(t){this._fontVariant!==t&&(this._fontVariant=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.fontStyle.get=function(){return this._fontStyle},i.fontStyle.set=function(t){this._fontStyle!==t&&(this._fontStyle=t,this._textBoxWidthInPixels=void 0,this._redrawIfAuto())},i.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},i.fillStyle.get=function(){return this._fillStyle},i.fillStyle.set=function(t){this._fillStyle!==t&&(this._fillStyle=t,this._redrawIfAuto())},i.lineWidth.get=function(){return this._lineWidth},i.lineWidth.set=function(t){this._lineWidth!==t&&(this._lineWidth=t,this._redrawIfAuto())},i.lineWidthInPixels.get=function(){return this._lineWidth*this.fontSize},i.strokeStyle.get=function(){return this._strokeStyle},i.strokeStyle.set=function(t){this._strokeStyle!==t&&(this._strokeStyle=t,this._redrawIfAuto())},i.textBoxWidthInPixels.get=function(){return e(this._textBoxWidthInPixels)&&(this._textBoxWidthInPixels=n(this.textLines,this.font)),this._textBoxWidthInPixels},i.textBoxHeight.get=function(){return this.textLineHeight*(this.textLines.length-1)+1},i.textBoxHeightInPixels.get=function(){return this.textBoxHeight*this.fontSize},i.padding.get=function(){return this._padding},i.padding.set=function(t){this._padding!==t&&(this._padding=t,this._redrawIfAuto())},i.paddingInPixels.get=function(){return this.padding*this.fontSize},i.imageWidthInPixels.get=function(){return this.textBoxWidthInPixels+this.lineWidthInPixels+2*this.paddingInPixels},i.imageHeight.get=function(){return this.textBoxHeight+this.lineWidth+2*this.padding},i.imageHeightInPixels.get=function(){return this.imageHeight*this.fontSize},i.imageAspect.get=function(){return this.image.width&&this.image.height?this.image.width/this.image.height:1},Object.defineProperties(t.prototype,i),t}(m.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