Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

troika-3d-text

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

troika-3d-text - npm Package Compare versions

Comparing version 0.34.0-textoutline.8 to 0.34.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

# [0.34.0](https://github.com/protectwise/troika/compare/v0.33.1...v0.34.0) (2020-10-19)
### Features
* **troika-three-text:** text outline and better antialiasing at small sizes ([3836809](https://github.com/protectwise/troika/commit/3836809cc919b57b5eb357e66e35a15903bd54f7))
## [0.33.1](https://github.com/protectwise/troika/compare/v0.33.0...v0.33.1) (2020-10-02)

@@ -8,0 +20,0 @@

0

dist/troika-3d-text.esm.js

@@ -0,0 +0,0 @@ import { getSelectionRects, getCaretAtPoint, Text } from 'troika-three-text';

2

dist/troika-3d-text.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('troika-three-text'), require('troika-3d'), require('three')) :
typeof define === 'function' && define.amd ? define(['exports', 'troika-three-text', 'troika-3d', 'three'], factory) :
(global = global || self, factory(global.troika_3d_text = {}, global.troika_three_text, global.troika_3d, global.THREE));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.troika_3d_text = {}, global.troika_three_text, global.troika_3d, global.THREE));
}(this, (function (exports, troikaThreeText, troika3d, three) { 'use strict';

@@ -6,0 +6,0 @@

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

'use strict';(function(b,f){"object"===typeof exports&&"undefined"!==typeof module?f(exports,require("troika-three-text"),require("troika-3d"),require("three")):"function"===typeof define&&define.amd?define(["exports","troika-three-text","troika-3d","three"],f):(b=b||self,f(b.troika_3d_text={},b.troika_three_text,b.troika_3d,b.THREE))})(this,function(b,f,k,g){function m(){var c=k.createDerivedMaterial(new g.MeshBasicMaterial({transparent:!0,opacity:.3,depthWrite:!1}),{uniforms:{rect:{value:new g.Vector4}},
vertexDefs:"uniform vec4 rect;",vertexTransform:"\n position.x = position.x < 0.0 ? rect.x : rect.z;\n position.y = position.y < 0.0 ? rect.w : rect.y;\n "});c.instanceUniforms=["rect","diffuse"];var a=new g.Mesh((new g.BoxBufferGeometry).translate(0,0,-.5),c);return(m=function(){return a})()}var n=new g.Vector4,t=function(c){function a(a){c.call(this,a);this.instancedThreeObject=m();this._color=new g.Color;this._rect=new g.Vector4}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=
a;a.prototype.afterUpdate=function(){var a=this.top,l=this.right,h=this.bottom,e=this.left,b=this.color;this._color.equals(b)||this.setInstanceUniform("diffuse",this._color=new g.Color(b));this._rect.equals(n.set(e,a,l,h))||this.setInstanceUniform("rect",n.clone());c.prototype.afterUpdate.call(this)};a.prototype.getBoundingSphere=function(){return null};return a}(k.Instanceable3DFacade),p=new g.Matrix4,u=new g.Plane,v=new g.Vector3,q=Object.freeze([-Infinity,-Infinity,Infinity,Infinity]),w=function(c){function a(a,
b){var e=this;c.call(this,a);var h=a.threeObject;this.rangeColor=52479;this.clipRect=q;this.template={key:function(a,b){return"rect"+b},facade:t,top:function(a){return Math.min(e.clipRect[3],Math.max(e.clipRect[1],a.top))},right:function(a){return Math.min(e.clipRect[2],Math.max(e.clipRect[0],a.right))},bottom:function(a){return Math.min(e.clipRect[3],Math.max(e.clipRect[1],a.bottom))},left:function(a){return Math.min(e.clipRect[2],Math.max(e.clipRect[0],a.left))},z:function(a){return.25*(a.top-a.bottom)/
2},scaleZ:function(a){return.25*(a.top-a.bottom)},color:function(a){return e.rangeColor},visible:function(a){var b=e.clipRect;return a.right>b[0]&&a.top>b[1]&&a.left<b[2]&&a.bottom<b[3]},renderOrder:function(a){return e.renderOrder||0}};var d=function(c){var d=e.textRenderInfo;if(d){var r=c.intersection.point.clone().applyMatrix4(p.getInverse(h.matrixWorld));if(d=f.getCaretAtPoint(d,r.x,r.y))b(d.charIndex,d.charIndex),a.addEventListener("drag",l),a.addEventListener("dragend",g);c.preventDefault()}},
l=function(a){var c=h.textRenderInfo;if(a.ray&&c){var d=a.ray.clone().applyMatrix4(p.getInverse(h.matrixWorld)).intersectPlane(u.setComponents(0,0,1,0),v);d&&(c=f.getCaretAtPoint(c,d.x,d.y))&&b(e.selectionStart,c.charIndex);a.preventDefault()}},g=function(b){a.removeEventListener("drag",l);a.removeEventListener("dragend",g)};a.addEventListener("dragstart",d);a.addEventListener("mousedown",d);this._cleanupEvents=function(){g();a.removeEventListener("dragstart",d);a.removeEventListener("mousedown",
d)}}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;var b={clipRect:{configurable:!0}};a.prototype.afterUpdate=function(){this.data=f.getSelectionRects(this.textRenderInfo,this.selectionStart,this.selectionEnd);c.prototype.afterUpdate.call(this)};b.clipRect.set=function(a){this._clipRect=a&&Array.isArray(a)&&4===a.length?a:q};b.clipRect.get=function(){return this._clipRect};a.prototype.destructor=function(){this._cleanupEvents();c.prototype.destructor.call(this)};
Object.defineProperties(a.prototype,b);return a}(k.ListFacade),x="text anchorX anchorY font fontSize letterSpacing lineHeight maxWidth overflowWrap textAlign textIndent whiteSpace material color colorRanges outlineWidth outlineColor depthOffset clipRect orientation glyphGeometryDetail sdfGlyphSize debugSDF".split(" "),y=function(b){function a(a){var c=this,e=new f.Text;e.geometry.boundingSphere.version=0;b.call(this,a,e);this.selectable=!1;this.selectionStart=this.selectionEnd=-1;this.onSyncComplete=
this.onSyncStart=null;e.addEventListener("syncstart",function(a){c.notifyWorld("text3DSyncStart");if(c.onSyncStart)c.onSyncStart()});e.addEventListener("synccomplete",function(a){if(!c.isDestroying&&(e.geometry.boundingSphere.version++,c.afterUpdate(),c.notifyWorld("text3DSyncComplete"),c.notifyWorld("needsRender"),c.onSyncComplete))c.onSyncComplete()})}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var c={textRenderInfo:{configurable:!0}};c.textRenderInfo.get=
function(){return this.threeObject.textRenderInfo};a.prototype.afterUpdate=function(){var a=this,c=this.threeObject;x.forEach(function(b){c[b]=a[b]});c.sync();b.prototype.afterUpdate.call(this);this.text!==this._prevText&&(this.selectionStart=this.selectionEnd=-1,this._prevText=this.text);this._updateSelection()};a.prototype._updateSelection=function(){var a=this,b=this.selectable,c=this.selectionStart,f=this.selectionEnd,d=this._selectionFacade;b!==this._selectable&&((this._selectable=b)?d=this._selectionFacade=
new w(this,function(b,c){a.selectionStart=b;a.selectionEnd=c;a._updateSelection();a.notifyWorld("needsRender")}):(d&&(d.destructor(),d=this._selectionFacade=null),this.selectionStart=this.selectionEnd=-1));d&&(d.textRenderInfo=this.threeObject.textRenderInfo,d.selectionStart=c,d.selectionEnd=f,d.clipRect=this.clipRect,d.renderOrder=this.renderOrder,d.afterUpdate())};a.prototype.destructor=function(){this.threeObject.dispose();this._selectionFacade&&this._selectionFacade.destructor();b.prototype.destructor.call(this)};
Object.defineProperties(a.prototype,c);return a}(k.Object3DFacade);Object.defineProperty(b,"GlyphsGeometry",{enumerable:!0,get:function(){return f.GlyphsGeometry}});Object.defineProperty(b,"TextMesh",{enumerable:!0,get:function(){return f.Text}});Object.defineProperty(b,"configureTextBuilder",{enumerable:!0,get:function(){return f.configureTextBuilder}});Object.defineProperty(b,"fontProcessorWorkerModule",{enumerable:!0,get:function(){return f.fontProcessorWorkerModule}});Object.defineProperty(b,
"getCaretAtPoint",{enumerable:!0,get:function(){return f.getCaretAtPoint}});Object.defineProperty(b,"getSelectionRects",{enumerable:!0,get:function(){return f.getSelectionRects}});Object.defineProperty(b,"preloadFont",{enumerable:!0,get:function(){return f.preloadFont}});b.Text3DFacade=y;Object.defineProperty(b,"__esModule",{value:!0})})
'use strict';(function(b,f){"object"===typeof exports&&"undefined"!==typeof module?f(exports,require("troika-three-text"),require("troika-3d"),require("three")):"function"===typeof define&&define.amd?define(["exports","troika-three-text","troika-3d","three"],f):(b="undefined"!==typeof globalThis?globalThis:b||self,f(b.troika_3d_text={},b.troika_three_text,b.troika_3d,b.THREE))})(this,function(b,f,k,g){function m(){var c=k.createDerivedMaterial(new g.MeshBasicMaterial({transparent:!0,opacity:.3,depthWrite:!1}),
{uniforms:{rect:{value:new g.Vector4}},vertexDefs:"uniform vec4 rect;",vertexTransform:"\n position.x = position.x < 0.0 ? rect.x : rect.z;\n position.y = position.y < 0.0 ? rect.w : rect.y;\n "});c.instanceUniforms=["rect","diffuse"];var a=new g.Mesh((new g.BoxBufferGeometry).translate(0,0,-.5),c);return(m=function(){return a})()}var n=new g.Vector4,t=function(c){function a(a){c.call(this,a);this.instancedThreeObject=m();this._color=new g.Color;this._rect=new g.Vector4}c&&(a.__proto__=c);a.prototype=
Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.top,l=this.right,h=this.bottom,e=this.left,b=this.color;this._color.equals(b)||this.setInstanceUniform("diffuse",this._color=new g.Color(b));this._rect.equals(n.set(e,a,l,h))||this.setInstanceUniform("rect",n.clone());c.prototype.afterUpdate.call(this)};a.prototype.getBoundingSphere=function(){return null};return a}(k.Instanceable3DFacade),p=new g.Matrix4,u=new g.Plane,v=new g.Vector3,q=Object.freeze([-Infinity,
-Infinity,Infinity,Infinity]),w=function(c){function a(a,b){var e=this;c.call(this,a);var h=a.threeObject;this.rangeColor=52479;this.clipRect=q;this.template={key:function(a,b){return"rect"+b},facade:t,top:function(a){return Math.min(e.clipRect[3],Math.max(e.clipRect[1],a.top))},right:function(a){return Math.min(e.clipRect[2],Math.max(e.clipRect[0],a.right))},bottom:function(a){return Math.min(e.clipRect[3],Math.max(e.clipRect[1],a.bottom))},left:function(a){return Math.min(e.clipRect[2],Math.max(e.clipRect[0],
a.left))},z:function(a){return.25*(a.top-a.bottom)/2},scaleZ:function(a){return.25*(a.top-a.bottom)},color:function(a){return e.rangeColor},visible:function(a){var b=e.clipRect;return a.right>b[0]&&a.top>b[1]&&a.left<b[2]&&a.bottom<b[3]},renderOrder:function(a){return e.renderOrder||0}};var d=function(c){var d=e.textRenderInfo;if(d){var r=c.intersection.point.clone().applyMatrix4(p.getInverse(h.matrixWorld));if(d=f.getCaretAtPoint(d,r.x,r.y))b(d.charIndex,d.charIndex),a.addEventListener("drag",l),
a.addEventListener("dragend",g);c.preventDefault()}},l=function(a){var c=h.textRenderInfo;if(a.ray&&c){var d=a.ray.clone().applyMatrix4(p.getInverse(h.matrixWorld)).intersectPlane(u.setComponents(0,0,1,0),v);d&&(c=f.getCaretAtPoint(c,d.x,d.y))&&b(e.selectionStart,c.charIndex);a.preventDefault()}},g=function(b){a.removeEventListener("drag",l);a.removeEventListener("dragend",g)};a.addEventListener("dragstart",d);a.addEventListener("mousedown",d);this._cleanupEvents=function(){g();a.removeEventListener("dragstart",
d);a.removeEventListener("mousedown",d)}}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;var b={clipRect:{configurable:!0}};a.prototype.afterUpdate=function(){this.data=f.getSelectionRects(this.textRenderInfo,this.selectionStart,this.selectionEnd);c.prototype.afterUpdate.call(this)};b.clipRect.set=function(a){this._clipRect=a&&Array.isArray(a)&&4===a.length?a:q};b.clipRect.get=function(){return this._clipRect};a.prototype.destructor=function(){this._cleanupEvents();
c.prototype.destructor.call(this)};Object.defineProperties(a.prototype,b);return a}(k.ListFacade),x="text anchorX anchorY font fontSize letterSpacing lineHeight maxWidth overflowWrap textAlign textIndent whiteSpace material color colorRanges outlineWidth outlineColor depthOffset clipRect orientation glyphGeometryDetail sdfGlyphSize debugSDF".split(" "),y=function(b){function a(a){var c=this,e=new f.Text;e.geometry.boundingSphere.version=0;b.call(this,a,e);this.selectable=!1;this.selectionStart=this.selectionEnd=
-1;this.onSyncComplete=this.onSyncStart=null;e.addEventListener("syncstart",function(a){c.notifyWorld("text3DSyncStart");if(c.onSyncStart)c.onSyncStart()});e.addEventListener("synccomplete",function(a){if(!c.isDestroying&&(e.geometry.boundingSphere.version++,c.afterUpdate(),c.notifyWorld("text3DSyncComplete"),c.notifyWorld("needsRender"),c.onSyncComplete))c.onSyncComplete()})}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var c={textRenderInfo:{configurable:!0}};
c.textRenderInfo.get=function(){return this.threeObject.textRenderInfo};a.prototype.afterUpdate=function(){var a=this,c=this.threeObject;x.forEach(function(b){c[b]=a[b]});c.sync();b.prototype.afterUpdate.call(this);this.text!==this._prevText&&(this.selectionStart=this.selectionEnd=-1,this._prevText=this.text);this._updateSelection()};a.prototype._updateSelection=function(){var a=this,b=this.selectable,c=this.selectionStart,f=this.selectionEnd,d=this._selectionFacade;b!==this._selectable&&((this._selectable=
b)?d=this._selectionFacade=new w(this,function(b,c){a.selectionStart=b;a.selectionEnd=c;a._updateSelection();a.notifyWorld("needsRender")}):(d&&(d.destructor(),d=this._selectionFacade=null),this.selectionStart=this.selectionEnd=-1));d&&(d.textRenderInfo=this.threeObject.textRenderInfo,d.selectionStart=c,d.selectionEnd=f,d.clipRect=this.clipRect,d.renderOrder=this.renderOrder,d.afterUpdate())};a.prototype.destructor=function(){this.threeObject.dispose();this._selectionFacade&&this._selectionFacade.destructor();
b.prototype.destructor.call(this)};Object.defineProperties(a.prototype,c);return a}(k.Object3DFacade);Object.defineProperty(b,"GlyphsGeometry",{enumerable:!0,get:function(){return f.GlyphsGeometry}});Object.defineProperty(b,"TextMesh",{enumerable:!0,get:function(){return f.Text}});Object.defineProperty(b,"configureTextBuilder",{enumerable:!0,get:function(){return f.configureTextBuilder}});Object.defineProperty(b,"fontProcessorWorkerModule",{enumerable:!0,get:function(){return f.fontProcessorWorkerModule}});
Object.defineProperty(b,"getCaretAtPoint",{enumerable:!0,get:function(){return f.getCaretAtPoint}});Object.defineProperty(b,"getSelectionRects",{enumerable:!0,get:function(){return f.getSelectionRects}});Object.defineProperty(b,"preloadFont",{enumerable:!0,get:function(){return f.preloadFont}});b.Text3DFacade=y;Object.defineProperty(b,"__esModule",{value:!0})})
{
"name": "troika-3d-text",
"version": "0.34.0-textoutline.8+f398aa3",
"version": "0.34.0",
"description": "SDF text for the Troika 3D scene management framework",

@@ -17,6 +17,6 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>",

"dependencies": {
"troika-3d": "^0.33.1",
"troika-three-text": "^0.34.0-textoutline.8+f398aa3"
"troika-3d": "^0.34.0",
"troika-three-text": "^0.34.0"
},
"gitHead": "f398aa3ee5376d012c63cb9206acb6efe654aefe"
"gitHead": "b19cd3aff4b0876253d76b3fc66b7e2a1f16a7e5"
}

@@ -0,0 +0,0 @@ # `troika-3d-text`

@@ -0,0 +0,0 @@ import { ListFacade } from 'troika-3d'

@@ -0,0 +0,0 @@ import { BoxBufferGeometry, Color, Mesh, MeshBasicMaterial, Vector4 } from 'three'

@@ -0,0 +0,0 @@ import { Object3DFacade } from 'troika-3d'

@@ -0,0 +0,0 @@ // Proxy exports from troika-three-text for convenience:

Sorry, the diff of this file is not supported yet

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