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

troika-3d-ui

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

troika-3d-ui - npm Package Compare versions

Comparing version 0.38.0 to 0.38.1

12

CHANGELOG.md

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

## [0.38.1](https://github.com/protectwise/troika/compare/v0.38.0...v0.38.1) (2021-02-03)
### Bug Fixes
* add new text props to UI blocks ([a2d631f](https://github.com/protectwise/troika/commit/a2d631f3921263bf602282e22211bf869556f8a4))
* update to support up to Three r125 ([4edff04](https://github.com/protectwise/troika/commit/4edff042d13dec49377d18baf4f958de285a3f2a))
# [0.38.0](https://github.com/protectwise/troika/compare/v0.37.0...v0.38.0) (2021-01-24)

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

81

dist/troika-3d-ui.umd.min.js

@@ -1,46 +0,47 @@

'use strict';(function(n,D){"object"===typeof exports&&"undefined"!==typeof module?D(exports,require("troika-flex-layout"),require("troika-core"),require("three"),require("troika-3d"),require("troika-3d-text"),require("object-path"),require("troika-three-utils")):"function"===typeof define&&define.amd?define("exports troika-flex-layout troika-core three troika-3d troika-3d-text object-path troika-three-utils".split(" "),D):(n=n||self,D(n.troika_3d_ui={},n.troika_flex_layout,n.troika_core,n.THREE,
n.troika_3d,n.troika_3d_text,n.objectPath,n.troika_three_utils))})(this,function(n,D,E,e,u,F,x,O){function A(b,a,d){for(var c;b&&"inherit"===(c=b[a]);)b=b.parentFlexNode,c=void 0;void 0===c&&(c=d);return c}function H(b,a){for(var d;b&&"string"===typeof(d=b.fontSize);)if("inherit"===d)b=b.parentFlexNode,d=void 0;else{if(/%$/.test(d)){var c=parseFloat(d)/100;d=H(b.parentFlexNode,a);void 0!==d&&(d*=c)}else console.warn("Unknown fontSize: "+d),d=void 0;break}void 0===d&&(d=a);return d}function da(b){b=
'use strict';(function(n,D){"object"===typeof exports&&"undefined"!==typeof module?D(exports,require("troika-flex-layout"),require("troika-core"),require("three"),require("troika-3d"),require("troika-3d-text"),require("troika-three-utils"),require("object-path")):"function"===typeof define&&define.amd?define("exports troika-flex-layout troika-core three troika-3d troika-3d-text troika-three-utils object-path".split(" "),D):(n=n||self,D(n.troika_3d_ui={},n.troika_flex_layout,n.troika_core,n.THREE,
n.troika_3d,n.troika_3d_text,n.troika_three_utils,n.objectPath))})(this,function(n,D,E,e,u,F,M,x){function A(b,a,d){for(var c;b&&"inherit"===(c=b[a]);)b=b.parentFlexNode,c=void 0;void 0===c&&(c=d);return c}function H(b,a){for(var d;b&&"string"===typeof(d=b.fontSize);)if("inherit"===d)b=b.parentFlexNode,d=void 0;else{if(/%$/.test(d)){var c=parseFloat(d)/100;d=H(b.parentFlexNode,a);void 0!==d&&(d*=c)}else console.warn("Unknown fontSize: "+d),d=void 0;break}void 0===d&&(d=a);return d}function da(b){b=
u.createDerivedMaterial(b,{defines:{TROIKA_UI_BLOCK:""},extensions:{derivatives:!0},uniforms:{uTroikaBlockSize:{value:new e.Vector2},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaCornerRadii:{value:new e.Vector4(0,0,0,0)},uTroikaBorderWidth:{value:new e.Vector4(0,0,0,0)}},vertexDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaPosInBlock;\n",vertexTransform:"\nvec2 xy = position.xy * uTroikaBlockSize;\nxy.y *= -1.0;\nxy = clamp(xy, uTroikaClipRect.xy, uTroikaClipRect.zw);\nvTroikaPosInBlock = xy;\nxy.y *= -1.0;\nposition.xy = xy;\n",
fragmentDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaCornerRadii;\nuniform vec4 uTroikaBorderWidth;\nvarying vec2 vTroikaPosInBlock;\nconst vec4 NO_BORDER = vec4(0.,0.,0.,0.);\n\nfloat troikaEllipseRadiusAtAngle(in float angle, in float rx, in float ry) {\n if (rx == ry) {return rx;}\n float _cos = cos(angle);\n float _sin = sin(angle);\n return 1.0 / sqrt((_cos*_cos)/(rx*rx) + (_sin*_sin)/(ry*ry));\n}\n\nvoid troikaGetCurveDists(\n in vec2 pos, in vec2 radCenter, in float outerR, in float xBorder, in float yBorder, \n out float dOuter, out float dInner\n) {\n vec2 adjPos = pos - radCenter;\n float angle = atan(adjPos.y, adjPos.x);\n dOuter = troikaEllipseRadiusAtAngle(angle, outerR, outerR) - length(adjPos);\n dInner = uTroikaBorderWidth == NO_BORDER ? dInner : \n troikaEllipseRadiusAtAngle(angle, max(0.0, outerR - xBorder), max(0.0, outerR - yBorder)) - length(adjPos);\n}\n\nfloat troikaGetAlphaMultiplier() {\n // Short aliases\n vec2 dim = uTroikaBlockSize;\n vec4 rad = uTroikaCornerRadii;\n vec4 bdr = uTroikaBorderWidth;\n vec2 pos = vTroikaPosInBlock;\n\n float dOuter;\n float dInner;\n bool isOnCurve = true;\n bool isBorder = uTroikaBorderWidth != NO_BORDER;\n\n // Top left\n if (pos.x < rad[0] && pos.y < rad[0]) {\n troikaGetCurveDists(pos, vec2(rad[0], rad[0]), rad[0], bdr[3], bdr[0], dOuter, dInner);\n }\n // Top Right\n else if (pos.x > dim.x - rad[1] && pos.y < rad[1]) {\n troikaGetCurveDists(pos, vec2(dim.x - rad[1], rad[1]), rad[1], bdr[1], bdr[0], dOuter, dInner);\n }\n // Bottom Right\n else if (pos.x > dim.x - rad[2] && pos.y > dim.y - rad[2]) {\n troikaGetCurveDists(pos, vec2(dim.x - rad[2], dim.y - rad[2]), rad[2], bdr[1], bdr[2], dOuter, dInner);\n }\n // Bottom Left\n else if (pos.x < rad[3] && pos.y > dim.y - rad[3]) {\n troikaGetCurveDists(pos, vec2(rad[3], dim.y - rad[3]), rad[3], bdr[3], bdr[2], dOuter, dInner);\n }\n // Not on a curve, use closest side\n else {\n isOnCurve = false;\n dOuter = min(min(pos.x, pos.y), min(dim.x - pos.x, dim.y - pos.y));\n dInner = isBorder ? min(min(pos.x - bdr[3], pos.y - bdr[0]), min(dim.x - pos.x - bdr[1], dim.y - pos.y - bdr[2])) : dInner;\n }\n\n float alpha;\n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aa = length(fwidth(pos)) * 0.5;\n alpha = isOnCurve ? smoothstep(-aa, aa, dOuter) : 1.0;\n alpha = isBorder ? min(alpha, (dOuter == dInner) ? 0.0 : smoothstep(aa, -aa, dInner)) : alpha;\n return alpha;\n #else\n alpha = step(0.0, dOuter);\n alpha = isBorder ? min(alpha, step(0.0, -dInner)) : alpha;\n #endif\n return alpha;\n}\n",
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetAlphaMultiplier();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});Object.defineProperty(b,"shadowSide",{get:function(){return this.side},set:function(){}});b.transparent=!0;return b}function ea(b){if(!b._didScroll){var a=b.currentTarget,d=b.nativeEvent,c=d.deltaX,g=d.deltaY;d=1===d.deltaMode?H(a,16)*A(a,"lineHeight",1.2):H(a,16)/12;c*=d;g*=d;d=Math.max(0,Math.min(a.scrollWidth-a.clientWidth,
a.scrollLeft+c));var h=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,a.scrollTop+g)),f=Math.abs;if(d!==a.scrollLeft&&f(c)>f(g)||h!==a.scrollTop&&f(g)>f(c))a.scrollLeft=d,a.scrollTop=h,a.afterUpdate(),a.notifyWorld("needsRender"),b._didScroll=!0;b.preventDefault()}}function P(b){if(!b._didScroll&&!b.defaultPrevented){var a=b.currentTarget,d=b.ray.clone().applyMatrix4(Q.getInverse(a.threeObject.matrixWorld)).intersectPlane(fa.setComponents(0,0,1,0),new e.Vector3),c=a._prevDragPos;if(d&&c&&"drag"===
b.type){var g=d.x-c.x;c=d.y-c.y;if(g||c)if(g=Math.max(0,Math.min(a.scrollWidth-a.clientWidth,a.scrollLeft+g)),c=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,a.scrollTop+c)),g!==a.scrollLeft||c!==a.scrollTop)a.scrollLeft=g,a.scrollTop=c,a.afterUpdate(),a.notifyWorld("needsRender"),b._didScroll=!0}a._prevDragPos=d}}function M(b){return"string"===typeof b||"number"===typeof b}function ha(b){b.updateMatrices&&b.updateMatrices()}function ia(b,a,d,c,g,h){c=6*b%1;h=[d,-d*c*a+d,g=-d*a+d,g,d*c*a+g,d];
return[h[c=6*b|0],h[(4+c)%6],h[(2+c)%6]]}x=x&&Object.prototype.hasOwnProperty.call(x,"default")?x["default"]:x;var ja=E.utils.assign,y=E.utils.createClassExtender;y=y("flexNode",function(b){var a=function(d){function c(c){d.call(this,c);this.needsFlexLayout=this.isFlexNode=!0;for(this._flexStyles={id:this.$facadeId};c&&!c.isFlexNode;)c=c.parent;c?(this.parentFlexNode=c,this.flexNodeDepth=c.flexNodeDepth+1):this.flexNodeDepth=0}d&&(c.__proto__=d);c.prototype=Object.create(d&&d.prototype);c.prototype.constructor=
c;c.prototype.afterUpdate=function(){null!=this.offsetWidth&&(this._checkOverscroll(),this._updateClipRect());d.prototype.afterUpdate.call(this);this.needsFlexLayout&&(this.parentFlexNode?(this.notifyWorld("needsFlexLayout"),this.needsFlexLayout=!1):this._performRootLayout())};c.prototype.destructor=function(){this.parentFlexNode&&this.notifyWorld("needsFlexLayout");d.prototype.destructor.call(this)};c.prototype.onNotifyWorld=function(c,a,b){"needsFlexLayout"!==a||this.parentFlexNode?d.prototype.onNotifyWorld.call(this,
c,a,b):(this.needsFlexLayout=!0,this._rootLayoutReq||(this._rootLayoutReq=setTimeout(this._performRootLayout.bind(this),0)))};c.prototype._performRootLayout=function(){var c=this;this._hasActiveFlexRequest||(this._hasActiveFlexRequest=!0,this.needsFlexLayout=!1,clearTimeout(this._rootLayoutReq),delete this._rootLayoutReq,this.traverse(function(c){if(c.isFlexNode){var d=c.parentFlexNode;d&&(d._flexStyles.children||(d._flexStyles.children=[])).push(c._flexStyles);c._flexStyles.children=null}}),D.requestFlexLayout(this._flexStyles,
function(d){c.isDestroying||(c._applyRootLayoutResults(d),c._hasActiveFlexRequest=!1,c.afterUpdate(),c.notifyWorld("needsRender"))}))};c.prototype._applyRootLayoutResults=function(c){this.traverse(function(d){if(d.isFlexNode){var a=c[d.$facadeId];if(a){var b=a.left,g=a.top,h=a.width;a=a.height;var m=d.borderWidth,e=d.padding;d.offsetLeft=b;d.offsetTop=g;d.offsetWidth=h;d.offsetHeight=a;d.clientLeft=m[3]+e[3];d.clientTop=m[0]+e[0];d.clientWidth=h-m[1]-m[3]-e[1]-e[3];d.clientHeight=a-m[0]-m[2]-e[0]-
e[2];d.scrollHeight=d.scrollWidth=0;if(m=d.parentFlexNode)b=b+h-m.clientLeft,g=g+a-m.clientTop,b>m.scrollWidth&&(Math.abs(b-m.clientWidth)<b/1E4&&(b=m.clientWidth),m.scrollWidth=b),g>m.scrollHeight&&(Math.abs(g-m.clientHeight)<g/1E4&&(g=m.clientHeight),m.scrollHeight=g);if(d.onAfterFlexLayoutApplied)d.onAfterFlexLayoutApplied()}}})};c.prototype._checkOverscroll=function(){var c=this.scrollLeft,d=this.scrollTop;if(c||d){var a=Math.max(0,this.scrollWidth-this.clientWidth),b=Math.max(0,this.scrollHeight-
this.clientHeight);a<c&&(this.scrollLeft=a);b<d&&(this.scrollTop=b)}};c.prototype._updateClipRect=function(){var c=this.offsetWidth,d=this.offsetHeight,a=this.parentFlexNode;if(a&&"absolute"!==this.position){var b=this.offsetLeft-a.scrollLeft;var k=this.offsetTop-a.scrollTop,l="visible"!==a.overflow;var m=Math.max(l?a.clientLeft:-Infinity,a.clipLeft)-b;var e=Math.max(l?a.clientTop:-Infinity,a.clipTop)-k;b=Math.min(l?a.clientLeft+a.clientWidth:Infinity,a.clipRight)-b;a=Math.min(l?a.clientTop+a.clientHeight:
Infinity,a.clipBottom)-k}else m=e=-Infinity,b=a=Infinity;this.clipLeft=m;this.clipTop=e;this.clipRight=b;this.clipBottom=a;this.isFullyClipped=m>=c||e>=d||0>=b||0>=a||m===b||e===a};return c}(b);ja(a.prototype,{offsetLeft:null,offsetTop:null,offsetWidth:null,offsetHeight:null,clientLeft:null,clientTop:null,clientWidth:null,clientHeight:null,scrollLeft:0,scrollTop:0,scrollWidth:null,scrollHeight:null,clipLeft:null,clipTop:null,clipRight:null,clipBottom:null,isFullyClipped:!1,overflow:"visible"});"width height minWidth minHeight maxWidth maxHeight aspectRatio flexDirection flex flexWrap flexBasis flexGrow flexShrink alignContent alignItems alignSelf justifyContent position left right top bottom".split(" ").forEach(function(d){Object.defineProperty(a.prototype,
d,{get:function(){return this._flexStyles[d]},set:function(c){c!==this._flexStyles[d]&&(this._flexStyles[d]=c,this.needsFlexLayout=!0)},configurable:!0})});["margin","padding","borderWidth"].forEach(function(d){var c="_priv_"+d,b="borderWidth"===d?"border":d,h=b+"Top",f=b+"Right",p=b+"Bottom",k=b+"Left";Object.defineProperty(a.prototype,d,{get:function(){return this[c]||(this[c]=Object.freeze([0,0,0,0]))},set:function(a){if(Array.isArray(a)){var b=a.length;var g=a[0]||0;var e=(1<b?a[1]:a[0])||0;var l=
(2<b?a[2]:a[0])||0;a=(3<b?a[3]:1<b?a[1]:a[0])||0}else g=e=l=a;b=this[d];if(g!==b[0]||e!==b[1]||l!==b[2]||a!==b[3])this[c]=Object.freeze([g,e,l,a]),b=this._flexStyles,b[h]=g,b[f]=e,b[p]=l,b[k]=a,this.needsFlexLayout=!0}})});return a});var z="font fontSize textAlign textIndent lineHeight letterSpacing whiteSpace overflowWrap color".split(" "),R="text textIndent font fontSize lineHeight letterSpacing whiteSpace overflowWrap".split(" "),ka=function(){},G=function(b){function a(a){b.call(this,a);a=this.threeObject;
a._actuallySync=a.sync;a.sync=ka}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.offsetLeft,c=this.offsetTop;if(null!==this.offsetWidth){var g=this.parentFlexNode;this.x=a-g.scrollLeft;this.y=-(c-g.scrollTop);a=this.clipRect||(this.clipRect=[0,0,0,0]);a[0]=this.clipLeft;a[1]=-this.clipBottom;a[2]=this.clipRight;a[3]=-this.clipTop;this.threeObject.visible=!this.isFullyClipped}a=this._flexStyles;c=0;for(g=R.length;c<
g;c++){var h=R[c];("text"===h?this.text:A(this,h))!==a[h]&&(a[h]=this[h],this.needsFlexLayout=!0)}b.prototype.afterUpdate.call(this)};a.prototype.onAfterFlexLayoutApplied=function(){this.threeObject.maxWidth=this.offsetWidth;this.threeObject._actuallySync(this._afterSync)};a.prototype.getBoundingSphere=function(){return null};return a}(F.Text3DFacade);G=y(G);z.forEach(function(b){G.prototype[b]="inherit"});Object.defineProperty(G.prototype,"maxWidth",{value:Infinity,enumerable:!0,writable:!0});var la=
G,ma=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),S=new e.MeshBasicMaterial({color:0}),na=Object.freeze(new e.Vector2),T=Object.freeze(new e.Vector4(0,0,0,0)),oa={customDepthMaterial:{get:function(){return this.material.getDepthMaterial()}},customDistanceMaterial:{get:function(){return this.material.getDistanceMaterial()}}},U=new Map,V=function(b){function a(a){b.call(this,a);this._colorObj=new e.Color;this.size=na;this.borderWidth=this.borderRadius=T;this.color=0;this.isBorder=!1;this.material=
S}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.material,c=this.depthOffset,g=this.castShadow,h=this.receiveShadow,f=this.color,p=this.renderOrder;a||(a=S);c=a.id+"|"+p+"|"+c+"|"+g+"|"+h;if(c!==this._prevMeshKey){var k=U.get(c);if(!k){var l=da(a);l.instanceUniforms=["diffuse","uTroikaBlockSize","uTroikaClipRect","uTroikaCornerRadii","uTroikaBorderWidth"];l.polygonOffset=!!this.depthOffset;l.polygonOffsetFactor=
l.polygonOffsetUnits=this.depthOffset||0;a.addEventListener("dispose",function v(){a.removeEventListener("dispose",v);l.dispose()});k=new e.Mesh(ma,l);k._instanceKey=c;k.castShadow=g;k.receiveShadow=h;k.renderOrder=p;Object.defineProperties(k,oa);U.set(c,k)}this.instancedThreeObject=k;this._prevMeshKey=c}this.setInstanceUniform("uTroikaBlockSize",this.size);this.setInstanceUniform("uTroikaCornerRadii",this.borderRadius);this.setInstanceUniform("uTroikaClipRect",this.clipRect);this.setInstanceUniform("uTroikaBorderWidth",
this.isBorder?this.borderWidth:T);f!==this._lastColor&&(this._lastColor=f,this.setInstanceUniform("diffuse",new e.Color(f)));b.prototype.afterUpdate.call(this)};a.prototype.getBoundingSphere=function(){return null};return a}(u.Instanceable3DFacade),W,X=function(b){function a(a){var c=new e.Mesh(W||(W=(new e.CylinderBufferGeometry(.5,.5,1,8)).translate(0,-.5,0)),new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}));b.call(this,a,c);this.length=this.girth=0}b&&(a.__proto__=b);a.prototype=
Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.scaleX=this.scaleZ=this.girth;this.scaleY=this.length;this.rotateZ=this.horizontal?Math.PI/2:0;this.threeObject.material.opacity=this.opacity;b.prototype.afterUpdate.call(this)};return a}(u.Object3DFacade),N=new WeakMap,Y={opacity:{duration:300}},pa=function(b){function a(a){var c=this;b.call(this,a);this._onOver=function(a){c.hovering=!0;c.afterUpdate()};this._onOut=function(a){c.hovering=!1;c.afterUpdate()}}
b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var d={target:{configurable:!0}};d.target.set=function(a){var c=N.get(this);a!==c&&(c&&(c.removeEventListener("mouseover",this._onOver),c.removeEventListener("mouseout",this._onOut)),a&&(a.addEventListener("mouseover",this._onOver),a.addEventListener("mouseout",this._onOut)),N.set(this,a))};d.target.get=function(){return N.get(this)};a.prototype.describeChildren=function(){var a=this.target,b=this._childArr||(this._childArr=
[]);b.length=0;if(a){var d=a.offsetWidth,f=a.offsetHeight,p=a.scrollHeight,e=a.scrollWidth,l=a.clientWidth,m=a.clientHeight,v=a.getComputedFontSize();if(e>l){var r=this._hDef||(this._hDef={key:"h",facade:X,horizontal:!0,transition:Y});r.girth=Math.min(v/4,f/10);r.length=Math.max(l*l/e,v);r.x=a.clientLeft+a.scrollLeft/(e-l)*(l-r.length);r.y=-f;r.opacity=this.hovering?.5:0;r.renderOrder=this.renderOrder;b.push(r)}p>m&&(f=this._vDef||(this._vDef={key:"v",facade:X,transition:Y}),f.girth=Math.min(v/4,
d/10),f.length=Math.max(m*m/p,v),f.x=d,f.y=-(a.clientTop+a.scrollTop/(p-m)*(m-f.length)),f.opacity=this.hovering?.5:0,f.renderOrder=this.renderOrder,b.push(f))}return b};a.prototype.destructor=function(){this.target=null;b.prototype.destructor.call(this)};Object.defineProperties(a.prototype,d);return a}(u.ParentFacade),Z=new e.Mesh((new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0)),Q=new e.Matrix4,C=new e.Vector4(0,0,0,0),qa=Object.freeze(new e.Vector4(0,0,0,0)),fa=new e.Plane,ra={get:function(){return!this._priv_hidden&&
!this.$facade.isFullyClipped},set:function(b){this._priv_hidden=!b}},I=function(b){function a(a){b.call(this,a);Object.defineProperty(this.threeObject,"visible",ra);this.layers=new b(this);this.layers.children=[null,null,null];this._sizeVec2=Object.freeze(new e.Vector2);this._borderRadiiVec4=this._borderWidthVec4=this._clipRectVec4=qa;(this._geomBoundingSphere=new e.Sphere).version=0;this._wasFullyClipped=!0}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.updateChildren=
function(a){this.isFullyClipped&&this._wasFullyClipped||b.prototype.updateChildren.call(this,a)};a.prototype.updateMatrices=function(){b.prototype.updateMatrices.call(this);this.layers.traverse(ha)};a.prototype.afterUpdate=function(){var a=this.layers,c=this.backgroundColor,g=this.backgroundMaterial,h=this.borderWidth,f=this.borderColor,p=this.borderMaterial,k=this.text,l=this.offsetLeft,m=this.offsetTop,v=this.offsetWidth,r=this.offsetHeight,n=this.parentFlexNode,t=this.flexNodeDepth,q=this.isFullyClipped,
w=this._wasFullyClipped,u=this._borderWidthVec4,x=this._clipRectVec4,y=this._sizeVec2,z=null!==v,B=!(!v||!r),D=B&&!q&&(null!=c||null!=g),E=B&&!q&&(null!=f||null!=p)&&0<Math.max.apply(Math,h);B=B&&("scroll"===this.overflow||"auto"===this.overflow)&&(this.scrollHeight>this.clientHeight||this.scrollWidth>this.clientWidth);z&&(n&&(z="absolute"===this.position,this.x=l-(z?0:n.scrollLeft),this.y=-(m-(z?0:n.scrollTop))),v!==y.x||r!==y.y)&&(y=this._sizeVec2=Object.freeze(new e.Vector2(v,r)),l=this._geomBoundingSphere,
l.radius=Math.sqrt(v*v/4+r*r/4),l.center.set(v/2,-r/2,0),l.version++);if(!q||!w)if(l=D||E?this._normalizeBorderRadius():null,C.fromArray(h),C.equals(u)||(u=this._borderWidthVec4=Object.freeze(C.clone())),C.set(Math.max(this.clipLeft,0),Math.max(this.clipTop,0),Math.min(this.clipRight,v),Math.min(this.clipBottom,r)),C.equals(x)||(x=this._clipRectVec4=Object.freeze(C.clone())),h=null,D&&(h=this._bgLayerDef||(this._bgLayerDef={key:"bg",facade:V}),h.size=y,h.color=c,h.borderRadius=l,h.material=g,h.clipRect=
x,h.depthOffset=-t,h.renderOrder=t,h.castShadow=this.castShadow,h.receiveShadow=this.receiveShadow),a.children[0]=h,c=null,E&&(c=this._borderLayerDef||(this._borderLayerDef={key:"border",facade:V,isBorder:!0}),c.size=y,c.color=f,c.borderWidth=u,c.borderRadius=l,c.material=p,c.clipRect=x,c.depthOffset=-t-1,c.renderOrder=t+1,c.castShadow=this.castShadow,c.receiveShadow=this.receiveShadow),a.children[1]=c,f=null,B&&(f=this._scrollbarsDef||(this._scrollbarsDef={key:"sb",facade:pa,target:this}),f.renderOrder=
t+2),a.children[2]=f,!k&&M(this.children)&&(k=""+this.children),k)f=this._textChildDef||(this._textChildDef={key:"text",facade:la}),f.text=k,f.font=A(this,"font"),f.fontSize=this.getComputedFontSize(),f.textAlign=A(this,"textAlign"),f.textIndent=A(this,"textIndent"),f.lineHeight=A(this,"lineHeight","normal"),f.letterSpacing=A(this,"letterSpacing",0),f.whiteSpace=A(this,"whiteSpace"),f.overflowWrap=A(this,"overflowWrap"),f.color=A(this,"color"),f.material=this.textMaterial,f.depthOffset=-t-1,f.renderOrder=
t+1,f.castShadow=this.castShadow,f.receiveShadow=this.receiveShadow,this._actualChildren=f;else{k=this.children;if(Array.isArray(k))for(t=0,f=k.length;t<f;t++)if(M(k[t])){for(k=k.slice();t<f;t++)M(k[t])&&(k[t]={facade:sa,text:""+k[t],textMaterial:this.textMaterial});break}this._actualChildren=k}B!==this._couldScroll&&(this._couldScroll=B,this[(B?"add":"remove")+"EventListener"]("wheel",ea),this[(B?"add":"remove")+"EventListener"]("dragstart",P),this[(B?"add":"remove")+"EventListener"]("drag",P));
b.prototype.afterUpdate.call(this);q&&w||a.afterUpdate();this._wasFullyClipped=q};a.prototype.describeChildren=function(){return this._actualChildren};a.prototype.getComputedFontSize=function(){return H(this,16)};a.prototype._normalizeBorderRadius=function(){var a=this.borderRadius,b=this.offsetWidth;void 0===b&&(b=0);var g=this.offsetHeight;void 0===g&&(g=0);var h=this._borderRadiiVec4;if(Array.isArray(a)){var f=a.length;var e=a[0]||0;var k=(1<f?a[1]:a[0])||0;var l=(2<f?a[2]:a[0])||0;a=(3<f?a[3]:
1<f?a[1]:a[0])||0}else e=k=l=a=a||0;if(0!==e||0!==k||0!==l||0!==a)f=Math.min(b,g),"string"===typeof e&&/%$/.test(e)&&(e=parseInt(e,10)/100*f),"string"===typeof k&&/%$/.test(k)&&(k=parseInt(k,10)/100*f),"string"===typeof a&&/%$/.test(a)&&(a=parseInt(a,10)/100*f),"string"===typeof l&&/%$/.test(l)&&(l=parseInt(l,10)/100*f),b=Math.min(b/(e+k),g/(k+l),b/(l+a),g/(a+e)),1>b&&(e*=b,k*=b,a*=b,l*=b);C.set(e,k,l,a);C.equals(h)||(h=this._borderRadiiVec4=Object.freeze(C.clone()));return h};a.prototype._getGeometryBoundingSphere=
function(){return this._geomBoundingSphere.radius&&!this.isFullyClipped?this._geomBoundingSphere:null};a.prototype.raycast=function(a){var b=this,d=this.offsetWidth,h=this.offsetHeight,f=this.clipTop,e=this.clipRight,k=this.clipBottom,l=this.clipLeft,m=null;d&&h&&(Z.matrixWorld.multiplyMatrices(this.threeObject.matrixWorld,Q.makeScale(d,h,1)),m=this._raycastObject(Z,a))&&(m=m.filter(function(a){var b=a.uv.x*d;a=(1-a.uv.y)*h;return b>l&&b<e&&a>f&&a<k}),m.forEach(function(a){a.distance=parseFloat(a.distance.toFixed(12));
a.distanceBias=-b.flexNodeDepth}));return m&&m.length?m:null};a.prototype.destructor=function(){this.layers.destructor();b.prototype.destructor.call(this)};return a}(u.Group3DFacade),sa=I=y(I);z.forEach(function(b){I.prototype[b]="inherit"});var w=I,ta=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),ua=new e.MeshBasicMaterial,va=new e.TextureLoader;F=function(b){function a(a,c){c=new e.Mesh(ta,ua.clone());c.visible=!1;b.call(this,a,c)}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);
a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this,c=this.offsetLeft,g=this.offsetTop,h=this.offsetWidth,f=this.offsetHeight,e=this.src,k=this.threeObject,l=k.material,m=!(!h||!f);m&&(this.x=c,this.y=-g,this.scaleX=h,this.scaleY=f,c=this.flexNodeDepth,l.polygonOffset=!!c,l.polygonOffsetFactor=l.polygonOffsetUnits=-c||0,k.renderOrder=c);e!==this._lastSrc&&(va.load(e,function(b){l.map&&l.map.dispose();l.map=b;a.aspectRatio=b.image.width/b.image.height;a.afterUpdate();a.notifyWorld("needsRender")}),
this._lastSrc=e);k.visible=!!(m&&l.map&&l.map.image.complete);b.prototype.afterUpdate.call(this)};a.prototype.destructor=function(){var a=this.threeObject.material.map;a&&a.dispose();b.prototype.destructor.call(this)};return a}(u.Object3DFacade);F=y(F);var aa=function(b){function a(a){b.call(this,a);this.font="https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.woff"}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var d={icon:{configurable:!0},
size:{configurable:!0}};d.icon.set=function(a){this.text=a};d.size.set=function(a){this.fontSize=a};Object.defineProperties(a.prototype,d);return a}(w);z=function(b){function a(a){var c=this;b.call(this,a);this.justifyContent="center";this.fontSize="150%";this.onClick=function(a){c.onUpdate(!c.value)}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.icon=this.value?"check_box":"check_box_outline_blank";b.prototype.afterUpdate.call(this)};
return a}(aa);var wa=function(b){function a(a){b.call(this,a);this.children={facade:b,borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],alignItems:"center",justifyContent:"center",pointerStates:{hover:{backgroundColor:6710988}}}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.children.text=this.label||"Missing label";b.prototype.afterUpdate.call(this)};return a}(w),q=new e.Color,J=new e.Plane,ba=
(new e.CylinderBufferGeometry(.5,.5,1,45)).translate(0,.5,0).rotateX(Math.PI/2).rotateZ(Math.PI/2),ca=O.createDerivedMaterial(new e.MeshBasicMaterial({side:2}),{uniforms:{maxValue:{value:1}},vertexDefs:"\nvarying vec3 vPos;\n",vertexMainIntro:"\nvPos = position;\n",fragmentDefs:"\nuniform float maxValue;\nvarying vec3 vPos;\n\n// From https://github.com/hughsk/glsl-hsv2rgb\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n",
a.scrollLeft+c));var h=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,a.scrollTop+g)),f=Math.abs;if(d!==a.scrollLeft&&f(c)>f(g)||h!==a.scrollTop&&f(g)>f(c))a.scrollLeft=d,a.scrollTop=h,a.afterUpdate(),a.notifyWorld("needsRender"),b._didScroll=!0;b.preventDefault()}}function P(b){if(!b._didScroll&&!b.defaultPrevented){var a=b.currentTarget,d=b.ray.clone().applyMatrix4(M.invertMatrix4(a.threeObject.matrixWorld,Q)).intersectPlane(fa.setComponents(0,0,1,0),new e.Vector3),c=a._prevDragPos;if(d&&c&&
"drag"===b.type){var g=d.x-c.x;c=d.y-c.y;if(g||c)if(g=Math.max(0,Math.min(a.scrollWidth-a.clientWidth,a.scrollLeft+g)),c=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,a.scrollTop+c)),g!==a.scrollLeft||c!==a.scrollTop)a.scrollLeft=g,a.scrollTop=c,a.afterUpdate(),a.notifyWorld("needsRender"),b._didScroll=!0}a._prevDragPos=d}}function N(b){return"string"===typeof b||"number"===typeof b}function ha(b){b.updateMatrices&&b.updateMatrices()}function ia(b,a,d,c,g,h){c=6*b%1;h=[d,-d*c*a+d,g=-d*a+d,g,d*
c*a+g,d];return[h[c=6*b|0],h[(4+c)%6],h[(2+c)%6]]}x=x&&Object.prototype.hasOwnProperty.call(x,"default")?x["default"]:x;var ja=E.utils.assign,y=E.utils.createClassExtender;y=y("flexNode",function(b){var a=function(d){function c(c){d.call(this,c);this.needsFlexLayout=this.isFlexNode=!0;for(this._flexStyles={id:this.$facadeId};c&&!c.isFlexNode;)c=c.parent;c?(this.parentFlexNode=c,this.flexNodeDepth=c.flexNodeDepth+1):this.flexNodeDepth=0}d&&(c.__proto__=d);c.prototype=Object.create(d&&d.prototype);
c.prototype.constructor=c;c.prototype.afterUpdate=function(){null!=this.offsetWidth&&(this._checkOverscroll(),this._updateClipRect());d.prototype.afterUpdate.call(this);this.needsFlexLayout&&(this.parentFlexNode?(this.notifyWorld("needsFlexLayout"),this.needsFlexLayout=!1):this._performRootLayout())};c.prototype.destructor=function(){this.parentFlexNode&&this.notifyWorld("needsFlexLayout");d.prototype.destructor.call(this)};c.prototype.onNotifyWorld=function(c,a,b){"needsFlexLayout"!==a||this.parentFlexNode?
d.prototype.onNotifyWorld.call(this,c,a,b):(this.needsFlexLayout=!0,this._rootLayoutReq||(this._rootLayoutReq=setTimeout(this._performRootLayout.bind(this),0)))};c.prototype._performRootLayout=function(){var c=this;this._hasActiveFlexRequest||(this._hasActiveFlexRequest=!0,this.needsFlexLayout=!1,clearTimeout(this._rootLayoutReq),delete this._rootLayoutReq,this.traverse(function(c){if(c.isFlexNode){var d=c.parentFlexNode;d&&(d._flexStyles.children||(d._flexStyles.children=[])).push(c._flexStyles);
c._flexStyles.children=null}}),D.requestFlexLayout(this._flexStyles,function(d){c.isDestroying||(c._applyRootLayoutResults(d),c._hasActiveFlexRequest=!1,c.afterUpdate(),c.notifyWorld("needsRender"))}))};c.prototype._applyRootLayoutResults=function(c){this.traverse(function(d){if(d.isFlexNode){var a=c[d.$facadeId];if(a){var b=a.left,g=a.top,h=a.width;a=a.height;var m=d.borderWidth,e=d.padding;d.offsetLeft=b;d.offsetTop=g;d.offsetWidth=h;d.offsetHeight=a;d.clientLeft=m[3]+e[3];d.clientTop=m[0]+e[0];
d.clientWidth=h-m[1]-m[3]-e[1]-e[3];d.clientHeight=a-m[0]-m[2]-e[0]-e[2];d.scrollHeight=d.scrollWidth=0;if(m=d.parentFlexNode)b=b+h-m.clientLeft,g=g+a-m.clientTop,b>m.scrollWidth&&(Math.abs(b-m.clientWidth)<b/1E4&&(b=m.clientWidth),m.scrollWidth=b),g>m.scrollHeight&&(Math.abs(g-m.clientHeight)<g/1E4&&(g=m.clientHeight),m.scrollHeight=g);if(d.onAfterFlexLayoutApplied)d.onAfterFlexLayoutApplied()}}})};c.prototype._checkOverscroll=function(){var c=this.scrollLeft,d=this.scrollTop;if(c||d){var a=Math.max(0,
this.scrollWidth-this.clientWidth),b=Math.max(0,this.scrollHeight-this.clientHeight);a<c&&(this.scrollLeft=a);b<d&&(this.scrollTop=b)}};c.prototype._updateClipRect=function(){var c=this.offsetWidth,d=this.offsetHeight,a=this.parentFlexNode;if(a&&"absolute"!==this.position){var b=this.offsetLeft-a.scrollLeft;var k=this.offsetTop-a.scrollTop,l="visible"!==a.overflow;var m=Math.max(l?a.clientLeft:-Infinity,a.clipLeft)-b;var e=Math.max(l?a.clientTop:-Infinity,a.clipTop)-k;b=Math.min(l?a.clientLeft+a.clientWidth:
Infinity,a.clipRight)-b;a=Math.min(l?a.clientTop+a.clientHeight:Infinity,a.clipBottom)-k}else m=e=-Infinity,b=a=Infinity;this.clipLeft=m;this.clipTop=e;this.clipRight=b;this.clipBottom=a;this.isFullyClipped=m>=c||e>=d||0>=b||0>=a||m===b||e===a};return c}(b);ja(a.prototype,{offsetLeft:null,offsetTop:null,offsetWidth:null,offsetHeight:null,clientLeft:null,clientTop:null,clientWidth:null,clientHeight:null,scrollLeft:0,scrollTop:0,scrollWidth:null,scrollHeight:null,clipLeft:null,clipTop:null,clipRight:null,
clipBottom:null,isFullyClipped:!1,overflow:"visible"});"width height minWidth minHeight maxWidth maxHeight aspectRatio flexDirection flex flexWrap flexBasis flexGrow flexShrink alignContent alignItems alignSelf justifyContent position left right top bottom".split(" ").forEach(function(d){Object.defineProperty(a.prototype,d,{get:function(){return this._flexStyles[d]},set:function(c){c!==this._flexStyles[d]&&(this._flexStyles[d]=c,this.needsFlexLayout=!0)},configurable:!0})});["margin","padding","borderWidth"].forEach(function(d){var c=
"_priv_"+d,b="borderWidth"===d?"border":d,h=b+"Top",f=b+"Right",p=b+"Bottom",k=b+"Left";Object.defineProperty(a.prototype,d,{get:function(){return this[c]||(this[c]=Object.freeze([0,0,0,0]))},set:function(a){if(Array.isArray(a)){var b=a.length;var g=a[0]||0;var e=(1<b?a[1]:a[0])||0;var l=(2<b?a[2]:a[0])||0;a=(3<b?a[3]:1<b?a[1]:a[0])||0}else g=e=l=a;b=this[d];if(g!==b[0]||e!==b[1]||l!==b[2]||a!==b[3])this[c]=Object.freeze([g,e,l,a]),b=this._flexStyles,b[h]=g,b[f]=e,b[p]=l,b[k]=a,this.needsFlexLayout=
!0}})});return a});var z="font fontSize textAlign textIndent lineHeight letterSpacing whiteSpace overflowWrap color".split(" "),R="text textIndent font fontSize lineHeight letterSpacing whiteSpace overflowWrap".split(" "),ka=function(){},G=function(b){function a(a){b.call(this,a);a=this.threeObject;a._actuallySync=a.sync;a.sync=ka}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.offsetLeft,c=this.offsetTop;if(null!==
this.offsetWidth){var g=this.parentFlexNode;this.x=a-g.scrollLeft;this.y=-(c-g.scrollTop);a=this.clipRect||(this.clipRect=[0,0,0,0]);a[0]=this.clipLeft;a[1]=-this.clipBottom;a[2]=this.clipRight;a[3]=-this.clipTop;this.threeObject.visible=!this.isFullyClipped}a=this._flexStyles;c=0;for(g=R.length;c<g;c++){var h=R[c];("text"===h?this.text:A(this,h))!==a[h]&&(a[h]=this[h],this.needsFlexLayout=!0)}b.prototype.afterUpdate.call(this)};a.prototype.onAfterFlexLayoutApplied=function(){this.threeObject.maxWidth=
this.offsetWidth;this.threeObject._actuallySync(this._afterSync)};a.prototype.getBoundingSphere=function(){return null};return a}(F.Text3DFacade);G=y(G);z.forEach(function(b){G.prototype[b]="inherit"});Object.defineProperty(G.prototype,"maxWidth",{value:Infinity,enumerable:!0,writable:!0});var la=G,ma=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),S=new e.MeshBasicMaterial({color:0}),na=Object.freeze(new e.Vector2),T=Object.freeze(new e.Vector4(0,0,0,0)),oa={customDepthMaterial:{get:function(){return this.material.getDepthMaterial()}},
customDistanceMaterial:{get:function(){return this.material.getDistanceMaterial()}}},U=new Map,V=function(b){function a(a){b.call(this,a);this._colorObj=new e.Color;this.size=na;this.borderWidth=this.borderRadius=T;this.color=0;this.isBorder=!1;this.material=S}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.material,c=this.depthOffset,g=this.castShadow,h=this.receiveShadow,f=this.color,p=this.renderOrder;a||(a=S);
c=a.id+"|"+p+"|"+c+"|"+g+"|"+h;if(c!==this._prevMeshKey){var k=U.get(c);if(!k){var l=da(a);l.instanceUniforms=["diffuse","uTroikaBlockSize","uTroikaClipRect","uTroikaCornerRadii","uTroikaBorderWidth"];l.polygonOffset=!!this.depthOffset;l.polygonOffsetFactor=l.polygonOffsetUnits=this.depthOffset||0;a.addEventListener("dispose",function v(){a.removeEventListener("dispose",v);l.dispose()});k=new e.Mesh(ma,l);k._instanceKey=c;k.castShadow=g;k.receiveShadow=h;k.renderOrder=p;Object.defineProperties(k,
oa);U.set(c,k)}this.instancedThreeObject=k;this._prevMeshKey=c}this.setInstanceUniform("uTroikaBlockSize",this.size);this.setInstanceUniform("uTroikaCornerRadii",this.borderRadius);this.setInstanceUniform("uTroikaClipRect",this.clipRect);this.setInstanceUniform("uTroikaBorderWidth",this.isBorder?this.borderWidth:T);f!==this._lastColor&&(this._lastColor=f,this.setInstanceUniform("diffuse",new e.Color(f)));b.prototype.afterUpdate.call(this)};a.prototype.getBoundingSphere=function(){return null};return a}(u.Instanceable3DFacade),
W,X=function(b){function a(a){var c=new e.Mesh(W||(W=(new e.CylinderBufferGeometry(.5,.5,1,8)).translate(0,-.5,0)),new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}));b.call(this,a,c);this.length=this.girth=0}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.scaleX=this.scaleZ=this.girth;this.scaleY=this.length;this.rotateZ=this.horizontal?Math.PI/2:0;this.threeObject.material.opacity=this.opacity;b.prototype.afterUpdate.call(this)};
return a}(u.Object3DFacade),O=new WeakMap,Y={opacity:{duration:300}},pa=function(b){function a(a){var c=this;b.call(this,a);this._onOver=function(a){c.hovering=!0;c.afterUpdate()};this._onOut=function(a){c.hovering=!1;c.afterUpdate()}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var d={target:{configurable:!0}};d.target.set=function(a){var c=O.get(this);a!==c&&(c&&(c.removeEventListener("mouseover",this._onOver),c.removeEventListener("mouseout",this._onOut)),
a&&(a.addEventListener("mouseover",this._onOver),a.addEventListener("mouseout",this._onOut)),O.set(this,a))};d.target.get=function(){return O.get(this)};a.prototype.describeChildren=function(){var a=this.target,b=this._childArr||(this._childArr=[]);b.length=0;if(a){var d=a.offsetWidth,f=a.offsetHeight,p=a.scrollHeight,e=a.scrollWidth,l=a.clientWidth,m=a.clientHeight,v=a.getComputedFontSize();if(e>l){var r=this._hDef||(this._hDef={key:"h",facade:X,horizontal:!0,transition:Y});r.girth=Math.min(v/4,
f/10);r.length=Math.max(l*l/e,v);r.x=a.clientLeft+a.scrollLeft/(e-l)*(l-r.length);r.y=-f;r.opacity=this.hovering?.5:0;r.renderOrder=this.renderOrder;b.push(r)}p>m&&(f=this._vDef||(this._vDef={key:"v",facade:X,transition:Y}),f.girth=Math.min(v/4,d/10),f.length=Math.max(m*m/p,v),f.x=d,f.y=-(a.clientTop+a.scrollTop/(p-m)*(m-f.length)),f.opacity=this.hovering?.5:0,f.renderOrder=this.renderOrder,b.push(f))}return b};a.prototype.destructor=function(){this.target=null;b.prototype.destructor.call(this)};
Object.defineProperties(a.prototype,d);return a}(u.ParentFacade),Z=new e.Mesh((new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0)),Q=new e.Matrix4,C=new e.Vector4(0,0,0,0),qa=Object.freeze(new e.Vector4(0,0,0,0)),fa=new e.Plane,ra={get:function(){return!this._priv_hidden&&!this.$facade.isFullyClipped},set:function(b){this._priv_hidden=!b}},I=function(b){function a(a){b.call(this,a);Object.defineProperty(this.threeObject,"visible",ra);this.layers=new b(this);this.layers.children=[null,null,null];
this._sizeVec2=Object.freeze(new e.Vector2);this._borderRadiiVec4=this._borderWidthVec4=this._clipRectVec4=qa;(this._geomBoundingSphere=new e.Sphere).version=0;this._wasFullyClipped=!0}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.updateChildren=function(a){this.isFullyClipped&&this._wasFullyClipped||b.prototype.updateChildren.call(this,a)};a.prototype.updateMatrices=function(){b.prototype.updateMatrices.call(this);this.layers.traverse(ha)};a.prototype.afterUpdate=
function(){var a=this.layers,c=this.backgroundColor,g=this.backgroundMaterial,h=this.borderWidth,f=this.borderColor,p=this.borderMaterial,k=this.text,l=this.offsetLeft,m=this.offsetTop,v=this.offsetWidth,r=this.offsetHeight,n=this.parentFlexNode,t=this.flexNodeDepth,q=this.isFullyClipped,w=this._wasFullyClipped,u=this._borderWidthVec4,x=this._clipRectVec4,y=this._sizeVec2,z=null!==v,B=!(!v||!r),D=B&&!q&&(null!=c||null!=g),E=B&&!q&&(null!=f||null!=p)&&0<Math.max.apply(Math,h);B=B&&("scroll"===this.overflow||
"auto"===this.overflow)&&(this.scrollHeight>this.clientHeight||this.scrollWidth>this.clientWidth);z&&(n&&(z="absolute"===this.position,this.x=l-(z?0:n.scrollLeft),this.y=-(m-(z?0:n.scrollTop))),v!==y.x||r!==y.y)&&(y=this._sizeVec2=Object.freeze(new e.Vector2(v,r)),l=this._geomBoundingSphere,l.radius=Math.sqrt(v*v/4+r*r/4),l.center.set(v/2,-r/2,0),l.version++);if(!q||!w)if(l=D||E?this._normalizeBorderRadius():null,C.fromArray(h),C.equals(u)||(u=this._borderWidthVec4=Object.freeze(C.clone())),C.set(Math.max(this.clipLeft,
0),Math.max(this.clipTop,0),Math.min(this.clipRight,v),Math.min(this.clipBottom,r)),C.equals(x)||(x=this._clipRectVec4=Object.freeze(C.clone())),h=null,D&&(h=this._bgLayerDef||(this._bgLayerDef={key:"bg",facade:V}),h.size=y,h.color=c,h.borderRadius=l,h.material=g,h.clipRect=x,h.depthOffset=-t,h.renderOrder=t,h.castShadow=this.castShadow,h.receiveShadow=this.receiveShadow),a.children[0]=h,c=null,E&&(c=this._borderLayerDef||(this._borderLayerDef={key:"border",facade:V,isBorder:!0}),c.size=y,c.color=
f,c.borderWidth=u,c.borderRadius=l,c.material=p,c.clipRect=x,c.depthOffset=-t-1,c.renderOrder=t+1,c.castShadow=this.castShadow,c.receiveShadow=this.receiveShadow),a.children[1]=c,f=null,B&&(f=this._scrollbarsDef||(this._scrollbarsDef={key:"sb",facade:pa,target:this}),f.renderOrder=t+2),a.children[2]=f,!k&&N(this.children)&&(k=""+this.children),k)f=this._textChildDef||(this._textChildDef={key:"text",facade:la}),f.text=k,f.font=A(this,"font"),f.fontSize=this.getComputedFontSize(),f.textAlign=A(this,
"textAlign"),f.textIndent=A(this,"textIndent"),f.lineHeight=A(this,"lineHeight","normal"),f.letterSpacing=A(this,"letterSpacing",0),f.whiteSpace=A(this,"whiteSpace"),f.overflowWrap=A(this,"overflowWrap"),f.color=A(this,"color"),f.colorRanges=this.colorRanges,f.outlineWidth=this.textOutlineWidth||0,f.outlineColor=this.textOutlineColor,f.outlineOpacity=this.textOutlineOpacity,f.outlineBlur=this.textOutlineBlur||0,f.outlineOffsetX=this.textOutlineOffsetX||0,f.outlineOffsetY=this.textOutlineOffsetY||
0,f.strokeWidth=this.textStrokeWidth||0,f.strokeColor=this.textStrokeColor,f.strokeOpacity=this.textStrokeOpacity,f.fillOpacity=this.textFillOpacity,f.material=this.textMaterial,f.depthOffset=-t-1,f.renderOrder=t+1,f.castShadow=this.castShadow,f.receiveShadow=this.receiveShadow,this._actualChildren=f;else{k=this.children;if(Array.isArray(k))for(t=0,f=k.length;t<f;t++)if(N(k[t])){for(k=k.slice();t<f;t++)N(k[t])&&(k[t]={facade:sa,text:""+k[t],textMaterial:this.textMaterial});break}this._actualChildren=
k}B!==this._couldScroll&&(this._couldScroll=B,this[(B?"add":"remove")+"EventListener"]("wheel",ea),this[(B?"add":"remove")+"EventListener"]("dragstart",P),this[(B?"add":"remove")+"EventListener"]("drag",P));b.prototype.afterUpdate.call(this);q&&w||a.afterUpdate();this._wasFullyClipped=q};a.prototype.describeChildren=function(){return this._actualChildren};a.prototype.getComputedFontSize=function(){return H(this,16)};a.prototype._normalizeBorderRadius=function(){var a=this.borderRadius,b=this.offsetWidth;
void 0===b&&(b=0);var g=this.offsetHeight;void 0===g&&(g=0);var h=this._borderRadiiVec4;if(Array.isArray(a)){var f=a.length;var e=a[0]||0;var k=(1<f?a[1]:a[0])||0;var l=(2<f?a[2]:a[0])||0;a=(3<f?a[3]:1<f?a[1]:a[0])||0}else e=k=l=a=a||0;if(0!==e||0!==k||0!==l||0!==a)f=Math.min(b,g),"string"===typeof e&&/%$/.test(e)&&(e=parseInt(e,10)/100*f),"string"===typeof k&&/%$/.test(k)&&(k=parseInt(k,10)/100*f),"string"===typeof a&&/%$/.test(a)&&(a=parseInt(a,10)/100*f),"string"===typeof l&&/%$/.test(l)&&(l=parseInt(l,
10)/100*f),b=Math.min(b/(e+k),g/(k+l),b/(l+a),g/(a+e)),1>b&&(e*=b,k*=b,a*=b,l*=b);C.set(e,k,l,a);C.equals(h)||(h=this._borderRadiiVec4=Object.freeze(C.clone()));return h};a.prototype._getGeometryBoundingSphere=function(){return this._geomBoundingSphere.radius&&!this.isFullyClipped?this._geomBoundingSphere:null};a.prototype.raycast=function(a){var b=this,d=this.offsetWidth,h=this.offsetHeight,f=this.clipTop,e=this.clipRight,k=this.clipBottom,l=this.clipLeft,m=null;d&&h&&(Z.matrixWorld.multiplyMatrices(this.threeObject.matrixWorld,
Q.makeScale(d,h,1)),m=this._raycastObject(Z,a))&&(m=m.filter(function(a){var b=a.uv.x*d;a=(1-a.uv.y)*h;return b>l&&b<e&&a>f&&a<k}),m.forEach(function(a){a.distance=parseFloat(a.distance.toFixed(12));a.distanceBias=-b.flexNodeDepth}));return m&&m.length?m:null};a.prototype.destructor=function(){this.layers.destructor();b.prototype.destructor.call(this)};return a}(u.Group3DFacade),sa=I=y(I);z.forEach(function(b){I.prototype[b]="inherit"});var w=I,ta=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,
0),ua=new e.MeshBasicMaterial,va=new e.TextureLoader;F=function(b){function a(a,c){c=new e.Mesh(ta,ua.clone());c.visible=!1;b.call(this,a,c)}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this,c=this.offsetLeft,g=this.offsetTop,h=this.offsetWidth,f=this.offsetHeight,e=this.src,k=this.threeObject,l=k.material,m=!(!h||!f);m&&(this.x=c,this.y=-g,this.scaleX=h,this.scaleY=f,c=this.flexNodeDepth,l.polygonOffset=!!c,l.polygonOffsetFactor=
l.polygonOffsetUnits=-c||0,k.renderOrder=c);e!==this._lastSrc&&(va.load(e,function(b){l.map&&l.map.dispose();l.map=b;a.aspectRatio=b.image.width/b.image.height;a.afterUpdate();a.notifyWorld("needsRender")}),this._lastSrc=e);k.visible=!!(m&&l.map&&l.map.image.complete);b.prototype.afterUpdate.call(this)};a.prototype.destructor=function(){var a=this.threeObject.material.map;a&&a.dispose();b.prototype.destructor.call(this)};return a}(u.Object3DFacade);F=y(F);var aa=function(b){function a(a){b.call(this,
a);this.font="https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.woff"}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var d={icon:{configurable:!0},size:{configurable:!0}};d.icon.set=function(a){this.text=a};d.size.set=function(a){this.fontSize=a};Object.defineProperties(a.prototype,d);return a}(w);z=function(b){function a(a){var c=this;b.call(this,a);this.justifyContent="center";this.fontSize="150%";this.onClick=function(a){c.onUpdate(!c.value)}}
b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.icon=this.value?"check_box":"check_box_outline_blank";b.prototype.afterUpdate.call(this)};return a}(aa);var wa=function(b){function a(a){b.call(this,a);this.children={facade:b,borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],alignItems:"center",justifyContent:"center",pointerStates:{hover:{backgroundColor:6710988}}}}b&&(a.__proto__=b);a.prototype=Object.create(b&&
b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.children.text=this.label||"Missing label";b.prototype.afterUpdate.call(this)};return a}(w),q=new e.Color,J=new e.Plane,ba=(new e.CylinderBufferGeometry(.5,.5,1,45)).translate(0,.5,0).rotateX(Math.PI/2).rotateZ(Math.PI/2),ca=M.createDerivedMaterial(new e.MeshBasicMaterial({side:2}),{uniforms:{maxValue:{value:1}},vertexDefs:"\nvarying vec3 vPos;\n",vertexMainIntro:"\nvPos = position;\n",fragmentDefs:"\nuniform float maxValue;\nvarying vec3 vPos;\n\n// From https://github.com/hughsk/glsl-hsv2rgb\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n",
fragmentColorTransform:"\nfloat angle = atan(vPos.y, vPos.x) / PI2;\nfloat radius = length(vPos.xy) * 2.0;\nfloat value = vPos.z * maxValue;\nvec3 hsv = vec3(angle, radius, value);\nvec3 rgb = hsv2rgb(hsv);\ngl_FragColor.xyz = rgb;\n"}),xa=function(b){function a(a){b.call(this,a,new e.Mesh(ba,ca.clone()));this.maxValue=1}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.uniforms.maxValue.value=this.maxValue;
b.prototype.afterUpdate.call(this)};return a}(u.Object3DFacade),ya=function(b){function a(a){var c=ca.clone();c.transparent=!0;c.opacity=.5;c.side=e.BackSide;b.call(this,a,new e.Mesh(ba,c))}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);return a.prototype.constructor=a}(u.Object3DFacade),za=function(b){function a(a){var c=(new e.SphereBufferGeometry(.05,16,12)).translate(0,0,.5),d=(new e.CylinderBufferGeometry(.005,.005,.5,6)).translate(0,.25,0).rotateX(Math.PI/2),h=new e.MeshBasicMaterial;
c=new e.Mesh(c,h);c.add(new e.Mesh(d,new e.MeshBasicMaterial({color:13421772})));b.call(this,a,c)}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.color.set(this.color);b.prototype.afterUpdate.call(this)};return a}(u.Object3DFacade),Aa=function(b){function a(a){var c=O.createDerivedMaterial(new e.MeshBasicMaterial({transparent:!0,color:16777215,polygonOffset:!0,polygonOffsetFactor:1}),{vertexDefs:"varying vec2 vUV;",
c=new e.Mesh(c,h);c.add(new e.Mesh(d,new e.MeshBasicMaterial({color:13421772})));b.call(this,a,c)}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.color.set(this.color);b.prototype.afterUpdate.call(this)};return a}(u.Object3DFacade),Aa=function(b){function a(a){var c=M.createDerivedMaterial(new e.MeshBasicMaterial({transparent:!0,color:16777215,polygonOffset:!0,polygonOffsetFactor:1}),{vertexDefs:"varying vec2 vUV;",
vertexMainIntro:"vUV = uv;",fragmentDefs:"varying vec2 vUV;",fragmentColorTransform:"\n float dist = min(min(vUV.x, 1.0 - vUV.x), min(vUV.y, 1.0 - vUV.y));\n gl_FragColor.w *= 1.0 - 0.5 * smoothstep(0.0, 0.1, dist);\n "});b.call(this,a,new e.Mesh(new e.PlaneBufferGeometry,c))}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.opacity=this.opacity;b.prototype.afterUpdate.call(this)};

@@ -47,0 +48,0 @@ return a}(u.Object3DFacade),Ba=function(b){function a(a){var c=this;b.call(this,a);this.cylinderHeight=.5;this.cylinderDiameter=.75;this.rotateX=-Math.PI/4;a=function(a){var b=a.currentTarget.threeObject,d=a.ray;J.normal.set(0,0,-1);J.constant=1;J.applyMatrix4(b.matrixWorld);var g=d.intersectPlane(J,new e.Vector3);if(g){b.worldToLocal(g);d=2*g.x;g=2*g.y;for(b=Math.atan2(g,d)/Math.PI/2;0>b;)b+=1;d=Math.min(1,Math.sqrt(d*d+g*g));g=c._getHSV();g[0]=b;g[1]=d;c._updateHSV(g,a.shiftKey)}};this.onWheel=

{
"name": "troika-3d-ui",
"version": "0.38.0",
"version": "0.38.1",
"description": "Troika 3D User Interface Toolkit",

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

"object-path": "^0.11.4",
"troika-3d": "^0.38.0",
"troika-3d-text": "^0.38.0",
"troika-3d": "^0.38.1",
"troika-3d-text": "^0.38.1",
"troika-core": "^0.38.0",
"troika-flex-layout": "^0.38.0",
"troika-three-utils": "^0.38.0"
"troika-flex-layout": "^0.38.1",
"troika-three-utils": "^0.38.1"
},
"gitHead": "d48144bf99a2eaf2089c0cd2a8065506161dfdf4"
"gitHead": "b54fd6f27b4d95190747ff94cf4e101239447fea"
}

@@ -7,4 +7,4 @@ import { Mesh, Vector2, Vector3, Vector4, PlaneBufferGeometry, Sphere, Matrix4, Plane } from 'three'

import { getComputedFontSize, getInheritable, INHERITABLES } from '../uiUtils.js'
import { utils } from 'troika-core'
import ScrollbarsFacade from './ScrollbarsFacade.js'
import { invertMatrix4 } from 'troika-three-utils'

@@ -208,2 +208,13 @@ const raycastMesh = new Mesh(new PlaneBufferGeometry(1, 1).translate(0.5, -0.5, 0))

textChild.color = getInheritable(this, 'color')
textChild.colorRanges = this.colorRanges
textChild.outlineWidth = this.textOutlineWidth || 0
textChild.outlineColor = this.textOutlineColor
textChild.outlineOpacity = this.textOutlineOpacity
textChild.outlineBlur = this.textOutlineBlur || 0
textChild.outlineOffsetX = this.textOutlineOffsetX || 0
textChild.outlineOffsetY = this.textOutlineOffsetY || 0
textChild.strokeWidth = this.textStrokeWidth || 0
textChild.strokeColor = this.textStrokeColor
textChild.strokeOpacity = this.textStrokeOpacity
textChild.fillOpacity = this.textFillOpacity
textChild.material = this.textMaterial

@@ -421,3 +432,3 @@ textChild.depthOffset = -flexNodeDepth - 1

const facade = e.currentTarget
const ray = e.ray.clone().applyMatrix4(tempMat4.getInverse(facade.threeObject.matrixWorld))
const ray = e.ray.clone().applyMatrix4(invertMatrix4(facade.threeObject.matrixWorld, tempMat4))
const localPos = ray.intersectPlane(tempPlane.setComponents(0, 0, 1, 0), new Vector3())

@@ -424,0 +435,0 @@ const prevPos = facade._prevDragPos

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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