@mappedin/mappedin-js 5.28.0 → 5.29.1
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/get-venue/index.d.ts +13 -2
- package/lib/esm/get-venue/index.js +1 -1
- package/lib/esm/renderer/{GLTFExporter-JB2B435C.js → GLTFExporter-UBTZPP6W.js} +1 -1
- package/lib/esm/renderer/PerformanceController-45YU6MOS.js +1 -0
- package/lib/esm/renderer/{browser-37IHNJXW.js → browser-FRTG5XNM.js} +1 -1
- package/lib/esm/renderer/chunk-7V4CSFOP.js +1 -0
- package/lib/esm/renderer/{chunk-2LGJN5VB.js → chunk-NEHGEDBU.js} +1 -1
- package/lib/esm/renderer/{chunk-SHZFY7MV.js → chunk-P53WL6R7.js} +1 -1
- package/lib/esm/renderer/index.d.ts +19 -3
- package/lib/esm/renderer/index.js +1 -1
- package/lib/esm/renderer/{outdoor-context-7R3O7ND4.js → outdoor-context-S6PKEGHW.js} +1 -1
- package/lib/mappedin.js +1 -1
- package/lib/node/index.js +1 -1
- package/package.json +2 -3
- package/lib/esm/renderer/PerformanceController-NKPSWR2Y.js +0 -1
- package/lib/esm/renderer/chunk-VBEXDX2L.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappedin/mappedin-js",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.29.1",
|
|
4
4
|
"main": "lib/esm/renderer/index.js",
|
|
5
5
|
"module": "lib/esm/renderer/index.js",
|
|
6
6
|
"browser": "lib/esm/renderer/index.js",
|
|
@@ -28,13 +28,12 @@
|
|
|
28
28
|
"docs": "yarn build && typedoc"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@packages/internal": "^5.28.0",
|
|
32
31
|
"@types/offscreencanvas": "^2019.6.3",
|
|
33
32
|
"archiver": "^5.3.1",
|
|
34
33
|
"jest-fetch-mock": "^3.0.3",
|
|
35
34
|
"jest-three": "^1.3.1"
|
|
36
35
|
},
|
|
37
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "7eecadccdbe2e1877e3e73552d9cc72ffbf279d6",
|
|
38
37
|
"volta": {
|
|
39
38
|
"extends": "../package.json"
|
|
40
39
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as b}from"./chunk-2LGJN5VB.js";import{a as v}from"./chunk-VBEXDX2L.js";import{a as o,f as i}from"./chunk-ZRT45YCM.js";v();var F,y,m=class{constructor(t){i(this,"_currentStats",{fps:0,ms:0,mb:0}),i(this,"view"),i(this,"timer"),i(this,"counter"),i(this,"onFPSChangeArray"),i(this,"onFPSChangeIndex"),i(this,"lastFPS",0),i(this,"SECONDS_TO_DECIDE",5),i(this,"MIN_FPS",26),i(this,"CRITICAL_FPS",10),i(this,"MAX_FPS",120),i(this,"MAX_MS",200),i(this,"MAX_MB",((null==(y=null==(F=window.performance)?void 0:F.memory)?void 0:y.jsHeapSizeLimit)||1/0)/1048576),i(this,"updateMappedinDevtools",o((()=>{let t="__MAPPEDIN_DEVTOOLS__";window[t]=window[t]||{};let i=window[t];i.showPerformancePanelArray=i.showPerformancePanelArray||[],i.hidePerformancePanelArray=i.hidePerformancePanelArray||[],i.showPerformancePanelArray.push((()=>this.showPerformancePanel())),i.hidePerformancePanelArray.push((()=>this.hidePerformancePanel()))}),"updateMappedinDevtools"));let{MAX_FPS:e,MAX_MS:s,MAX_MB:n}=this,a={fps:e,ms:s,mb:n};this.view=new d(t.debug,t.container,a),this.timer=new u,this.counter=new c,this.onFPSChangeArray=t.onFPSChangeArray,this.onFPSChangeIndex=t.dynamicPerformance?t.onFPSChangeArray.length:-1,this.updateMappedinDevtools()}static getDefaultOnFPSChangeArray(t){let{effectComposer:i}=t.renderer.implementation;return[()=>{null==i||i.setAmbientOcclusionConfiguration({aoEnabled:!1}),null==i||i.setAntialiasConfiguration({antialias:!1}),t.paths.pathSegments.forEach((({arrowAnimationTween:t})=>{t.stop()}));for(let i in t.polygonMeshesById){let{material:e}=t.polygonMeshesById[i];e.map&&(e.map.anisotropy=1,e.needsUpdate=!0)}t.tryRendering()},()=>{null==i||i.setAmbientOcclusionConfiguration({aoEnabled:!0,aoQuality:"medium",aoResolution:"half",aoSamples:16,denoiseSamples:8,denoiseRadius:12}),null==i||i.setAntialiasConfiguration({antialias:!0,antialiasQuality:"medium"}),t.tryRendering()}]}updateStats(t){var i,e;let s=(null==(e=null==(i=window.performance)?void 0:i.memory)?void 0:e.usedJSHeapSize)||0;this._currentStats.fps=Math.min(t,this.MAX_FPS),this._currentStats.ms=Math.min(1e3/t,this.MAX_MS),this._currentStats.mb=Math.min(s/1048576,this.MAX_MB),this.view.updatePanels(this._currentStats)}isFPSSpiked(t){return Math.abs(this.lastFPS-t)/this.lastFPS>.1}updateOnFPSChangeIndex(t,i){let e=this.onFPSChangeIndex;return i&&e>0?e=0:t&&(e-=1),this.onFPSChangeIndex=b.clamp(e,-1,this.onFPSChangeArray.length),this.onFPSChangeIndex}handleFPSChange(t,i){let e=this.onFPSChangeIndex,s=this.updateOnFPSChangeIndex(t,i),n=this.onFPSChangeArray[s];!n||s===e||n(this.currentStats)}update(){let{fps:t,duration:i}=this.timer.update();if(i>=1e3){if(!this.isFPSSpiked(t)){let{lowFPS:i,criticalFPS:e}=this.counter.update(t,this.MIN_FPS,this.CRITICAL_FPS,this.SECONDS_TO_DECIDE);this.updateStats(t),this.handleFPSChange(i,e)}this.lastFPS=t,this.timer.reset()}}get currentStats(){return{...this._currentStats}}get dom(){return this.view.dom}hidePerformancePanel(){this.view.hidePerformancePanel()}showPerformancePanel(){this.view.showPerformancePanel()}};o(m,"PerformanceController");var C=m,P=class{constructor(){i(this,"beginTime",performance.now()),i(this,"frames",0),i(this,"duration",0)}reset(){this.duration=0,this.frames=0}update(){let t=performance.now(),i=t-this.beginTime;return this.frames++,this.duration+=i,this.beginTime=t,{duration:this.duration,fps:this.frames/(this.duration/1e3)}}};o(P,"PerformanceTimer");var u=P,f=class{constructor(){i(this,"criticalFpsCounter",0),i(this,"lowFpsCounter",0),i(this,"highFpsCounter",0)}update(t,i,e,s){let n=t<i,a=t<e;return this.criticalFpsCounter=a?this.criticalFpsCounter+1:0,this.lowFpsCounter=n?this.lowFpsCounter+1:0,this.highFpsCounter=n?0:this.highFpsCounter+1,this.lowFpsCounter===s?(this.lowFpsCounter=0,this.criticalFpsCounter===s?(this.criticalFpsCounter=0,{lowFPS:!0,highFPS:!1,criticalFPS:!0}):{lowFPS:!0,highFPS:!1,criticalFPS:!1}):this.highFpsCounter===s?(this.highFpsCounter=0,{lowFPS:!1,highFPS:!0,criticalFPS:!1}):(n?this.highFpsCounter=0:(this.lowFpsCounter=0,this.criticalFpsCounter=0),{lowFPS:!1,highFPS:!1,criticalFPS:!1})}};o(f,"PerformanceCounter");var c=f,g=class{constructor(t,e,s){var n;i(this,"mode",-1),i(this,"panels",[]),i(this,"appContainer"),i(this,"maxValues"),i(this,"debug"),i(this,"stats"),i(this,"container"),this.debug=t,this.appContainer=e,this.maxValues=s,this.container=this.createContainer(),this.addPanel(new l({name:"FPS",foregroundColor:"#0ff",backgroundColor:"#002"})),this.addPanel(new l({name:"MS",foregroundColor:"#0f0",backgroundColor:"#020"})),null!=(n=window.performance)&&n.memory&&this.addPanel(new l({name:"MB",foregroundColor:"#f08",backgroundColor:"#201"})),this.debug&&this.showPerformancePanel()}createContainer(){let t=document.createElement("div");return t.style.cssText="position:absolute;top:0;right:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(t=>{t.preventDefault(),this.showPanel(++this.mode%this.panels.length)})),t}addPanel(t){this.panels.push(t),this.container.appendChild(t.dom)}showPanel(t){this.panels.forEach(((i,e)=>{i.dom.style.display=e===t?"block":"none"})),this.mode=t}hidePerformancePanel(){this.container.parentNode&&(this.debug=!1,this.appContainer.removeChild(this.container))}showPerformancePanel(){this.container.parentNode||(this.debug=!0,this.stats&&this.updatePanels(this.stats),this.appContainer.appendChild(this.container))}updatePanels(t){this.stats=t,this.debug&&this.panels.forEach(((i,e)=>{0===e?i.update(t.fps,this.maxValues.fps):1===e?i.update(t.ms,this.maxValues.ms):2===e&&i.update(t.mb,this.maxValues.mb)}))}get dom(){return this.container}};o(g,"PerformanceView");var d=g,S=class{constructor(t){this.config=t,i(this,"min",1/0),i(this,"max",0),i(this,"canvas"),i(this,"context"),i(this,"PR",Math.round(window.devicePixelRatio||1)),i(this,"WIDTH",80*this.PR),i(this,"HEIGHT",48*this.PR),i(this,"TEXT_X",3*this.PR),i(this,"TEXT_Y",2*this.PR),i(this,"GRAPH_X",3*this.PR),i(this,"GRAPH_Y",15*this.PR),i(this,"GRAPH_WIDTH",74*this.PR),i(this,"GRAPH_HEIGHT",30*this.PR),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.setupCanvas()}setupCanvas(){this.canvas.dataset.name=this.config.name,this.canvas.width=this.WIDTH,this.canvas.height=this.HEIGHT,this.canvas.style.width="".concat(this.WIDTH/this.PR,"px"),this.canvas.style.height="".concat(this.HEIGHT/this.PR,"px"),this.context.font="bold ".concat(9*this.PR,"px Helvetica,Arial,sans-serif"),this.context.textBaseline="top",this.context.fillStyle=this.config.backgroundColor,this.context.fillRect(0,0,this.WIDTH,this.HEIGHT),this.context.fillStyle=this.config.foregroundColor,this.context.fillText(this.config.name,this.TEXT_X,this.TEXT_Y),this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT),this.context.fillStyle=this.config.backgroundColor,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT)}get dom(){return this.canvas}update(t,i){this.min=Math.min(this.min,t),this.max=Math.max(this.max,t);let{context:e,WIDTH:s,GRAPH_Y:n,GRAPH_WIDTH:a,GRAPH_HEIGHT:h,PR:o}=this;e.fillStyle=this.config.backgroundColor,e.globalAlpha=1,e.fillRect(0,0,s,n),e.fillStyle=this.config.foregroundColor,e.fillText("".concat(Math.round(t)," ").concat(this.config.name," (").concat(Math.round(this.min),"-").concat(Math.round(this.max),")"),this.TEXT_X,this.TEXT_Y),e.drawImage(this.canvas,this.GRAPH_X+o,this.GRAPH_Y,a-o,h,this.GRAPH_X,this.GRAPH_Y,a-o,h),e.fillRect(this.GRAPH_X+a-o,this.GRAPH_Y,o,h),e.fillStyle=this.config.backgroundColor,e.globalAlpha=.9,e.fillRect(this.GRAPH_X+a-o,this.GRAPH_Y,o,Math.round((1-t/i)*h))}};o(S,"Panel");var l=S;export{C as PerformanceController,d as PerformanceView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./chunk-ZRT45YCM.js";var e,c=a((()=>{e={env:{NODE_ENV:"production",npm_package_version:"5.28.0"}}}));export{c as a,e as b};
|