three.texttexture
Advanced tools
Comparing version 18.1.14 to 18.3.3
{ | ||
"name": "three.texttexture", | ||
"version": "18.1.14", | ||
"version": "18.3.3", | ||
"description": "A texture for writing text on its canvas.", | ||
@@ -35,10 +35,11 @@ "main": "THREE.TextTexture.js", | ||
"dependencies": { | ||
"three": "^0.89.0" | ||
"three": "^0.90.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.15.0", | ||
"rollup": "^0.54.0", | ||
"rollup-plugin-buble": "^0.18.0", | ||
"rollup-plugin-uglify": "^2.0.1" | ||
"rollup": "^0.56.3", | ||
"rollup-plugin-buble": "^0.19.2", | ||
"rollup-plugin-node-resolve": "^3.0.3", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"x": "github:SeregPie/MyJavaScriptHelpers" | ||
} | ||
} |
@@ -30,10 +30,2 @@ # THREE.TextTexture | ||
--- | ||
Include [polyfills](https://polyfill.io/) to support older browsers. | ||
```html | ||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script> | ||
``` | ||
## members | ||
@@ -62,2 +54,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -77,2 +71,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -84,2 +80,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -91,2 +89,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -98,2 +98,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -105,2 +107,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -120,2 +124,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -127,2 +133,4 @@ | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
--- | ||
@@ -134,16 +142,4 @@ | ||
--- | ||
Changing the value will redraw the canvas if `autoRedraw` is `true`. | ||
`.text`<br/> | ||
`.fontStyle`<br/> | ||
`.fontVariant`<br/> | ||
`.fontWeight`<br/> | ||
`.fontSize`<br/> | ||
`.fontFamily`<br/> | ||
`.textAlign`<br/> | ||
`.lineHeight`<br/> | ||
`.padding`<br/> | ||
Changing the value will redraw the canvas, if `autoRedraw` is `true`. | ||
--- | ||
@@ -161,3 +157,3 @@ | ||
Make use of it, if you want to change multiple properties at once. This way you will avoid unnecessary `.redraw()` calls. | ||
Make use of it if you want to change multiple properties at once. This way you will avoid unnecessary `.redraw()` calls. | ||
@@ -164,0 +160,0 @@ ```javascript |
@@ -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");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),n.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){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},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 i&&(t=t.map(i)),t.reduce(function(t,i){return Math.max(t,i)})}(this.lines,function(e){return(n=t.font,o=e,i.font=n,i.measureText(o)).width;var n,o}):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)}); | ||
!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)}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11065
5
22
169
+ Addedthree@0.90.0(transitive)
- Removedthree@0.89.0(transitive)
Updatedthree@^0.90.0