three-globe
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -739,3 +739,3 @@ 'use strict'; | ||
}, | ||
// how many slice segments in the tube's circumference | ||
// how many straight segments in the curve | ||
arcCircularResolution: { | ||
@@ -742,0 +742,0 @@ default: 6, |
@@ -1,2 +0,2 @@ | ||
// Version 1.2.0 three-globe - https://github.com/vasturiano/three-globe | ||
// Version 1.3.0 three-globe - https://github.com/vasturiano/three-globe | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("three")):"function"==typeof define&&define.amd?define(["three"],e):(t=t||self).ThreeGlobe=e(t.THREE)}(this,function(t){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n(function(t,e){"undefined"!=typeof self&&self,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){var r,i,a,o;o=function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.stateInit,n=void 0===e?function(){return{}}:e,r=t.props,s=void 0===r?{}:r,u=t.methods,c=void 0===u?{}:u,l=t.aliases,f=void 0===l?{}:l,h=t.init,d=void 0===h?function(){}:h,p=t.update,g=void 0===p?function(){}:p,b=Object.keys(s).map(function(t){return new o(t,s[t])});return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},n instanceof Function?n(t):n,{initialised:!1});function r(e){return o(e,t),s(),r}var o=function(t,n){d.call(r,t,e,n),e.initialised=!0},s=(0,i.default)(function(){e.initialised&&g.call(r,e)},1);return b.forEach(function(t){r[t.name]=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t,e){};return function(a){var o=e[t];return arguments.length?(e[t]=a,i.call(r,a,e,o),n&&s(),r):o}}(t.name,t.triggerUpdate,t.onChange)}),Object.keys(c).forEach(function(t){r[t]=function(){for(var n,i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return(n=c[t]).call.apply(n,[r,e].concat(a))}}),Object.entries(f).forEach(function(t){var e=a(t,2),n=e[0],i=e[1];return r[n]=r[i]}),r.resetProps=function(){return b.forEach(function(t){r[t.name](t.defaultVal)}),r},r.resetProps(),e._rerender=s,r}};var r,i=(r=n)&&r.__esModule?r:{default:r},a=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function t(e,n){var r=n.default,i=void 0===r?null:r,a=n.triggerUpdate,o=void 0===a||a,s=n.onChange,u=void 0===s?function(t,e){}:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=i,this.triggerUpdate=o,this.onChange=u};t.exports=e.default},i=[t,e,n(1)],void 0===(a="function"==typeof(r=o)?r.apply(e,i):r)||(t.exports=a)},function(t,e){t.exports=function(t,e,n){var r,i,a,o,s;function u(){var c=Date.now()-o;c<e&&c>=0?r=setTimeout(u,e-c):(r=null,n||(s=t.apply(a,i),a=i=null))}null==e&&(e=100);var c=function(){a=this,i=arguments,o=Date.now();var c=n&&!r;return r||(r=setTimeout(u,e)),c&&(s=t.apply(a,i),a=i=null),s};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(s=t.apply(a,i),a=i=null,clearTimeout(r),r=null)},c}}])}),i=e(r),a=(r.Kapsule,n(function(t,e){var n=function(){this._tweens={},this._tweensAddedDuringUpdate={}};n.prototype={getAll:function(){return Object.keys(this._tweens).map(function(t){return this._tweens[t]}.bind(this))},removeAll:function(){this._tweens={}},add:function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},remove:function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},update:function(t,e){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(t=void 0!==t?t:i.now();n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var a=this._tweens[n[r]];a&&!1===a.update(t)&&(a._isPlaying=!1,e||delete this._tweens[n[r]])}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var r,i=new n;i.Group=n,i._nextId=0,i.nextId=function(){return i._nextId++},"undefined"==typeof window&&"undefined"!=typeof process&&process.hrtime?i.now=function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?i.now=window.performance.now.bind(window.performance):void 0!==Date.now?i.now=Date.now:i.now=function(){return(new Date).getTime()},i.Tween=function(t,e){this._object=t,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=i.Easing.Linear.None,this._interpolationFunction=i.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=e||i,this._id=i.nextId()},i.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(t,e){return this._valuesEnd=t,void 0!==e&&(this._duration=e),this},start:function(t){for(var e in this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=void 0!==t?"string"==typeof t?i.now()+parseFloat(t):t:i.now(),this._startTime+=this._delayTime,this._valuesEnd){if(this._valuesEnd[e]instanceof Array){if(0===this._valuesEnd[e].length)continue;this._valuesEnd[e]=[this._object[e]].concat(this._valuesEnd[e])}void 0!==this._object[e]&&(this._valuesStart[e]=this._object[e],this._valuesStart[e]instanceof Array==!1&&(this._valuesStart[e]*=1),this._valuesStartRepeat[e]=this._valuesStart[e]||0)}return this},stop:function(){return this._isPlaying?(this._group.remove(this),this._isPlaying=!1,null!==this._onStopCallback&&this._onStopCallback(this._object),this.stopChainedTweens(),this):this},end:function(){return this.update(this._startTime+this._duration),this},stopChainedTweens:function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop()},group:function(t){return this._group=t,this},delay:function(t){return this._delayTime=t,this},repeat:function(t){return this._repeat=t,this},repeatDelay:function(t){return this._repeatDelayTime=t,this},yoyo:function(t){return this._yoyo=t,this},easing:function(t){return this._easingFunction=t,this},interpolation:function(t){return this._interpolationFunction=t,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(t){return this._onStartCallback=t,this},onUpdate:function(t){return this._onUpdateCallback=t,this},onComplete:function(t){return this._onCompleteCallback=t,this},onStop:function(t){return this._onStopCallback=t,this},update:function(t){var e,n,r;if(t<this._startTime)return!0;for(e in!1===this._onStartCallbackFired&&(null!==this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(t-this._startTime)/this._duration,n=0===this._duration||n>1?1:n,r=this._easingFunction(n),this._valuesEnd)if(void 0!==this._valuesStart[e]){var i=this._valuesStart[e]||0,a=this._valuesEnd[e];a instanceof Array?this._object[e]=this._interpolationFunction(a,r):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?i+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[e]=i+(a-i)*r))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object),1===n){if(this._repeat>0){for(e in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[e]&&(this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(this._valuesEnd[e])),this._yoyo){var o=this._valuesStartRepeat[e];this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=o}this._valuesStart[e]=this._valuesStartRepeat[e]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,u=this._chainedTweens.length;s<u;s++)this._chainedTweens[s].start(this._startTime+this._duration);return!1}return!0}},i.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-i.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*i.Easing.Bounce.In(2*t):.5*i.Easing.Bounce.Out(2*t-1)+.5}}},i.Interpolation={Linear:function(t,e){var n=t.length-1,r=n*e,a=Math.floor(r),o=i.Interpolation.Utils.Linear;return e<0?o(t[0],t[1],r):e>1?o(t[n],t[n-1],n-r):o(t[a],t[a+1>n?n:a+1],r-a)},Bezier:function(t,e){for(var n=0,r=t.length-1,a=Math.pow,o=i.Interpolation.Utils.Bernstein,s=0;s<=r;s++)n+=a(1-e,r-s)*a(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,a=Math.floor(r),o=i.Interpolation.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(a=Math.floor(r=n*(1+e))),o(t[(a-1+n)%n],t[a],t[(a+1)%n],t[(a+2)%n],r-a)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[a?a-1:0],t[a],t[n<a+1?n:a+1],t[n<a+2?n:a+2],r-a)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=i.Interpolation.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var n=t;n>1;n--)e*=n;return r[t]=e,e}),CatmullRom:function(t,e,n,r,i){var a=.5*(n-t),o=.5*(r-e),s=i*i;return(2*e-2*n+a+o)*(i*s)+(-3*e+3*n-2*a-o)*s+a*i+e}}},t.exports=i}));const o=t=>{t instanceof Array?t.forEach(o):(t.map&&t.map.dispose(),t.dispose())},s=t=>{t.geometry&&t.geometry.dispose(),t.material&&o(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(s)},u=t=>{for(;t.children.length;){const e=t.children[0];t.remove(e),s(e)}};function c(t,e){const n=new e;return{linkProp:function(e){return{default:n[e](),onChange(n,r){r[t][e](n)},triggerUpdate:!1}},linkMethod:function(e){return function(n,...r){const i=n[t],a=i[e](...r);return a===i?this:a}}}}const l=100;function f(t,e,n=0){const r=(90-t)*Math.PI/180,i=(90-e)*Math.PI/180,a=l*(1+n);return{x:a*Math.sin(r)*Math.cos(i),y:a*Math.cos(r),z:a*Math.sin(r)*Math.sin(i)}}function h(){return new d}function d(){this.reset()}d.prototype={constructor:d,reset:function(){this.s=this.t=0},add:function(t){g(p,t,this.t),g(this,p.s,this.s),this.s?this.t+=p.t:this.s=p.t},valueOf:function(){return this.s}};var p=new d;function g(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var b=1e-6,_=Math.PI,v=_/2,m=180/_,y=_/180,w=Math.abs,M=Math.atan2,x=Math.cos,A=Math.ceil,O=Math.sin,S=Math.sqrt;function k(t){return(t=O(t/2))*t}function C(){}function T(t,e){t&&E.hasOwnProperty(t.type)&&E[t.type](t,e)}var j={Feature:function(t,e){T(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)T(n[r].geometry,e)}},E={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){I(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)I(n[r],e,0)},Polygon:function(t,e){L(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)L(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)T(n[r],e)}};function I(t,e,n){var r,i=-1,a=t.length-n;for(e.lineStart();++i<a;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function L(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)I(t[n],e,1);e.polygonEnd()}h(),h(),h(),h();function P(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var R,F;1===(R=P).length&&(F=R,R=function(t,e){return P(F(t),e)});function D(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a}var U,H,G,B=h(),N={sphere:C,point:C,lineStart:function(){N.point=z,N.lineEnd=q},lineEnd:C,polygonStart:C,polygonEnd:C};function q(){N.point=N.lineEnd=C}function z(t,e){U=t*=y,H=O(e*=y),G=x(e),N.point=V}function V(t,e){t*=y;var n=O(e*=y),r=x(e),i=w(t-U),a=x(i),o=r*O(i),s=G*n-H*r*a,u=H*n+G*r*a;B.add(M(S(o*o+s*s),u)),U=t,H=n,G=r}function Q(t){return B.reset(),function(t,e){t&&j.hasOwnProperty(t.type)?j[t.type](t,e):T(t,e)}(t,N),+B}var $=[null,null],J={type:"LineString",coordinates:$};function X(t,e,n){var r=D(t,e-b,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function K(t,e,n){var r=D(t,e-b,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function W(){return function(){var t,e,n,r,i,a,o,s,u,c,l,f,h=10,d=h,p=90,g=360,_=2.5;function v(){return{type:"MultiLineString",coordinates:m()}}function m(){return D(A(r/p)*p,n,p).map(l).concat(D(A(s/g)*g,o,g).map(f)).concat(D(A(e/h)*h,t,h).filter(function(t){return w(t%p)>b}).map(u)).concat(D(A(a/d)*d,i,d).filter(function(t){return w(t%g)>b}).map(c))}return v.lines=function(){return m().map(function(t){return{type:"LineString",coordinates:t}})},v.outline=function(){return{type:"Polygon",coordinates:[l(r).concat(f(o).slice(1),l(n).reverse().slice(1),f(s).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],o=+t[1][1],r>n&&(t=r,r=n,n=t),s>o&&(t=s,s=o,o=t),v.precision(_)):[[r,s],[n,o]]},v.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),v.precision(_)):[[e,a],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(_=+h,u=X(a,i,90),c=K(e,t,_),l=X(s,o,90),f=K(r,n,_),v):_},v.extentMajor([[-180,-90+b],[180,90-b]]).extentMinor([[-180,-80-b],[180,80+b]])}()()}function Y(t,e){var n,r=t[0]*y,i=t[1]*y,a=e[0]*y,o=e[1]*y,s=x(i),u=O(i),c=x(o),l=O(o),f=s*x(r),h=s*O(r),d=c*x(a),p=c*O(a),g=2*((n=S(k(o-i)+s*c*k(a-r)))>1?v:n<-1?-v:Math.asin(n)),b=O(g),_=g?function(t){var e=O(t*=g)/b,n=O(g-t)/b,r=n*f+e*d,i=n*h+e*p,a=n*u+e*l;return[M(i,r)*m,M(a,S(r*r+i*i))*m]}:function(){return[r*m,i*m]};return _.distance=g,_}h(),h(),h();const Z=window.THREE?window.THREE:{Geometry:t.Geometry,Line:t.Line,LineBasicMaterial:t.LineBasicMaterial,ParticleSystem:t.ParticleSystem,ParticleSystemMaterial:t.ParticleSystemMaterial,Vector3:t.Vector3};function tt(t,e,n,r,i){i=i||window.scene;for(var a=[],o=[],s=[],u=function(t){var e=[];if("Feature"==t.type)e.push(t.geometry);else if("FeatureCollection"==t.type)for(var n=0;n<t.features.length;n++)e.push(t.features[n].geometry);else{if("GeometryCollection"!=t.type)throw new Error("The geoJSON is not valid.");for(var r=0;r<t.geometries.length;r++)e.push(t.geometries[r])}return e}(t),c=function(t){var e;if("sphere"==t)e=m;else{if("plane"!=t)throw new Error("The shape that you specified is not valid.");e=y}return e}(n),l=[],f=0;f<u.length;f++)if("Point"==u[f].type)c(u[f].coordinates,e),w(a[0],o[0],s[0],r);else if("MultiPoint"==u[f].type)for(var h=0;h<u[f].coordinates.length;h++)c(u[f].coordinates[h],e),w(a[0],o[0],s[0],r);else if("LineString"==u[f].type){l=g(u[f].coordinates);for(h=0;h<l.length;h++)c(l[h],e);M(a,o,s,r)}else if("Polygon"==u[f].type)for(var d=0;d<u[f].coordinates.length;d++){l=g(u[f].coordinates[d]);for(h=0;h<l.length;h++)c(l[h],e);M(a,o,s,r)}else if("MultiLineString"==u[f].type)for(d=0;d<u[f].coordinates.length;d++){l=g(u[f].coordinates[d]);for(h=0;h<l.length;h++)c(l[h],e);M(a,o,s,r)}else{if("MultiPolygon"!=u[f].type)throw new Error("The geoJSON is not valid.");for(var p=0;p<u[f].coordinates.length;p++)for(d=0;d<u[f].coordinates[p].length;d++){l=g(u[f].coordinates[p][d]);for(h=0;h<l.length;h++)c(l[h],e);M(a,o,s,r)}}function g(t){for(var e=[],n=[],r=0;r<t.length;r++){var i=t[r],a=t[r-1];if(r>0)if(b(a,i)){n=_(n=[a,i]);for(var o=0;o<n.length;o++)e.push(n[o])}else e.push(i);else e.push(i)}return e}function b(t,e){var n=e[0],r=e[1],i=t[0],a=t[1],o=Math.abs(n-i),s=Math.abs(r-a);return o>5||s>5}function _(t){for(var e,n,r=[],i=0;i<t.length-1;i++)e=t[i],b(n=t[i+1],e)?(r.push(e),r.push(v(e,n))):r.push(e);return r.push(t[t.length-1]),r.length>t.length?r=_(r):r}function v(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function m(t,e){var n=t[0],r=t[1];a.push(Math.cos(r*Math.PI/180)*Math.cos(n*Math.PI/180)*e),o.push(Math.cos(r*Math.PI/180)*Math.sin(n*Math.PI/180)*e),s.push(Math.sin(r*Math.PI/180)*e)}function y(t,e){var n=t[0],r=t[1];s.push(r/180*e),o.push(n/180*e)}function w(t,e,n,r){var a=new Z.Geometry;a.vertices.push(new Z.Vector3(t,e,n));var o=new Z.ParticleSystemMaterial(r),s=new Z.ParticleSystem(a,o);i.add(s),x()}function M(t,e,n,r){var a=new Z.Geometry;!function(t,e,n,r){for(var i=0;i<e.length;i++)t.vertices.push(new Z.Vector3(e[i],n[i],r[i]))}(a,t,e,n);var o=new Z.LineBasicMaterial(r),s=new Z.Line(a,o);i.add(s),x()}function x(){a.length=0,o.length=0,s.length=0}}const et=window.THREE?window.THREE:{AdditiveBlending:t.AdditiveBlending,BackSide:t.BackSide,Color:t.Color,Mesh:t.Mesh,MeshPhongMaterial:t.MeshPhongMaterial,Object3D:t.Object3D,ShaderMaterial:t.ShaderMaterial,SphereGeometry:t.SphereGeometry,TextureLoader:t.TextureLoader};var nt=i({props:{globeImageUrl:{onChange(t,e){e.globeNeedsUpdate=!0}},bumpImageUrl:{onChange(t,e){e.globeNeedsUpdate=!0}},showAtmosphere:{default:!0,onChange(t,e){e.atmosphereObj.visible=!!t},triggerUpdate:!1},showGraticules:{default:!1,onChange(t,e){e.graticulesObj.visible=!!t},triggerUpdate:!1}},stateInit:()=>{const t=new et.SphereGeometry(l,75,75),e=new et.Mesh(t,new et.MeshPhongMaterial({color:0}));let n,r;e.rotation.y=-Math.PI/2,e.__globeObjType="globe";{const e={vertex:["varying vec3 vNormal;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragment:["varying vec3 vNormal;","void main() {","float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );","gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;","}"].join("\n")},r=new et.ShaderMaterial({uniforms:{},vertexShader:e.vertex,fragmentShader:e.fragment,side:et.BackSide,blending:et.AdditiveBlending,transparent:!0});(n=new et.Mesh(t,r)).scale.set(1.1,1.1,1.1),n.__globeObjType="atmosphere"}return r=new et.Object3D,tt({geometry:W(),type:"Feature"},l,"sphere",{color:"lightgrey",transparent:!0,opacity:.1},r),r.rotation.x=Math.PI/2,{globeObj:e,atmosphereObj:n,graticulesObj:r}},init(t,e){u(t),e.scene=t,e.scene.add(e.globeObj),e.scene.add(e.atmosphereObj),e.scene.add(e.graticulesObj)},update(t){const e=t.globeObj.material;e.needsUpdate=!0,e.color=t.globeImageUrl?null:new et.Color(0),e.map=t.globeImageUrl?(new et.TextureLoader).load(t.globeImageUrl):null,e.bumpMap=t.bumpImageUrl?(new et.TextureLoader).load(t.bumpImageUrl):null}}),rt=n(function(t,e){t.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){var r,i,a;i=[t,e],void 0!==(a="function"==typeof(r=function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}},t.exports=e.default})?r.apply(e,i):r)&&(t.exports=a)}])}),it=e(rt),at=(rt.accessorFn,n(function(t){!function(e){var n=/^\s+/,r=/\s+$/,i=0,a=e.round,o=e.min,s=e.max,u=e.random;function c(t,u){if(u=u||{},(t=t||"")instanceof c)return t;if(!(this instanceof c))return new c(t,u);var l=function(t){var i={r:0,g:0,b:0},a=1,u=null,c=null,l=null,f=!1,h=!1;"string"==typeof t&&(t=function(t){t=t.replace(n,"").replace(r,"").toLowerCase();var e,i=!1;if(k[t])t=k[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=G.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=G.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=G.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=G.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=G.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=G.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=G.hex8.exec(t))return{r:I(e[1]),g:I(e[2]),b:I(e[3]),a:F(e[4]),format:i?"name":"hex8"};if(e=G.hex6.exec(t))return{r:I(e[1]),g:I(e[2]),b:I(e[3]),format:i?"name":"hex"};if(e=G.hex4.exec(t))return{r:I(e[1]+""+e[1]),g:I(e[2]+""+e[2]),b:I(e[3]+""+e[3]),a:F(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=G.hex3.exec(t))return{r:I(e[1]+""+e[1]),g:I(e[2]+""+e[2]),b:I(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(B(t.r)&&B(t.g)&&B(t.b)?(d=t.r,p=t.g,g=t.b,i={r:255*j(d,255),g:255*j(p,255),b:255*j(g,255)},f=!0,h="%"===String(t.r).substr(-1)?"prgb":"rgb"):B(t.h)&&B(t.s)&&B(t.v)?(u=P(t.s),c=P(t.v),i=function(t,n,r){t=6*j(t,360),n=j(n,100),r=j(r,100);var i=e.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),u=r*(1-(1-a)*n),c=i%6;return{r:255*[r,s,o,o,u,r][c],g:255*[u,r,r,s,o,o][c],b:255*[o,o,u,r,r,s][c]}}(t.h,u,c),f=!0,h="hsv"):B(t.h)&&B(t.s)&&B(t.l)&&(u=P(t.s),l=P(t.l),i=function(t,e,n){var r,i,a;function o(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(t=j(t,360),e=j(e,100),n=j(n,100),0===e)r=i=a=n;else{var s=n<.5?n*(1+e):n+e-n*e,u=2*n-s;r=o(u,s,t+1/3),i=o(u,s,t),a=o(u,s,t-1/3)}return{r:255*r,g:255*i,b:255*a}}(t.h,u,l),f=!0,h="hsl"),t.hasOwnProperty("a")&&(a=t.a));var d,p,g;return a=T(a),{ok:f,format:t.format||h,r:o(255,s(i.r,0)),g:o(255,s(i.g,0)),b:o(255,s(i.b,0)),a:a}}(t);this._originalInput=t,this._r=l.r,this._g=l.g,this._b=l.b,this._a=l.a,this._roundA=a(100*this._a)/100,this._format=u.format||l.format,this._gradientType=u.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=l.ok,this._tc_id=i++}function l(t,e,n){t=j(t,255),e=j(e,255),n=j(n,255);var r,i,a=s(t,e,n),u=o(t,e,n),c=(a+u)/2;if(a==u)r=i=0;else{var l=a-u;switch(i=c>.5?l/(2-a-u):l/(a+u),a){case t:r=(e-n)/l+(e<n?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:r,s:i,l:c}}function f(t,e,n){t=j(t,255),e=j(e,255),n=j(n,255);var r,i,a=s(t,e,n),u=o(t,e,n),c=a,l=a-u;if(i=0===a?0:l/a,a==u)r=0;else{switch(a){case t:r=(e-n)/l+(e<n?6:0);break;case e:r=(n-t)/l+2;break;case n:r=(t-e)/l+4}r/=6}return{h:r,s:i,v:c}}function h(t,e,n,r){var i=[L(a(t).toString(16)),L(a(e).toString(16)),L(a(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function d(t,e,n,r){return[L(R(r)),L(a(t).toString(16)),L(a(e).toString(16)),L(a(n).toString(16))].join("")}function p(t,e){e=0===e?0:e||10;var n=c(t).toHsl();return n.s-=e/100,n.s=E(n.s),c(n)}function g(t,e){e=0===e?0:e||10;var n=c(t).toHsl();return n.s+=e/100,n.s=E(n.s),c(n)}function b(t){return c(t).desaturate(100)}function _(t,e){e=0===e?0:e||10;var n=c(t).toHsl();return n.l+=e/100,n.l=E(n.l),c(n)}function v(t,e){e=0===e?0:e||10;var n=c(t).toRgb();return n.r=s(0,o(255,n.r-a(-e/100*255))),n.g=s(0,o(255,n.g-a(-e/100*255))),n.b=s(0,o(255,n.b-a(-e/100*255))),c(n)}function m(t,e){e=0===e?0:e||10;var n=c(t).toHsl();return n.l-=e/100,n.l=E(n.l),c(n)}function y(t,e){var n=c(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,c(n)}function w(t){var e=c(t).toHsl();return e.h=(e.h+180)%360,c(e)}function M(t){var e=c(t).toHsl(),n=e.h;return[c(t),c({h:(n+120)%360,s:e.s,l:e.l}),c({h:(n+240)%360,s:e.s,l:e.l})]}function x(t){var e=c(t).toHsl(),n=e.h;return[c(t),c({h:(n+90)%360,s:e.s,l:e.l}),c({h:(n+180)%360,s:e.s,l:e.l}),c({h:(n+270)%360,s:e.s,l:e.l})]}function A(t){var e=c(t).toHsl(),n=e.h;return[c(t),c({h:(n+72)%360,s:e.s,l:e.l}),c({h:(n+216)%360,s:e.s,l:e.l})]}function O(t,e,n){e=e||6,n=n||30;var r=c(t).toHsl(),i=360/n,a=[c(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,a.push(c(r));return a}function S(t,e){e=e||6;for(var n=c(t).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/e;e--;)o.push(c({h:r,s:i,v:a})),a=(a+s)%1;return o}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,i=this.toRgb();return t=i.r/255,n=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=T(t),this._roundA=a(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=a(360*t.h),n=a(100*t.s),r=a(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=l(this._r,this._g,this._b),e=a(360*t.h),n=a(100*t.s),r=a(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,r,i){var o=[L(a(t).toString(16)),L(a(e).toString(16)),L(a(n).toString(16)),L(R(r))];if(i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*j(this._r,255))+"%",g:a(100*j(this._g,255))+"%",b:a(100*j(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*j(this._r,255))+"%, "+a(100*j(this._g,255))+"%, "+a(100*j(this._b,255))+"%)":"rgba("+a(100*j(this._r,255))+"%, "+a(100*j(this._g,255))+"%, "+a(100*j(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),n=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var i=c(t);n="#"+d(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(_,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(m,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(O,arguments)},complement:function(){return this._applyCombination(w,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(M,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},c.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]="a"===r?t[r]:P(t[r]));t=n}return c(t,e)},c.equals=function(t,e){return!(!t||!e)&&c(t).toRgbString()==c(e).toRgbString()},c.random=function(){return c.fromRatio({r:u(),g:u(),b:u()})},c.mix=function(t,e,n){n=0===n?0:n||50;var r=c(t).toRgb(),i=c(e).toRgb(),a=n/100;return c({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})}, | ||
@@ -3,0 +3,0 @@ // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2) |
@@ -735,3 +735,3 @@ import { Geometry, Line, LineBasicMaterial, ParticleSystem, ParticleSystemMaterial, Vector3, AdditiveBlending, BackSide, Color, Mesh, MeshPhongMaterial, Object3D, ShaderMaterial, SphereGeometry, TextureLoader, CylinderGeometry, FaceColors, Matrix4, MeshBasicMaterial, MeshLambertMaterial, BufferGeometry, QuadraticBezierCurve3, TubeGeometry, Group } from 'three'; | ||
}, | ||
// how many slice segments in the tube's circumference | ||
// how many straight segments in the curve | ||
arcCircularResolution: { | ||
@@ -738,0 +738,0 @@ default: 6, |
{ | ||
"name": "three-globe", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Globe data visualization as a ThreeJS reusable 3D object", | ||
@@ -5,0 +5,0 @@ "unpkg": "dist/three-globe.min.js", |
@@ -9,3 +9,3 @@ # ThreeJS Globe Visualization | ||
Largely inspired by [WebGL Globe](https://experiments.withgoogle.com/chrome/globe), this is a [ThreeJS](https://threejs.org/) WebGL class to represent data visualization layers on a globe, using spherical projection. | ||
Largely inspired by [WebGL Globe](https://experiments.withgoogle.com/chrome/globe), this is a [ThreeJS](https://threejs.org/) WebGL class to represent data visualization layers on a globe, using a spherical projection. | ||
@@ -37,15 +37,62 @@ ## Quick start | ||
### Initialisation | ||
``` | ||
new ThreeGlobe({ configOptions })(<domElement>) | ||
``` | ||
| Config options | Description | Default | | ||
| --- | --- | :--: | | ||
| <b>animateIn</b>: <i>boolean</i> | Whether to animate the globe initialization, by scaling and rotating the globe into its inital position. | `true` | | ||
### Globe Layer | ||
| Method | Description | Default | | ||
| --- | --- | :--: | | ||
| <b>globeImageUrl</b>([<i>string</i>]) | Getter/setter for the URL of the image used in the material that wraps the globe. If no image is provided, the globe is represented as a black sphere. | `null` | | ||
| <b>pointsData</b>([<i>array</i>]) | Getter/setter for the list of points to represent in the points map layer. Each point is displayed as a cylindrical 3D object rising perpendicular from the surface of the globe. | `[]` | | ||
| <b>globeImageUrl</b>([<i>url</i>]) | Getter/setter for the URL of the image used in the material that wraps the globe. If no image is provided, the globe is represented as a black sphere. | `null` | | ||
| <b>bumpImageUrl</b>([<i>url</i>]) | Getter/setter for the URL of the image used to create a [bump map](https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.bumpMap) in the material, to represent the globe's terrain. | `null` | | ||
| <b>showAtmosphere</b>([<i>boolean</i>]) | Getter/setter for whether to show a bright halo surrounding the globe, representing the atmosphere. | `true` | | ||
| <b>showGraticules</b>([<i>boolean</i>]) | Getter/setter for whether to show a graticule grid demarking latitude and longitude lines at every 10 degrees. | `false` | | ||
### Points Layer | ||
| Method | Description | Default | | ||
| --- | --- | :--: | | ||
| <b>pointsData</b>([<i>array</i>]) | Getter/setter for the list of points to represent in the points map layer. Each point is displayed as a cylindrical 3D object rising perpendicularly from the surface of the globe. | `[]` | | ||
| <b>pointLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's center latitude coordinate. | `lat` | | ||
| <b>pointLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's center longitude coordinate. | `lat` | | ||
| <b>pointColor</b>([<i>str</i> or <i>fn</i>]) | Point object accessor function or attribute for the cylinder color. | `() => '#ffffaa'` | | ||
| <b>pointHeight</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's altitude in terms of globe radius units (`0` = 0 altitude (flat circle), `1` = globe radius). | `0.1` | | ||
| <b>pointAltitude</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's altitude in terms of globe radius units (`0` = 0 altitude (flat circle), `1` = globe radius). | `0.1` | | ||
| <b>pointRadius</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's radius, in angular degrees. | `0.25` | | ||
| <b>pointResolution</b>([<i>num</i>]) | Getter/setter for the radial geometric resolution of each cylinder, expressed in how many slice segments to divide the circumference. Higher values yield smoother cylinders. | 12 | | ||
| <b>pointsMerge</b>([<i>boolean</i>]) | Getter/setter for whether to merge all the point meshes into a single ThreeJS object, for improved rendering performance. Visually both options are equivalent, setting this option only affects the internal organization of the ThreeJS objects. | `false` | | ||
| <b>pointsTransitionDuration</b>([<i>num</i>]) | Getter/setter for duration (ms) of the transition to animate point changes involving geometry modifications. A value of `0` will move the objects immediately to their final position. New objects are animated by scaling them from the ground up. Only works if `pointsMerge=false`. | `1000` | | ||
### Arcs Layer | ||
| Method | Description | Default | | ||
| --- | --- | :--: | | ||
| <b>arcsData</b>([<i>array</i>]) | Getter/setter for the list of links to represent in the arcs map layer. Each link is displayed as an arc line that rises from the surface of the globe, connecting the start to the end coordinates. | `[]` | | ||
| <b>arcStartLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's start latitude coordinate. | `startLat` | | ||
| <b>arcStartLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's start longitude coordinate. | `startLng` | | ||
| <b>arcEndLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's end latitude coordinate. | `endLat` | | ||
| <b>arcEndLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's end longitude coordinate. | `endLng` | | ||
| <b>arcColor</b>([<i>str</i> or <i>fn</i>]) | Arc object accessor function or attribute for the line's color. | `() => '#ffffaa'` | | ||
| <b>arcAltitude</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the arc's maximum altitude (ocurring at the half-way distance between the two points) in terms of globe radius units (`0` = 0 altitude (ground line), `1` = globe radius). If a value of `null` or `undefined` is used, the altitude is automatically set proportionally to the distance between the two points, according to the scale set in `arcAltitudeAutoScale`. | `null` | | ||
| <b>arcAltitudeAutoScale</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the scale of the arc's automatic altitude, in terms of units of the great-arc distance between the two points. A value of `1` indicates the arc should be as high as its length on the ground. Only applicable if `arcAltitude` is not set. | `0.5` | | ||
| <b>arcStroke</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's diameter, in angular degrees. A value of `null` or `undefined` will render a [ThreeJS Line](https://threejs.org/docs/#api/objects/Line) whose width is constant (`1px`) regardless of the camera distance. Otherwise, a [TubeGeometry](https://threejs.org/docs/#api/en/geometries/TubeGeometry) is used. | `null` | | ||
| <b>arcCurveResolution</b>([<i>num</i>]) | Getter/setter for the arc's curve resolution, expressed in how many straight line segments to divide the curve by. Higher values yield smoother curves. | 64 | | ||
| <b>arcCircularResolution</b>([<i>num</i>]) | Getter/setter for the radial geometric resolution of each line, expressed in how many slice segments to divide the tube's circumference. Only applicable when using Tube geometries (defined `arcStroke`). | 6 | | ||
| <b>arcsTransitionDuration</b>([<i>num</i>]) | Getter/setter for duration (ms) of the transition to animate arc changes involving geometry modifications. A value of `0` will move the objects immediately to their final position. New arcs are animated by rising them from the ground up. | `1000` | | ||
### Custom Layer | ||
| Method | Description | Default | | ||
| --- | --- | :--: | | ||
| <b>customLayerData</b>([<i>array</i>]) | Getter/setter for the list of items to represent in the custom map layer. Each item is rendered according to the `customThreeObject` method. | `[]` | | ||
| <b>customThreeObject</b>([<i>Object3d</i>, <i>str</i> or <i>fn</i>]) | Object accessor function or attribute for generating a custom 3d object to render as part of the custom map layer. Should return an instance of [ThreeJS Object3d](https://threejs.org/docs/index.html#api/core/Object3D). | <b>customThreeObject</b>([<i>Object3d</i>, <i>str</i> or <i>fn</i>]) | Object accessor function or attribute for generating a custom 3d object to render as part of the custom map layer. Should return an instance of [ThreeJS Object3d](https://threejs.org/docs/index.html#api/core/Object3D). The callback method's signature includes the object item as well as the globe radius: `customThreeObject((item, globeRadius) => { ... })`. || `null` | | ||
| <b>getCoords</b>(<i>lat</i>, <i>lng</i> [,<i>altitude</i>]) | Utility method to translate spherical coordinates. Given a pair of latitude/longitude coordinates and optionally altitude (in terms of globe radius units), returns the equivalent `{x, y, z}` euclidean spatial coordinates. || | ||
| <b>customThreeObject</b>([<i>Object3d</i>, <i>str</i> or <i>fn</i>]) | Object accessor function or attribute for generating a custom 3d object to render as part of the custom map layer. Should return an instance of [ThreeJS Object3d](https://threejs.org/docs/index.html#api/core/Object3D). The callback method's signature includes the object item as well as the globe radius: `customThreeObject((item, globeRadius) => { ... })`. | `null` | | ||
### Utility | ||
| Method | Description | Default | | ||
| --- | --- | :--: | | ||
| <b>getCoords</b>(<i>lat</i>, <i>lng</i> [,<i>altitude</i>]) | Utility method to translate spherical coordinates. Given a pair of latitude/longitude coordinates and optionally altitude (in terms of globe radius units), returns the equivalent `{x, y, z}` cartesian spatial coordinates. || |
@@ -53,3 +53,3 @@ import { | ||
arcStroke: {}, // in deg | ||
arcCurveResolution: { default: 64, triggerUpdate: false }, // how many slice segments in the tube's circumference | ||
arcCurveResolution: { default: 64, triggerUpdate: false }, // how many straight segments in the curve | ||
arcCircularResolution: { default: 6, triggerUpdate: false }, // how many slice segments in the tube's circumference | ||
@@ -56,0 +56,0 @@ arcsTransitionDuration: { default: 1000, triggerUpdate: false } // ms |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3262052
96