Socket
Socket
Sign inDemoInstall

three.texttexture

Package Overview
Dependencies
1
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 18.3.19 to 18.7.6

22

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

@@ -11,6 +11,3 @@ "main": "THREE.TextTexture.js",

},
"repository": {
"type": "git",
"url": "git+https://github.com/SeregPie/THREE.TextTexture.git"
},
"repository": "https://github.com/SeregPie/THREE.TextTexture.git",
"keywords": [

@@ -29,18 +26,13 @@ "3d",

],
"author": "Sergej Sintschilin",
"author": "Sergej Sintschilin <seregpie@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/SeregPie/THREE.TextTexture/issues"
},
"homepage": "https://github.com/SeregPie/THREE.TextTexture#readme",
"dependencies": {
"three": "^0.91.0"
"three": "^0.94.0"
},
"devDependencies": {
"rollup": "^0.57.1",
"@seregpie/rollup-plugin-resolve": "^18.6.13",
"rollup": "^0.62.0",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-uglify": "^3.0.0",
"x": "github:SeregPie/MyJavaScriptHelpers"
"rollup-plugin-uglify": "^4.0.0"
}
}

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

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

@@ -46,5 +46,5 @@ ```javascript

text: 'Carpe Diem',
fontFamily: '"Times New Roman", Times, serif',
fontSize: 32,
fontStyle: 'italic',
fontSize: 32,
fontFamily: '"Times New Roman", Times, serif',
});

@@ -67,21 +67,21 @@ let material = new THREE.SpriteMaterial({map: texture, color: 0xffffbb});

`.lines`
`.textAlign = 'center'`
*read-only*
The horizontal alignment of the text lines. Possible values are `'center'`, `'left'` and `'right'`.
The text split by the new line character.
Changing the value will redraw the canvas if `autoRedraw` is `true`.
---
`.fontStyle = 'normal'`
`.lines`
The font style of the text. Possible values are `'normal'`, `'italic'` and `'oblique'`.
*read-only*
Changing the value will redraw the canvas if `autoRedraw` is `true`.
The text split by the new line character.
---
`.fontVariant = 'normal'`
`.lineHeight = 1.15`
The font variant of the text. Possible values are `'normal'` and `'small-caps'`.
The height of a text line. The pixels are calculated relative to the font size.

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

`.fontWeight = 'normal'`
`.fontFamily = 'sans-serif'`
The font weight of the text. Possible values are `'normal'`, `'bold'`, `'bolder'`, `'lighter'` and `'100'` to `'900'`.
The font family of the text.

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

`.fontFamily = 'sans-serif'`
`.fontWeight = 'normal'`
The font family of the text.
The font weight of the text. Possible values are `'normal'`, `'bold'`, `'bolder'`, `'lighter'` and `'100'` to `'900'`.

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

`.font`
`.fontVariant = 'normal'`
*read-only*
The font variant of the text. Possible values are `'normal'` and `'small-caps'`.
The combined font properties.
Changing the value will redraw the canvas if `autoRedraw` is `true`.
---
`.textAlign = 'center'`
`.fontStyle = 'normal'`
The horizontal alignment of the text lines. Possible values are `'center'`, `'left'` and `'right'`.
The font style of the text. Possible values are `'normal'`, `'italic'` and `'oblique'`.

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

`.lineHeight = 1.15`
`.font`
The height of a text line. The pixels are calculated relative to the font size.
*read-only*
Changing the value will redraw the canvas if `autoRedraw` is `true`.
The combined font properties.

@@ -142,0 +142,0 @@ ---

@@ -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(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)});
!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)});
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc