@mappedin/dynamic-focus 6.0.1-beta.48 → 6.0.1-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/index.js +1 -1
- package/package.json +2 -2
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ct=Object.defineProperty,pt=Object.defineProperties;var _t=Object.getOwnPropertyDescriptors;var ut=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var ht=t=>{throw TypeError(t)};var J=(t,e,i)=>e in t?ct(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,W=(t,e)=>{for(var i in e||(e={}))vt.call(e,i)&&J(t,i,e[i]);if(ut)for(var i of ut(e))gt.call(e,i)&&J(t,i,e[i]);return t},Q=(t,e)=>pt(t,_t(e)),n=(t,e)=>ct(t,"name",{value:e,configurable:!0});var D=(t,e,i)=>J(t,typeof e!="symbol"?e+"":e,i),H=(t,e,i)=>e.has(t)||ht("Cannot "+i);var r=(t,e,i)=>(H(t,e,"read from private field"),i?i.call(t):e.get(t)),l=(t,e,i)=>e.has(t)?ht("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),g=(t,e,i,s)=>(H(t,e,"write to private field"),s?s.call(t,i):e.set(t,i),i),j=(t,e,i)=>(H(t,e,"access private method"),i);var p={env:{NODE_ENV:"production",npm_package_version:"6.0.1-beta.48"}};var mt="[MappedinJS]";function Et(t=""){let e="".concat(mt).concat(t?"-".concat(t):"");return{logState:p.env.NODE_ENV==="test"?3:0,log(...i){this.logState<=0&&console.log(e,...i)},warn(...i){this.logState<=1&&console.warn(e,...i)},error(...i){this.logState<=2&&console.error(e,...i)},assert(...i){console.assert(...i)},time(i){console.time(i)},timeEnd(i){console.timeEnd(i)},setLevel(i){0<=i&&i<=3&&(this.logState=i)}}}n(Et,"createLogger");var bt=Et();var w=bt;var tt=class tt extends Error{};n(tt,"InvalidTokenError");var X=tt;X.prototype.name="InvalidTokenError";function et(t,e,i,s){return(t<e||t>i)&&w.warn(s),Math.min(i,Math.max(e,t))}n(et,"clampWithWarning");function lt(t,e){if(t==null||e==null)return t===e;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}n(lt,"arraysEqual");var it=class it{constructor(){D(this,"_subscribers",{})}publish(e,i){!this._subscribers||!this._subscribers[e]||this._subscribers[e].forEach(function(s){typeof s=="function"&&s(i)})}on(e,i){this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(i)}off(e,i){if(!this._subscribers||this._subscribers[e]==null)return;let s=this._subscribers[e].indexOf(i);s!==-1&&this._subscribers[e].splice(s,1)}destroy(){this._subscribers={}}};n(it,"PubSub");var Z=it;var I=Object.freeze({Linear:Object.freeze({None:n(function(t){return t},"None"),In:n(function(t){return t},"In"),Out:n(function(t){return t},"Out"),InOut:n(function(t){return t},"InOut")}),Quadratic:Object.freeze({In:n(function(t){return t*t},"In"),Out:n(function(t){return t*(2-t)},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},"InOut")}),Cubic:Object.freeze({In:n(function(t){return t*t*t},"In"),Out:n(function(t){return--t*t*t+1},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},"InOut")}),Quartic:Object.freeze({In:n(function(t){return t*t*t*t},"In"),Out:n(function(t){return 1- --t*t*t*t},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},"InOut")}),Quintic:Object.freeze({In:n(function(t){return t*t*t*t*t},"In"),Out:n(function(t){return--t*t*t*t*t+1},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},"InOut")}),Sinusoidal:Object.freeze({In:n(function(t){return 1-Math.sin((1-t)*Math.PI/2)},"In"),Out:n(function(t){return Math.sin(t*Math.PI/2)},"Out"),InOut:n(function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))},"InOut")}),Exponential:Object.freeze({In:n(function(t){return t===0?0:Math.pow(1024,t-1)},"In"),Out:n(function(t){return t===1?1:1-Math.pow(2,-10*t)},"Out"),InOut:n(function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},"InOut")}),Circular:Object.freeze({In:n(function(t){return 1-Math.sqrt(1-t*t)},"In"),Out:n(function(t){return Math.sqrt(1- --t*t)},"Out"),InOut:n(function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},"InOut")}),Elastic:Object.freeze({In:n(function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},"In"),Out:n(function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},"Out"),InOut:n(function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)},"InOut")}),Back:Object.freeze({In:n(function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},"In"),Out:n(function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},"Out"),InOut:n(function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},"InOut")}),Bounce:Object.freeze({In:n(function(t){return 1-I.Bounce.Out(1-t)},"In"),Out:n(function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},"Out"),InOut:n(function(t){return t<.5?I.Bounce.In(t*2)*.5:I.Bounce.Out(t*2-1)*.5+.5},"InOut")}),generatePow:n(function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:n(function(e){return Math.pow(e,t)},"In"),Out:n(function(e){return 1-Math.pow(1-e,t)},"Out"),InOut:n(function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5},"InOut")}},"generatePow")}),$=n(function(){return performance.now()},"now"),st=function(){function t(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return n(t,"Group"),t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(i){return e._tweens[i]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var e,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];for(var o=0,u=i;o<u.length;o++){var a=u[o];(e=a._group)===null||e===void 0||e.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},t.prototype.remove=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var s=0,o=e;s<o.length;s++){var u=o[s];u._group=void 0,delete this._tweens[u.getId()],delete this._tweensAddedDuringUpdate[u.getId()]}},t.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},t.prototype.update=function(e,i){e===void 0&&(e=$()),i===void 0&&(i=!0);var s=Object.keys(this._tweens);if(s.length!==0)for(;s.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<s.length;o++){var u=this._tweens[s[o]],a=!i;u&&u.update(e,a)===!1&&!i&&this.remove(u)}s=Object.keys(this._tweensAddedDuringUpdate)}},t}(),N={Linear:n(function(t,e){var i=t.length-1,s=i*e,o=Math.floor(s),u=N.Utils.Linear;return e<0?u(t[0],t[1],s):e>1?u(t[i],t[i-1],i-s):u(t[o],t[o+1>i?i:o+1],s-o)},"Linear"),Bezier:n(function(t,e){for(var i=0,s=t.length-1,o=Math.pow,u=N.Utils.Bernstein,a=0;a<=s;a++)i+=o(1-e,s-a)*o(e,a)*t[a]*u(s,a);return i},"Bezier"),CatmullRom:n(function(t,e){var i=t.length-1,s=i*e,o=Math.floor(s),u=N.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(o=Math.floor(s=i*(1+e))),u(t[(o-1+i)%i],t[o],t[(o+1)%i],t[(o+2)%i],s-o)):e<0?t[0]-(u(t[0],t[0],t[1],t[1],-s)-t[0]):e>1?t[i]-(u(t[i],t[i],t[i-1],t[i-1],s-i)-t[i]):u(t[o?o-1:0],t[o],t[i<o+1?i:o+1],t[i<o+2?i:o+2],s-o)},"CatmullRom"),Utils:{Linear:n(function(t,e,i){return(e-t)*i+t},"Linear"),Bernstein:n(function(t,e){var i=N.Utils.Factorial;return i(t)/i(e)/i(t-e)},"Bernstein"),Factorial:function(){var t=[1];return function(e){var i=1;if(t[e])return t[e];for(var s=e;s>1;s--)i*=s;return t[e]=i,i}}(),CatmullRom:n(function(t,e,i,s,o){var u=(i-t)*.5,a=(s-e)*.5,h=o*o,d=o*h;return(2*e-2*i+u+a)*d+(-3*e+3*i-2*u-a)*h+u*o+e},"CatmullRom")}},ft=function(){function t(){}return n(t,"Sequence"),t.nextId=function(){return t._nextId++},t._nextId=0,t}(),rt=new st,dt=function(){function t(e,i){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=I.Linear.None,this._interpolationFunction=N.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ft.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=rt,rt.add(this))}return n(t,"Tween"),t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,i){if(i===void 0&&(i=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,i){if(e===void 0&&(e=$()),i===void 0&&(i=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var s in this._valuesStartRepeat)this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||i){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var u in this._valuesEnd)o[u]=this._valuesEnd[u];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,i)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,i,s,o,u){for(var a in s){var h=e[a],d=Array.isArray(h),y=d?"array":typeof h,v=!d&&Array.isArray(s[a]);if(!(y==="undefined"||y==="function")){if(v){var m=s[a];if(m.length===0)continue;for(var B=[h],M=0,q=m.length;M<q;M+=1){var G=this._handleRelativeValue(h,m[M]);if(isNaN(G)){v=!1,console.warn("Found invalid interpolation list. Skipping.");break}B.push(G)}v&&(s[a]=B)}if((y==="object"||d)&&h&&!v){i[a]=d?[]:{};var U=h;for(var T in U)i[a][T]=U[T];o[a]=d?[]:{};var m=s[a];if(!this._isDynamic){var at={};for(var T in m)at[T]=m[T];s[a]=m=at}this._setupProperties(U,i[a],m,o[a],u)}else(typeof i[a]>"u"||u)&&(i[a]=h),d||(i[a]*=1),v?o[a]=s[a].slice().reverse():o[a]=i[a]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=$()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=$()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,i=this._chainedTweens.length;e<i;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},t.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=I.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=N.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,i){var s=this,o;if(e===void 0&&(e=$()),i===void 0&&(i=t.autoStartOnUpdate),this._isPaused)return!0;var u;if(!this._goToEnd&&!this._isPlaying)if(i)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,h=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),d=this._duration+this._repeat*h,y=n(function(){if(s._duration===0||a>d)return 1;var G=Math.trunc(a/h),U=a-G*h,T=Math.min(U/s._duration,1);return T===0&&a===s._duration?1:T},"calculateElapsedPortion"),v=y(),m=this._easingFunction(v);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,m),this._onUpdateCallback&&this._onUpdateCallback(this._object,v),this._duration===0||a>=this._duration)if(this._repeat>0){var B=Math.min(Math.trunc((a-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=B);for(u in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[u]=="string"&&(this._valuesStartRepeat[u]=this._valuesStartRepeat[u]+parseFloat(this._valuesEnd[u])),this._yoyo&&this._swapEndStartRepeatValues(u),this._valuesStart[u]=this._valuesStartRepeat[u];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*B,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var M=0,q=this._chainedTweens.length;M<q;M++)this._chainedTweens[M].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,i,s,o){for(var u in s)if(i[u]!==void 0){var a=i[u]||0,h=s[u],d=Array.isArray(e[u]),y=Array.isArray(h),v=!d&&y;v?e[u]=this._interpolationFunction(h,o):typeof h=="object"&&h?this._updateProperties(e[u],a,h,o):(h=this._handleRelativeValue(a,h),typeof h=="number"&&(e[u]=a+(h-a)*o))}},t.prototype._handleRelativeValue=function(e,i){return typeof i!="string"?i:i.charAt(0)==="+"||i.charAt(0)==="-"?e+parseFloat(i):parseFloat(i)},t.prototype._swapEndStartRepeatValues=function(e){var i=this._valuesStartRepeat[e],s=this._valuesEnd[e];typeof s=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(s):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=i},t.autoStartOnUpdate=!1,t}();var ve=ft.nextId,E=rt,ge=E.getAll.bind(E),ye=E.removeAll.bind(E),me=E.add.bind(E),Ee=E.remove.bind(E),be=E.update.bind(E);var St={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150}},x,c,_,f,F,b,A,L,O,S,P,k,C,K,Y,z,R,V,ot=class ot{constructor(e,i){l(this,C);l(this,x);l(this,c);l(this,_);l(this,f,St);l(this,F);l(this,b,new Map);l(this,A,new Set);l(this,L,new Map);l(this,O,new Map);D(this,"tweenGroup",new st);l(this,S,!1);l(this,P,[]);l(this,k,[]);D(this,"on",n((e,i)=>{r(this,x).on(e,i)},"on"));D(this,"off",n((e,i)=>{r(this,x).off(e,i)},"off"));l(this,Y,n(e=>{let{facades:i}=e;if(!lt(i,this.focusedFacades)){if(g(this,P,i),r(this,A).clear(),i.length>0)for(let s of i)r(this,A).add(s.id);r(this,f).autoFocus&&this.focus()}},"#handleDynamicFocusChange"));l(this,z,n(e=>{let{floor:i}=e;if(r(this,c).manualFloorVisibility===!0&&i.floorStack.id!==r(this,F))for(let o of i.floorStack.floors)o.id!==i.id&&r(this,c).updateState(o,{visible:!1});r(this,O).set(i.floorStack.id,i.id);let s=i.floorStack.facade;s&&j(this,C,K).call(this,s,"open")},"#handleFloorChange"));l(this,R,n(e=>{let{zoomLevel:i}=e;i>=r(this,f).indoorZoomThreshold&&!r(this,S)?(g(this,S,!0),r(this,f).autoFocus&&this.focus()):i<=r(this,f).outdoorZoomThreshold&&r(this,S)&&(g(this,S,!1),r(this,O).clear(),r(this,f).autoFocus&&this.focus())},"#handleCameraChange"));l(this,V,n(()=>{this.tweenGroup.update()},"#render"));g(this,x,new Z),g(this,c,e),g(this,_,Object.values(r(this,c).getMapData())[0]),r(this,c).preloadFloors(r(this,_).getByType("floor-stack").map(s=>s.defaultFloor)),r(this,c).manualFloorVisibility=!0,this.updateState(Q(W({},i),{outdoorFloorStack:(i==null?void 0:i.outdoorFloorStack)||r(this,_).getByType("floor-stack").find(s=>s.type==="Outdoor")||r(this,_).getByType("floor-stack")[0]})),r(this,c).on("pre-render",r(this,V)),r(this,c).on("floor-change-start",r(this,z)),r(this,c).on("facades-in-view-change",r(this,Y)),r(this,c).Camera.updateFacadesInView(),r(this,c).on("camera-change",r(this,R)),r(this,R).call(this,{zoomLevel:r(this,c).Camera.zoomLevel,center:r(this,c).Camera.center,bearing:r(this,c).Camera.bearing,pitch:r(this,c).Camera.pitch})}get focusedFacades(){return[...r(this,P)]}get visibleFloors(){return[...r(this,k)]}get visibleFloorStacks(){return r(this,k).map(e=>e.floorStack)}getState(){return Q(W({},r(this,f)),{outdoorFloorStack:r(this,_).getById("floor-stack",r(this,F))})}updateState(e){if(e.indoorZoomThreshold!=null&&(e.indoorZoomThreshold=et(e.indoorZoomThreshold,r(this,f).outdoorZoomThreshold,r(this,c).Camera.maxZoomLevel,"fadeInAtZoomLevel must be between fadeOutAtZoomLevel (".concat(r(this,f).outdoorZoomThreshold,") and maxZoomLevel (").concat(r(this,c).Camera.maxZoomLevel,")."))),e.outdoorZoomThreshold!=null&&(e.outdoorZoomThreshold=et(e.outdoorZoomThreshold,r(this,c).Camera.minZoomLevel,r(this,f).indoorZoomThreshold,"fadeOutAtZoomLevel must be between minZoomLevel (".concat(r(this,c).Camera.minZoomLevel,") and fadeInAtZoomLevel (").concat(r(this,f).indoorZoomThreshold,")."))),e.outdoorFloorStack!=null){let i=r(this,_).getById("floor-stack",r(this,F));if(i)for(let s of i.floors)r(this,c).updateState(s,{visible:!1});g(this,F,e.outdoorFloorStack.id);for(let s of e.outdoorFloorStack.floors)r(this,c).updateState(s,{visible:!0})}g(this,f,Object.assign({},r(this,f),e))}destroy(){r(this,c).off("facades-in-view-change",r(this,Y)),r(this,c).off("floor-change-start",r(this,z)),r(this,c).off("camera-change",r(this,R)),r(this,c).off("pre-render",r(this,V));for(let e of r(this,_).getByType("facade")){let i=r(this,b).get(e.id);i&&(i.stop(),r(this,b).delete(e.id)),r(this,c).updateState(e,{visible:!0,opacity:1})}for(let e of r(this,_).getByType("floor"))r(this,c).updateState(e,{visible:e.id===r(this,c).currentFloor.id});r(this,c).manualFloorVisibility=!1}focus(e=r(this,f).setFloorOnFocus){var i;if(r(this,x).publish("focus",{facades:this.focusedFacades}),e){let s=r(this,P).length>0?this.focusedFacades[0].floorStack:void 0,o=r(this,_).getById("floor-stack",r(this,F)),u=r(this,S)?s:o,a=u?this.getDefaultFloorForStack(u):void 0;a&&a.id!==r(this,c).currentFloor.id&&r(this,c).setFloor(a,{context:"dynamic-focus"})}g(this,k,[]);for(let s of r(this,_).getByType("facade")){let o=s.floorStack;if(o.id===r(this,c).currentFloorStack.id)continue;let u=this.getDefaultFloorForStack(o),a=(i=r(this,c).getState(s))==null?void 0:i.visible;r(this,S)&&r(this,A).has(s.id)&&a===!0?(this.setCurrentFloorForStack(o,u),r(this,c).updateState(u,{visible:!0}),j(this,C,K).call(this,s,"open"),r(this,k).push(u)):a===!1&&j(this,C,K).call(this,s,"close",()=>{for(let h of o.floors)r(this,c).updateState(h,{visible:!1})})}}setDefaultFloorForStack(e,i){if(i.floorStack.id!==e.id){w.warn("Floor (".concat(i.id,") does not belong to floor stack (").concat(e.id,"). Default floor will not be set."));return}r(this,L).set(e.id,i.id)}resetDefaultFloorForStack(e){r(this,L).delete(e.id)}getDefaultFloorForStack(e){var i;return r(this,_).getById("floor",(i=r(this,L).get(e.id))!=null?i:"")||e.defaultFloor||e.floors[0]}setCurrentFloorForStack(e,i){if(i.floorStack.id!==e.id){w.warn("Floor (".concat(i.id,") does not belong to floor stack (").concat(e.id,"). Current floor will not be set."));return}if(r(this,O).set(e.id,i.id),e.facade){let s=r(this,c).getState(e.facade);if(s&&s.opacity<1)for(let o of e.floors)r(this,c).updateState(o,{visible:o.id===i.id})}}getCurrentFloorForStack(e){var i;return r(this,_).getById("floor",(i=r(this,O).get(e.id))!=null?i:"")||this.getDefaultFloorForStack(e)}};x=new WeakMap,c=new WeakMap,_=new WeakMap,f=new WeakMap,F=new WeakMap,b=new WeakMap,A=new WeakMap,L=new WeakMap,O=new WeakMap,S=new WeakMap,P=new WeakMap,k=new WeakMap,C=new WeakSet,K=n(function(e,i,s){var y;let o=r(this,c).getState(e);if(!o){w.warn("Facade (".concat(e.id,") not found in map view."));return}let u=o.opacity,a=i==="open"?0:1;if(a===u){r(this,c).updateState(e,{visible:a===1,opacity:a}),s==null||s();return}r(this,b).has(e.id)&&((y=r(this,b).get(e.id))==null||y.stop(),r(this,b).delete(e.id));let h=i==="open"?r(this,f).indoorAnimationOptions.duration:r(this,f).outdoorAnimationOptions.duration,d=new dt({opacity:u}).to({opacity:a},h).easing(I.Quadratic.In).onUpdate(({opacity:v})=>{r(this,c).updateState(e,{visible:!0,opacity:v})}).onComplete(()=>{r(this,c).updateState(e,{visible:i==="close"}),s==null||s()}).start();r(this,V).call(this),this.tweenGroup.add(d),r(this,b).set(e.id,d)},"#animate"),Y=new WeakMap,z=new WeakMap,R=new WeakMap,V=new WeakMap,n(ot,"DynamicFocus");var nt=ot;export{nt as DynamicFocus};
|
|
1
|
+
var ct=Object.defineProperty,pt=Object.defineProperties;var _t=Object.getOwnPropertyDescriptors;var ut=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var ht=t=>{throw TypeError(t)};var J=(t,e,i)=>e in t?ct(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,W=(t,e)=>{for(var i in e||(e={}))vt.call(e,i)&&J(t,i,e[i]);if(ut)for(var i of ut(e))gt.call(e,i)&&J(t,i,e[i]);return t},Q=(t,e)=>pt(t,_t(e)),n=(t,e)=>ct(t,"name",{value:e,configurable:!0});var D=(t,e,i)=>J(t,typeof e!="symbol"?e+"":e,i),H=(t,e,i)=>e.has(t)||ht("Cannot "+i);var r=(t,e,i)=>(H(t,e,"read from private field"),i?i.call(t):e.get(t)),l=(t,e,i)=>e.has(t)?ht("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),g=(t,e,i,s)=>(H(t,e,"write to private field"),s?s.call(t,i):e.set(t,i),i),j=(t,e,i)=>(H(t,e,"access private method"),i);var p={env:{NODE_ENV:"production",npm_package_version:"6.0.1-beta.50"}};var mt="[MappedinJS]";function Et(t=""){let e="".concat(mt).concat(t?"-".concat(t):"");return{logState:p.env.NODE_ENV==="test"?3:0,log(...i){this.logState<=0&&console.log(e,...i)},warn(...i){this.logState<=1&&console.warn(e,...i)},error(...i){this.logState<=2&&console.error(e,...i)},assert(...i){console.assert(...i)},time(i){console.time(i)},timeEnd(i){console.timeEnd(i)},setLevel(i){0<=i&&i<=3&&(this.logState=i)}}}n(Et,"createLogger");var bt=Et();var w=bt;var tt=class tt extends Error{};n(tt,"InvalidTokenError");var X=tt;X.prototype.name="InvalidTokenError";function et(t,e,i,s){return(t<e||t>i)&&w.warn(s),Math.min(i,Math.max(e,t))}n(et,"clampWithWarning");function lt(t,e){if(t==null||e==null)return t===e;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}n(lt,"arraysEqual");var it=class it{constructor(){D(this,"_subscribers",{})}publish(e,i){!this._subscribers||!this._subscribers[e]||this._subscribers[e].forEach(function(s){typeof s=="function"&&s(i)})}on(e,i){this._subscribers||(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(i)}off(e,i){if(!this._subscribers||this._subscribers[e]==null)return;let s=this._subscribers[e].indexOf(i);s!==-1&&this._subscribers[e].splice(s,1)}destroy(){this._subscribers={}}};n(it,"PubSub");var Z=it;var I=Object.freeze({Linear:Object.freeze({None:n(function(t){return t},"None"),In:n(function(t){return t},"In"),Out:n(function(t){return t},"Out"),InOut:n(function(t){return t},"InOut")}),Quadratic:Object.freeze({In:n(function(t){return t*t},"In"),Out:n(function(t){return t*(2-t)},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},"InOut")}),Cubic:Object.freeze({In:n(function(t){return t*t*t},"In"),Out:n(function(t){return--t*t*t+1},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},"InOut")}),Quartic:Object.freeze({In:n(function(t){return t*t*t*t},"In"),Out:n(function(t){return 1- --t*t*t*t},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},"InOut")}),Quintic:Object.freeze({In:n(function(t){return t*t*t*t*t},"In"),Out:n(function(t){return--t*t*t*t*t+1},"Out"),InOut:n(function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},"InOut")}),Sinusoidal:Object.freeze({In:n(function(t){return 1-Math.sin((1-t)*Math.PI/2)},"In"),Out:n(function(t){return Math.sin(t*Math.PI/2)},"Out"),InOut:n(function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))},"InOut")}),Exponential:Object.freeze({In:n(function(t){return t===0?0:Math.pow(1024,t-1)},"In"),Out:n(function(t){return t===1?1:1-Math.pow(2,-10*t)},"Out"),InOut:n(function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},"InOut")}),Circular:Object.freeze({In:n(function(t){return 1-Math.sqrt(1-t*t)},"In"),Out:n(function(t){return Math.sqrt(1- --t*t)},"Out"),InOut:n(function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},"InOut")}),Elastic:Object.freeze({In:n(function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},"In"),Out:n(function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},"Out"),InOut:n(function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)},"InOut")}),Back:Object.freeze({In:n(function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},"In"),Out:n(function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},"Out"),InOut:n(function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},"InOut")}),Bounce:Object.freeze({In:n(function(t){return 1-I.Bounce.Out(1-t)},"In"),Out:n(function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},"Out"),InOut:n(function(t){return t<.5?I.Bounce.In(t*2)*.5:I.Bounce.Out(t*2-1)*.5+.5},"InOut")}),generatePow:n(function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:n(function(e){return Math.pow(e,t)},"In"),Out:n(function(e){return 1-Math.pow(1-e,t)},"Out"),InOut:n(function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5},"InOut")}},"generatePow")}),$=n(function(){return performance.now()},"now"),st=function(){function t(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return n(t,"Group"),t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(i){return e._tweens[i]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var e,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];for(var o=0,u=i;o<u.length;o++){var a=u[o];(e=a._group)===null||e===void 0||e.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},t.prototype.remove=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var s=0,o=e;s<o.length;s++){var u=o[s];u._group=void 0,delete this._tweens[u.getId()],delete this._tweensAddedDuringUpdate[u.getId()]}},t.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},t.prototype.update=function(e,i){e===void 0&&(e=$()),i===void 0&&(i=!0);var s=Object.keys(this._tweens);if(s.length!==0)for(;s.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<s.length;o++){var u=this._tweens[s[o]],a=!i;u&&u.update(e,a)===!1&&!i&&this.remove(u)}s=Object.keys(this._tweensAddedDuringUpdate)}},t}(),N={Linear:n(function(t,e){var i=t.length-1,s=i*e,o=Math.floor(s),u=N.Utils.Linear;return e<0?u(t[0],t[1],s):e>1?u(t[i],t[i-1],i-s):u(t[o],t[o+1>i?i:o+1],s-o)},"Linear"),Bezier:n(function(t,e){for(var i=0,s=t.length-1,o=Math.pow,u=N.Utils.Bernstein,a=0;a<=s;a++)i+=o(1-e,s-a)*o(e,a)*t[a]*u(s,a);return i},"Bezier"),CatmullRom:n(function(t,e){var i=t.length-1,s=i*e,o=Math.floor(s),u=N.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(o=Math.floor(s=i*(1+e))),u(t[(o-1+i)%i],t[o],t[(o+1)%i],t[(o+2)%i],s-o)):e<0?t[0]-(u(t[0],t[0],t[1],t[1],-s)-t[0]):e>1?t[i]-(u(t[i],t[i],t[i-1],t[i-1],s-i)-t[i]):u(t[o?o-1:0],t[o],t[i<o+1?i:o+1],t[i<o+2?i:o+2],s-o)},"CatmullRom"),Utils:{Linear:n(function(t,e,i){return(e-t)*i+t},"Linear"),Bernstein:n(function(t,e){var i=N.Utils.Factorial;return i(t)/i(e)/i(t-e)},"Bernstein"),Factorial:function(){var t=[1];return function(e){var i=1;if(t[e])return t[e];for(var s=e;s>1;s--)i*=s;return t[e]=i,i}}(),CatmullRom:n(function(t,e,i,s,o){var u=(i-t)*.5,a=(s-e)*.5,h=o*o,d=o*h;return(2*e-2*i+u+a)*d+(-3*e+3*i-2*u-a)*h+u*o+e},"CatmullRom")}},ft=function(){function t(){}return n(t,"Sequence"),t.nextId=function(){return t._nextId++},t._nextId=0,t}(),rt=new st,dt=function(){function t(e,i){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=I.Linear.None,this._interpolationFunction=N.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ft.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=rt,rt.add(this))}return n(t,"Tween"),t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,i){if(i===void 0&&(i=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,i){if(e===void 0&&(e=$()),i===void 0&&(i=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var s in this._valuesStartRepeat)this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||i){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var u in this._valuesEnd)o[u]=this._valuesEnd[u];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,i)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,i,s,o,u){for(var a in s){var h=e[a],d=Array.isArray(h),y=d?"array":typeof h,v=!d&&Array.isArray(s[a]);if(!(y==="undefined"||y==="function")){if(v){var m=s[a];if(m.length===0)continue;for(var B=[h],M=0,q=m.length;M<q;M+=1){var G=this._handleRelativeValue(h,m[M]);if(isNaN(G)){v=!1,console.warn("Found invalid interpolation list. Skipping.");break}B.push(G)}v&&(s[a]=B)}if((y==="object"||d)&&h&&!v){i[a]=d?[]:{};var U=h;for(var T in U)i[a][T]=U[T];o[a]=d?[]:{};var m=s[a];if(!this._isDynamic){var at={};for(var T in m)at[T]=m[T];s[a]=m=at}this._setupProperties(U,i[a],m,o[a],u)}else(typeof i[a]>"u"||u)&&(i[a]=h),d||(i[a]*=1),v?o[a]=s[a].slice().reverse():o[a]=i[a]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=$()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=$()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,i=this._chainedTweens.length;e<i;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},t.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=I.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=N.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,i){var s=this,o;if(e===void 0&&(e=$()),i===void 0&&(i=t.autoStartOnUpdate),this._isPaused)return!0;var u;if(!this._goToEnd&&!this._isPlaying)if(i)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,h=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),d=this._duration+this._repeat*h,y=n(function(){if(s._duration===0||a>d)return 1;var G=Math.trunc(a/h),U=a-G*h,T=Math.min(U/s._duration,1);return T===0&&a===s._duration?1:T},"calculateElapsedPortion"),v=y(),m=this._easingFunction(v);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,m),this._onUpdateCallback&&this._onUpdateCallback(this._object,v),this._duration===0||a>=this._duration)if(this._repeat>0){var B=Math.min(Math.trunc((a-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=B);for(u in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[u]=="string"&&(this._valuesStartRepeat[u]=this._valuesStartRepeat[u]+parseFloat(this._valuesEnd[u])),this._yoyo&&this._swapEndStartRepeatValues(u),this._valuesStart[u]=this._valuesStartRepeat[u];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*B,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var M=0,q=this._chainedTweens.length;M<q;M++)this._chainedTweens[M].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,i,s,o){for(var u in s)if(i[u]!==void 0){var a=i[u]||0,h=s[u],d=Array.isArray(e[u]),y=Array.isArray(h),v=!d&&y;v?e[u]=this._interpolationFunction(h,o):typeof h=="object"&&h?this._updateProperties(e[u],a,h,o):(h=this._handleRelativeValue(a,h),typeof h=="number"&&(e[u]=a+(h-a)*o))}},t.prototype._handleRelativeValue=function(e,i){return typeof i!="string"?i:i.charAt(0)==="+"||i.charAt(0)==="-"?e+parseFloat(i):parseFloat(i)},t.prototype._swapEndStartRepeatValues=function(e){var i=this._valuesStartRepeat[e],s=this._valuesEnd[e];typeof s=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(s):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=i},t.autoStartOnUpdate=!1,t}();var ve=ft.nextId,E=rt,ge=E.getAll.bind(E),ye=E.removeAll.bind(E),me=E.add.bind(E),Ee=E.remove.bind(E),be=E.update.bind(E);var St={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150}},x,c,_,f,F,b,A,L,O,S,P,k,C,K,Y,z,R,V,ot=class ot{constructor(e,i){l(this,C);l(this,x);l(this,c);l(this,_);l(this,f,St);l(this,F);l(this,b,new Map);l(this,A,new Set);l(this,L,new Map);l(this,O,new Map);D(this,"tweenGroup",new st);l(this,S,!1);l(this,P,[]);l(this,k,[]);D(this,"on",n((e,i)=>{r(this,x).on(e,i)},"on"));D(this,"off",n((e,i)=>{r(this,x).off(e,i)},"off"));l(this,Y,n(e=>{let{facades:i}=e;if(!lt(i,this.focusedFacades)){if(g(this,P,i),r(this,A).clear(),i.length>0)for(let s of i)r(this,A).add(s.id);r(this,f).autoFocus&&this.focus()}},"#handleDynamicFocusChange"));l(this,z,n(e=>{let{floor:i}=e;if(r(this,c).manualFloorVisibility===!0&&i.floorStack.id!==r(this,F))for(let o of i.floorStack.floors)o.id!==i.id&&r(this,c).updateState(o,{visible:!1});r(this,O).set(i.floorStack.id,i.id);let s=i.floorStack.facade;s&&j(this,C,K).call(this,s,"open")},"#handleFloorChange"));l(this,R,n(e=>{let{zoomLevel:i}=e;i>=r(this,f).indoorZoomThreshold&&!r(this,S)?(g(this,S,!0),r(this,f).autoFocus&&this.focus()):i<=r(this,f).outdoorZoomThreshold&&r(this,S)&&(g(this,S,!1),r(this,O).clear(),r(this,f).autoFocus&&this.focus())},"#handleCameraChange"));l(this,V,n(()=>{this.tweenGroup.update()},"#render"));g(this,x,new Z),g(this,c,e),g(this,_,Object.values(r(this,c).getMapData())[0]),r(this,c).preloadFloors(r(this,_).getByType("floor-stack").map(s=>s.defaultFloor)),r(this,c).manualFloorVisibility=!0,this.updateState(Q(W({},i),{outdoorFloorStack:(i==null?void 0:i.outdoorFloorStack)||r(this,_).getByType("floor-stack").find(s=>s.type==="Outdoor")||r(this,_).getByType("floor-stack")[0]})),r(this,c).on("pre-render",r(this,V)),r(this,c).on("floor-change-start",r(this,z)),r(this,c).on("facades-in-view-change",r(this,Y)),r(this,c).Camera.updateFacadesInView(),r(this,c).on("camera-change",r(this,R)),r(this,R).call(this,{zoomLevel:r(this,c).Camera.zoomLevel,center:r(this,c).Camera.center,bearing:r(this,c).Camera.bearing,pitch:r(this,c).Camera.pitch})}get focusedFacades(){return[...r(this,P)]}get visibleFloors(){return[...r(this,k)]}get visibleFloorStacks(){return r(this,k).map(e=>e.floorStack)}getState(){return Q(W({},r(this,f)),{outdoorFloorStack:r(this,_).getById("floor-stack",r(this,F))})}updateState(e){if(e.indoorZoomThreshold!=null&&(e.indoorZoomThreshold=et(e.indoorZoomThreshold,r(this,f).outdoorZoomThreshold,r(this,c).Camera.maxZoomLevel,"fadeInAtZoomLevel must be between fadeOutAtZoomLevel (".concat(r(this,f).outdoorZoomThreshold,") and maxZoomLevel (").concat(r(this,c).Camera.maxZoomLevel,")."))),e.outdoorZoomThreshold!=null&&(e.outdoorZoomThreshold=et(e.outdoorZoomThreshold,r(this,c).Camera.minZoomLevel,r(this,f).indoorZoomThreshold,"fadeOutAtZoomLevel must be between minZoomLevel (".concat(r(this,c).Camera.minZoomLevel,") and fadeInAtZoomLevel (").concat(r(this,f).indoorZoomThreshold,")."))),e.outdoorFloorStack!=null){let i=r(this,_).getById("floor-stack",r(this,F));if(i)for(let s of i.floors)r(this,c).updateState(s,{visible:!1});g(this,F,e.outdoorFloorStack.id);for(let s of e.outdoorFloorStack.floors)r(this,c).updateState(s,{visible:!0})}g(this,f,Object.assign({},r(this,f),e))}destroy(){r(this,c).off("facades-in-view-change",r(this,Y)),r(this,c).off("floor-change-start",r(this,z)),r(this,c).off("camera-change",r(this,R)),r(this,c).off("pre-render",r(this,V));for(let e of r(this,_).getByType("facade")){let i=r(this,b).get(e.id);i&&(i.stop(),r(this,b).delete(e.id)),r(this,c).updateState(e,{visible:!0,opacity:1})}for(let e of r(this,_).getByType("floor"))r(this,c).updateState(e,{visible:e.id===r(this,c).currentFloor.id});r(this,c).manualFloorVisibility=!1}focus(e=r(this,f).setFloorOnFocus){var i;if(r(this,x).publish("focus",{facades:this.focusedFacades}),e){let s=r(this,P).length>0?this.focusedFacades[0].floorStack:void 0,o=r(this,_).getById("floor-stack",r(this,F)),u=r(this,S)?s:o,a=u?this.getDefaultFloorForStack(u):void 0;a&&a.id!==r(this,c).currentFloor.id&&r(this,c).setFloor(a,{context:"dynamic-focus"})}g(this,k,[]);for(let s of r(this,_).getByType("facade")){let o=s.floorStack;if(o.id===r(this,c).currentFloorStack.id)continue;let u=this.getDefaultFloorForStack(o),a=(i=r(this,c).getState(s))==null?void 0:i.visible;r(this,S)&&r(this,A).has(s.id)&&a===!0?(this.setCurrentFloorForStack(o,u),r(this,c).updateState(u,{visible:!0}),j(this,C,K).call(this,s,"open"),r(this,k).push(u)):a===!1&&j(this,C,K).call(this,s,"close",()=>{for(let h of o.floors)r(this,c).updateState(h,{visible:!1})})}}setDefaultFloorForStack(e,i){if(i.floorStack.id!==e.id){w.warn("Floor (".concat(i.id,") does not belong to floor stack (").concat(e.id,"). Default floor will not be set."));return}r(this,L).set(e.id,i.id)}resetDefaultFloorForStack(e){r(this,L).delete(e.id)}getDefaultFloorForStack(e){var i;return r(this,_).getById("floor",(i=r(this,L).get(e.id))!=null?i:"")||e.defaultFloor||e.floors[0]}setCurrentFloorForStack(e,i){if(i.floorStack.id!==e.id){w.warn("Floor (".concat(i.id,") does not belong to floor stack (").concat(e.id,"). Current floor will not be set."));return}if(r(this,O).set(e.id,i.id),e.facade){let s=r(this,c).getState(e.facade);if(s&&s.opacity<1)for(let o of e.floors)r(this,c).updateState(o,{visible:o.id===i.id})}}getCurrentFloorForStack(e){var i;return r(this,_).getById("floor",(i=r(this,O).get(e.id))!=null?i:"")||this.getDefaultFloorForStack(e)}};x=new WeakMap,c=new WeakMap,_=new WeakMap,f=new WeakMap,F=new WeakMap,b=new WeakMap,A=new WeakMap,L=new WeakMap,O=new WeakMap,S=new WeakMap,P=new WeakMap,k=new WeakMap,C=new WeakSet,K=n(function(e,i,s){var y;let o=r(this,c).getState(e);if(!o){w.warn("Facade (".concat(e.id,") not found in map view."));return}let u=o.opacity,a=i==="open"?0:1;if(a===u){r(this,c).updateState(e,{visible:a===1,opacity:a}),s==null||s();return}r(this,b).has(e.id)&&((y=r(this,b).get(e.id))==null||y.stop(),r(this,b).delete(e.id));let h=i==="open"?r(this,f).indoorAnimationOptions.duration:r(this,f).outdoorAnimationOptions.duration,d=new dt({opacity:u}).to({opacity:a},h).easing(I.Quadratic.In).onUpdate(({opacity:v})=>{r(this,c).updateState(e,{visible:!0,opacity:v})}).onComplete(()=>{r(this,c).updateState(e,{visible:i==="close"}),s==null||s()}).start();r(this,V).call(this),this.tweenGroup.add(d),r(this,b).set(e.id,d)},"#animate"),Y=new WeakMap,z=new WeakMap,R=new WeakMap,V=new WeakMap,n(ot,"DynamicFocus");var nt=ot;export{nt as DynamicFocus};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappedin/dynamic-focus",
|
|
3
|
-
"version": "6.0.1-beta.
|
|
3
|
+
"version": "6.0.1-beta.50",
|
|
4
4
|
"homepage": "https://developer.mappedin.com/",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"volta": {
|
|
31
31
|
"extends": "../../package.json"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "2a421dbb5f163bf7bbcef2937c806909b21818f3"
|
|
34
34
|
}
|