@xeokit/xeokit-sdk 2.6.38 → 2.6.41
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/dist/web-ifc.wasm +0 -0
- package/dist/xeokit-sdk.cjs.js +215 -188
- package/dist/xeokit-sdk.es.js +211 -189
- package/dist/xeokit-sdk.es5.js +38 -31
- package/dist/xeokit-sdk.min.cjs.js +4 -4
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/extras/ContextMenu/ContextMenu.js +4 -6
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +10 -10
- package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +38 -45
- package/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +6 -0
- package/src/plugins/TreeViewPlugin/RenderService.js +4 -1
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +14 -6
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +0 -116
- package/src/plugins/index.js +1 -0
- package/src/plugins/lib/ui/index.js +116 -0
- package/src/viewer/scene/model/SceneModel.js +15 -1
- package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js +3 -3
- package/types/plugins/FastNavPlugin/FastNavPlugin.d.ts +2 -0
- package/types/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +2 -0
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -333,13 +333,13 @@ var visitItems=function visitItems(itemsCfg){var menuId=_this3._getNextId();var
|
|
|
333
333
|
return"ContextMenu_"+this._id+"_"+this._nextId++;// Start ID with alpha chars to make a valid DOM element selector
|
|
334
334
|
}},{key:"_createUI",value:function _createUI(){var _this4=this;// Builds DOM elements for the entire menu tree
|
|
335
335
|
var visitMenu=function visitMenu(menu){_this4._createMenuUI(menu);var groups=menu.groups;for(var _i5=0,len=groups.length;_i5<len;_i5++){var group=groups[_i5];var groupItems=group.items;for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var subMenu=item.subMenu;if(subMenu){visitMenu(subMenu);}}}};visitMenu(this._rootMenu);}},{key:"_createMenuUI",value:function _createMenuUI(menu){var _this5=this;// Builds DOM elements for a menu
|
|
336
|
-
var groups=menu.groups;var html=[];html.push('<div class="xeokit-context-menu '+menu.id+'" style="z-index:300000; position: absolute;">');html.push('<ul>');if(groups){for(var _i6=0,len=groups.length;_i6<len;_i6++){var group=groups[_i6];var groupIdx=_i6;var groupLen=len;var groupItems=group.items;if(groupItems){for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var itemSubMenu=item.subMenu;var actionTitle=item.title||"";if(itemSubMenu){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+' [MORE]'+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-
|
|
336
|
+
var groups=menu.groups;var html=[];html.push('<div class="xeokit-context-menu '+menu.id+'" style="z-index:300000; position: absolute;">');html.push('<ul>');if(groups){for(var _i6=0,len=groups.length;_i6<len;_i6++){var group=groups[_i6];var groupIdx=_i6;var groupLen=len;var groupItems=group.items;if(groupItems){for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var itemSubMenu=item.subMenu;var actionTitle=item.title||"";if(itemSubMenu){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+' [MORE]'+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-separator"></li>');}}else{html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-separator"></li>');}}}}}}html.push('</ul>');html.push('</div>');var htmlString=html.join("");document.body.insertAdjacentHTML('beforeend',htmlString);var menuElement=document.querySelector("."+menu.id);menu.menuElement=menuElement;menuElement.style["border-radius"]=4+"px";menuElement.style.display='none';menuElement.style["z-index"]=300000;menuElement.style.background="white";menuElement.style.border="1px solid black";menuElement.style["box-shadow"]="0 4px 5px 0 gray";menuElement.oncontextmenu=function(e){e.preventDefault();};// Bind event handlers
|
|
337
337
|
var self=this;var lastSubMenu=null;if(groups){for(var _i7=0,_len2=groups.length;_i7<_len2;_i7++){var _group=groups[_i7];var _groupItems=_group.items;if(_groupItems){var _loop2=function _loop2(_j2,_lenj){var item=_groupItems[_j2];var itemSubMenu=item.subMenu;item.itemElement=document.getElementById(item.id);if(!item.itemElement){console.error("ContextMenu item element not found: "+item.id);return"continue";}item.itemElement.addEventListener("mouseenter",function(event){event.preventDefault();var subMenu=item.subMenu;if(!subMenu){if(lastSubMenu){self._hideMenu(lastSubMenu.id);lastSubMenu=null;}return;}if(lastSubMenu&&lastSubMenu.id!==subMenu.id){self._hideMenu(lastSubMenu.id);lastSubMenu=null;}if(item.enabled===false){return;}var itemElement=item.itemElement;var subMenuElement=subMenu.menuElement;var itemRect=itemElement.getBoundingClientRect();subMenuElement.getBoundingClientRect();var subMenuWidth=200;// TODO
|
|
338
338
|
var showOnLeft=itemRect.right+subMenuWidth>window.innerWidth;if(showOnLeft){self._showMenu(subMenu.id,itemRect.left-subMenuWidth,itemRect.top-1);}else{self._showMenu(subMenu.id,itemRect.right-5,itemRect.top-1);}lastSubMenu=subMenu;});if(!itemSubMenu){// Item without sub-menu
|
|
339
339
|
// clicking item fires the item's action callback
|
|
340
340
|
item.itemElement.addEventListener("click",function(event){event.preventDefault();if(!self._context){return;}if(item.enabled===false){return;}if(item.doAction){item.doAction(self._context);}if(_this5._hideOnAction){self.hide();}else{self._updateItemsTitles();self._updateItemsEnabledStatus();}});item.itemElement.addEventListener("mouseup",function(event){if(event.which!==3){return;}event.preventDefault();if(!self._context){return;}if(item.enabled===false){return;}if(item.doAction){item.doAction(self._context);}if(_this5._hideOnAction){self.hide();}else{self._updateItemsTitles();self._updateItemsEnabledStatus();}});item.itemElement.addEventListener("mouseenter",function(event){event.preventDefault();if(item.enabled===false){return;}if(item.doHover){item.doHover(self._context);}});}};for(var _j2=0,_lenj=_groupItems.length;_j2<_lenj;_j2++){var _ret=_loop2(_j2,_lenj);if(_ret==="continue")continue;}}}}}},{key:"_updateItemsTitles",value:function _updateItemsTitles(){// Dynamically updates the title of each Item to the result of Item#getTitle()
|
|
341
341
|
if(!this._context){return;}for(var _i8=0,len=this._itemList.length;_i8<len;_i8++){var item=this._itemList[_i8];var itemElement=item.itemElement;if(!itemElement){continue;}var getShown=item.getShown;if(!getShown||!getShown(this._context)){continue;}var title=item.getTitle(this._context);if(item.subMenu){itemElement.innerText=title;}else{itemElement.innerText=title;}}}},{key:"_updateItemsEnabledStatus",value:function _updateItemsEnabledStatus(){// Enables or disables each Item, depending on the result of Item#getEnabled()
|
|
342
|
-
if(!this._context){return;}for(var _i9=0,len=this._itemList.length;_i9<len;_i9++){var item=this._itemList[_i9];var itemElement=item.itemElement;if(!itemElement){continue;}var getEnabled=item.getEnabled;if(!getEnabled){continue;}var getShown=item.getShown;if(!getShown){continue;}var shown=getShown(this._context);item.shown=shown;if(!shown){itemElement.
|
|
342
|
+
if(!this._context){return;}for(var _i9=0,len=this._itemList.length;_i9<len;_i9++){var item=this._itemList[_i9];var itemElement=item.itemElement;if(!itemElement){continue;}var getEnabled=item.getEnabled;if(!getEnabled){continue;}var getShown=item.getShown;if(!getShown){continue;}var shown=getShown(this._context);item.shown=shown;if(!shown){itemElement.style.display="none";continue;}else{itemElement.style.display="";}var enabled=getEnabled(this._context);item.enabled=enabled;if(!enabled){itemElement.classList.add("disabled");}else{itemElement.classList.remove("disabled");}}}},{key:"_showMenu",value:function _showMenu(menuId,pageX,pageY){// Shows the given menu, at the specified page coordinates
|
|
343
343
|
var menu=this._menuMap[menuId];if(!menu){console.error("Menu not found: "+menuId);return;}if(menu.shown){return;}var menuElement=menu.menuElement;if(menuElement){this._showMenuElement(menuElement,pageX,pageY);menu.shown=true;}}},{key:"_hideMenu",value:function _hideMenu(menuId){// Hides the given menu
|
|
344
344
|
var menu=this._menuMap[menuId];if(!menu){console.error("Menu not found: "+menuId);return;}if(!menu.shown){return;}var menuElement=menu.menuElement;if(menuElement){this._hideMenuElement(menuElement);menu.shown=false;}}},{key:"_hideAllMenus",value:function _hideAllMenus(){for(var _i10=0,len=this._menuList.length;_i10<len;_i10++){var menu=this._menuList[_i10];this._hideMenu(menu.id);}}},{key:"_showMenuElement",value:function _showMenuElement(menuElement,pageX,pageY){// Shows the given menu element, at the specified page coordinates
|
|
345
345
|
menuElement.style.display='block';var menuHeight=menuElement.offsetHeight;var menuWidth=menuElement.offsetWidth;if(pageY+menuHeight>window.innerHeight){pageY=window.innerHeight-menuHeight;}if(pageX+menuWidth>window.innerWidth){pageX=window.innerWidth-menuWidth;}menuElement.style.left=pageX+'px';menuElement.style.top=pageY+'px';}},{key:"_hideMenuElement",value:function _hideMenuElement(menuElement){menuElement.style.display='none';}}]);return ContextMenu;}();/**
|
|
@@ -2771,7 +2771,8 @@ _this15._onEntityModelDestroyed=null;});}else{this._onEntityDestroyed=this._enti
|
|
|
2771
2771
|
* @final
|
|
2772
2772
|
*/},{key:"visible",get:function get(){return!!this._visible;}/**
|
|
2773
2773
|
* Destroys this Marker.
|
|
2774
|
-
*/},{key:"destroy",value:function destroy(){this.fire("destroyed",true);this.scene.camera.off(this._onCameraViewMatrix);this.scene.camera.off(this._onCameraProjMatrix);if(this._entity){if(this._onEntityDestroyed!==null){this._entity.model.off(this._onEntityDestroyed);}if(this._onEntityModelDestroyed!==null){this._entity.model.off(this._onEntityModelDestroyed);}}this._renderer.removeMarker(this);_get(_getPrototypeOf(Marker.prototype),"destroy",this).call(this);}}]);return Marker;}(Component);var nop=function nop(){};function transformToNode(from,to,vec){var fromRec=from.getBoundingClientRect();var toRec=to.getBoundingClientRect();vec[0]+=fromRec.left-toRec.left;vec[1]+=fromRec.top-toRec.top;}var Dot3D=/*#__PURE__*/function(_Marker){_inherits(Dot3D,_Marker);var _super5=_createSuper(Dot3D);function Dot3D(scene,markerCfg,parentElement){var _this16;var cfg=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};_classCallCheck(this,Dot3D);_this16=_super5.call(this,scene,markerCfg);var handler=function handler(cfgEvent,componentEvent){return function(event){if(cfgEvent){cfgEvent(event);}_this16.fire(componentEvent,event,true);};};_this16._dot=new Dot(parentElement,{fillColor:cfg.fillColor,zIndex:cfg.zIndex,onMouseOver:handler(cfg.onMouseOver,"mouseover"),onMouseLeave:handler(cfg.onMouseLeave,"mouseleave"),onMouseWheel:handler(cfg.onMouseWheel,"wheel"),onMouseDown:handler(cfg.onMouseDown,"mousedown"),onMouseUp:handler(cfg.onMouseUp,"mouseup"),onMouseMove:handler(cfg.onMouseMove,"mousemove"),onTouchstart:handler(cfg.onTouchstart,"touchstart"),onTouchmove:handler(cfg.onTouchmove,"touchmove"),onTouchend:handler(cfg.onTouchend,"touchend"),onContextMenu:handler(cfg.onContextMenu,"contextmenu")});var updateDotPos=function updateDotPos(){var pos=_this16.canvasPos.slice();transformToNode(scene.canvas.canvas,parentElement,pos);_this16._dot.setPos(pos[0],pos[1]);};_this16.on("worldPos",updateDotPos);var onViewMatrix=scene.camera.on("viewMatrix",updateDotPos);var onProjMatrix=scene.camera.on("projMatrix",updateDotPos);_this16._cleanup=function(){scene.camera.off(onViewMatrix);scene.camera.off(onProjMatrix);_this16._dot.destroy();};return _this16;}_createClass(Dot3D,[{key:"setClickable",value:function setClickable(value){this._dot.setClickable(value);}},{key:"setCulled",value:function setCulled(value){this._dot.setCulled(value);}},{key:"setFillColor",value:function setFillColor(value){this._dot.setFillColor(value);}},{key:"setHighlighted",value:function setHighlighted(value){this._dot.setHighlighted(value);}},{key:"setOpacity",value:function setOpacity(value){this._dot.setOpacity(value);}},{key:"setVisible",value:function setVisible(value){this._dot.setVisible(value);}},{key:"destroy",value:function destroy(){this._cleanup();_get(_getPrototypeOf(Dot3D.prototype),"destroy",this).call(this);}}]);return Dot3D;}(Marker);function activateDraggableDot(dot,cfg){var extractCFG=function extractCFG(propName,defaultValue){if(propName in cfg){return cfg[propName];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+propName;}};var viewer=extractCFG("viewer");var ray2WorldPos=extractCFG("ray2WorldPos");var handleMouseEvents=extractCFG("handleMouseEvents",false);var handleTouchEvents=extractCFG("handleTouchEvents",false);var onStart=extractCFG("onStart",nop);var onMove=extractCFG("onMove",nop);var onEnd=extractCFG("onEnd",nop);var scene=viewer.scene;var canvas=scene.canvas.canvas;var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction,canvasPos);};var onChange=function onChange(event){var canvasPos=math.vec2([event.clientX,event.clientY]);transformToNode(canvas.ownerDocument.documentElement,canvas,canvasPos);onMove(canvasPos,pickWorldPos(canvasPos));};var currentDrag=null;var onDragMove=function onDragMove(event){var e=currentDrag.matchesEvent(event);if(e){onChange(e);}};var onDragEnd=function onDragEnd(event){var e=currentDrag.matchesEvent(event);if(e){dot.setOpacity(idleOpacity);currentDrag.cleanup();onChange(e);onEnd();}};var startDrag=function startDrag(matchesEvent,cleanupHandlers){if(currentDrag){currentDrag.cleanup();}dot.setOpacity(1.0);dot.setClickable(false);viewer.cameraControl.active=false;currentDrag={matchesEvent:matchesEvent,cleanup:function cleanup(){currentDrag=null;dot.setClickable(true);viewer.cameraControl.active=true;cleanupHandlers();}};onStart();};var cleanupDotHandlers=[];var dot_on=function dot_on(event,callback){var id=dot.on(event,callback);cleanupDotHandlers.push(function(){return dot.off(id);});};if(handleMouseEvents){dot_on("mouseover",function(){return!currentDrag&&dot.setOpacity(1.0);});dot_on("mouseleave",function(){return!currentDrag&&dot.setOpacity(idleOpacity);});dot_on("mousedown",function(event){if(event.which===1){canvas.addEventListener("mousemove",onDragMove);canvas.addEventListener("mouseup",onDragEnd);startDrag(function(event){return event.which===1&&event;},function(){canvas.removeEventListener("mousemove",onDragMove);canvas.removeEventListener("mouseup",onDragEnd);});}});}if(handleTouchEvents){var touchStartId;dot_on("touchstart",function(event){event.preventDefault();if(event.touches.length===1){touchStartId=event.touches[0].identifier;startDrag(function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});},function(){touchStartId=null;});}});dot_on("touchmove",function(event){event.preventDefault();onDragMove(event);});dot_on("touchend",function(event){event.preventDefault();onDragEnd(event);});}var idleOpacity=0.8;dot.setOpacity(idleOpacity);return function(){currentDrag&¤tDrag.cleanup();cleanupDotHandlers.forEach(function(c){return c();});dot.setOpacity(1.0);};}function activateDraggableDots(cfg){var extractCFG=function extractCFG(propName,defaultValue){if(propName in cfg){return cfg[propName];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+propName;}};var viewer=extractCFG("viewer");var handleMouseEvents=extractCFG("handleMouseEvents",false);var handleTouchEvents=extractCFG("handleTouchEvents",false);var pointerLens=extractCFG("pointerLens",null);var dots=extractCFG("dots");var _ray2WorldPos=extractCFG("ray2WorldPos");var _onEnd=extractCFG("onEnd",nop);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var cleanups=dots.map(function(dot){var initPos;return activateDraggableDot(dot,{handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,viewer:viewer,ray2WorldPos:function ray2WorldPos(orig,dir,canvasPos){return _ray2WorldPos(orig,dir,canvasPos)||initPos;},onStart:function onStart(){initPos=dot.worldPos.slice();setOtherDotsActive(false,dot);},onMove:function onMove(canvasPos,worldPos){updatePointerLens(canvasPos);dot.worldPos=worldPos;},onEnd:function onEnd(){if(!_onEnd(initPos,dot)){dot.worldPos=initPos;}updatePointerLens(null);setOtherDotsActive(true,dot);}});});var setOtherDotsActive=function setOtherDotsActive(active,dot){return dots.forEach(function(d){return d!==dot&&d.setClickable(active);});};setOtherDotsActive(true);return function(){cleanups.forEach(function(c){return c();});updatePointerLens(null);};}
|
|
2774
|
+
*/},{key:"destroy",value:function destroy(){this.fire("destroyed",true);this.scene.camera.off(this._onCameraViewMatrix);this.scene.camera.off(this._onCameraProjMatrix);if(this._entity){if(this._onEntityDestroyed!==null){this._entity.model.off(this._onEntityDestroyed);}if(this._onEntityModelDestroyed!==null){this._entity.model.off(this._onEntityModelDestroyed);}}this._renderer.removeMarker(this);_get(_getPrototypeOf(Marker.prototype),"destroy",this).call(this);}}]);return Marker;}(Component);var nop=function nop(){};function transformToNode(from,to,vec){var fromRec=from.getBoundingClientRect();var toRec=to.getBoundingClientRect();vec[0]+=fromRec.left-toRec.left;vec[1]+=fromRec.top-toRec.top;}var Dot3D=/*#__PURE__*/function(_Marker){_inherits(Dot3D,_Marker);var _super5=_createSuper(Dot3D);function Dot3D(scene,markerCfg,parentElement){var _this16;var cfg=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};_classCallCheck(this,Dot3D);_this16=_super5.call(this,scene,markerCfg);var handler=function handler(cfgEvent,componentEvent){return function(event){if(cfgEvent){cfgEvent(event);}_this16.fire(componentEvent,event,true);};};_this16._dot=new Dot(parentElement,{fillColor:cfg.fillColor,zIndex:cfg.zIndex,onMouseOver:handler(cfg.onMouseOver,"mouseover"),onMouseLeave:handler(cfg.onMouseLeave,"mouseleave"),onMouseWheel:handler(cfg.onMouseWheel,"wheel"),onMouseDown:handler(cfg.onMouseDown,"mousedown"),onMouseUp:handler(cfg.onMouseUp,"mouseup"),onMouseMove:handler(cfg.onMouseMove,"mousemove"),onTouchstart:handler(cfg.onTouchstart,"touchstart"),onTouchmove:handler(cfg.onTouchmove,"touchmove"),onTouchend:handler(cfg.onTouchend,"touchend"),onContextMenu:handler(cfg.onContextMenu,"contextmenu")});var updateDotPos=function updateDotPos(){var pos=_this16.canvasPos.slice();transformToNode(scene.canvas.canvas,parentElement,pos);_this16._dot.setPos(pos[0],pos[1]);};_this16.on("worldPos",updateDotPos);var onViewMatrix=scene.camera.on("viewMatrix",updateDotPos);var onProjMatrix=scene.camera.on("projMatrix",updateDotPos);_this16._cleanup=function(){scene.camera.off(onViewMatrix);scene.camera.off(onProjMatrix);_this16._dot.destroy();};return _this16;}_createClass(Dot3D,[{key:"setClickable",value:function setClickable(value){this._dot.setClickable(value);}},{key:"setCulled",value:function setCulled(value){this._dot.setCulled(value);}},{key:"setFillColor",value:function setFillColor(value){this._dot.setFillColor(value);}},{key:"setHighlighted",value:function setHighlighted(value){this._dot.setHighlighted(value);}},{key:"setOpacity",value:function setOpacity(value){this._dot.setOpacity(value);}},{key:"setVisible",value:function setVisible(value){this._dot.setVisible(value);}},{key:"destroy",value:function destroy(){this._cleanup();_get(_getPrototypeOf(Dot3D.prototype),"destroy",this).call(this);}}]);return Dot3D;}(Marker);function activateDraggableDot(dot,cfg){var extractCFG=function extractCFG(propName,defaultValue){if(propName in cfg){return cfg[propName];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+propName;}};var viewer=extractCFG("viewer");var ray2WorldPos=extractCFG("ray2WorldPos");var handleMouseEvents=extractCFG("handleMouseEvents",false);var handleTouchEvents=extractCFG("handleTouchEvents",false);var onStart=extractCFG("onStart",nop);var onMove=extractCFG("onMove",nop);var onEnd=extractCFG("onEnd",nop);var scene=viewer.scene;var canvas=scene.canvas.canvas;var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction,canvasPos);};var onChange=function onChange(event){var canvasPos=math.vec2([event.clientX,event.clientY]);transformToNode(canvas.ownerDocument.documentElement,canvas,canvasPos);onMove(canvasPos,pickWorldPos(canvasPos));};var currentDrag=null;var onDragMove=function onDragMove(event){var e=currentDrag.matchesEvent(event);if(e){onChange(e);}};var onDragEnd=function onDragEnd(event){var e=currentDrag.matchesEvent(event);if(e){dot.setOpacity(idleOpacity);currentDrag.cleanup();onChange(e);onEnd();}};var startDrag=function startDrag(matchesEvent,cleanupHandlers){if(currentDrag){currentDrag.cleanup();}dot.setOpacity(1.0);dot.setClickable(false);viewer.cameraControl.active=false;currentDrag={matchesEvent:matchesEvent,cleanup:function cleanup(){currentDrag=null;dot.setClickable(true);viewer.cameraControl.active=true;cleanupHandlers();}};onStart();};var cleanupDotHandlers=[];var dot_on=function dot_on(event,callback){var id=dot.on(event,callback);cleanupDotHandlers.push(function(){return dot.off(id);});};if(handleMouseEvents){dot_on("mouseover",function(){return!currentDrag&&dot.setOpacity(1.0);});dot_on("mouseleave",function(){return!currentDrag&&dot.setOpacity(idleOpacity);});dot_on("mousedown",function(event){if(event.which===1){canvas.addEventListener("mousemove",onDragMove);canvas.addEventListener("mouseup",onDragEnd);startDrag(function(event){return event.which===1&&event;},function(){canvas.removeEventListener("mousemove",onDragMove);canvas.removeEventListener("mouseup",onDragEnd);});}});}if(handleTouchEvents){var touchStartId;dot_on("touchstart",function(event){event.preventDefault();if(event.touches.length===1){touchStartId=event.touches[0].identifier;startDrag(function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});},function(){touchStartId=null;});}});dot_on("touchmove",function(event){event.preventDefault();onDragMove(event);});dot_on("touchend",function(event){event.preventDefault();onDragEnd(event);});}var idleOpacity=0.8;dot.setOpacity(idleOpacity);return function(){currentDrag&¤tDrag.cleanup();cleanupDotHandlers.forEach(function(c){return c();});dot.setOpacity(1.0);};}function activateDraggableDots(cfg){var extractCFG=function extractCFG(propName,defaultValue){if(propName in cfg){return cfg[propName];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+propName;}};var viewer=extractCFG("viewer");var handleMouseEvents=extractCFG("handleMouseEvents",false);var handleTouchEvents=extractCFG("handleTouchEvents",false);var pointerLens=extractCFG("pointerLens",null);var dots=extractCFG("dots");var _ray2WorldPos=extractCFG("ray2WorldPos");var _onEnd=extractCFG("onEnd",nop);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var cleanups=dots.map(function(dot){var initPos;return activateDraggableDot(dot,{handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,viewer:viewer,ray2WorldPos:function ray2WorldPos(orig,dir,canvasPos){return _ray2WorldPos(orig,dir,canvasPos)||initPos;},onStart:function onStart(){initPos=dot.worldPos.slice();setOtherDotsActive(false,dot);},onMove:function onMove(canvasPos,worldPos){updatePointerLens(canvasPos);dot.worldPos=worldPos;},onEnd:function onEnd(){if(!_onEnd(initPos,dot)){dot.worldPos=initPos;}updatePointerLens(null);setOtherDotsActive(true,dot);}});});var setOtherDotsActive=function setOtherDotsActive(active,dot){return dots.forEach(function(d){return d!==dot&&d.setClickable(active);});};setOtherDotsActive(true);return function(){cleanups.forEach(function(c){return c();});updatePointerLens(null);};}var touchPointSelector$1=function touchPointSelector$1(viewer,pointerCircle,ray2WorldPos){return function(onCancel,onChange,onCommit){var scene=viewer.scene;var canvas=scene.canvas.canvas;var longTouchTimeoutMs=300;var moveTolerance=20;var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var longTouchTimeout=null;var nop=function nop(){};var onSingleTouchMove=nop;var startTouchIdentifier;var resetAction=function resetAction(){pointerCircle.stop();clearTimeout(longTouchTimeout);viewer.cameraControl.active=true;onSingleTouchMove=nop;startTouchIdentifier=null;};var cleanup=function cleanup(){resetAction();canvas.removeEventListener("touchstart",onCanvasTouchStart);canvas.removeEventListener("touchmove",onCanvasTouchMove);canvas.removeEventListener("touchend",onCanvasTouchEnd);};var onCanvasTouchStart=function onCanvasTouchStart(event){var touches=event.touches;if(touches.length!==1){resetAction();onCancel();}else{var startTouch=touches[0];var startCanvasPos=copyCanvasPos(startTouch,math.vec2());var startWorldPos=pickWorldPos(startCanvasPos);if(startWorldPos){startTouchIdentifier=startTouch.identifier;onSingleTouchMove=function onSingleTouchMove(canvasPos){if(math.distVec2(startCanvasPos,canvasPos)>moveTolerance){resetAction();}};longTouchTimeout=setTimeout(function(){pointerCircle.start(startCanvasPos);longTouchTimeout=setTimeout(function(){pointerCircle.stop();viewer.cameraControl.active=false;onSingleTouchMove=function onSingleTouchMove(canvasPos){onChange(canvasPos,pickWorldPos(canvasPos));};onSingleTouchMove(startCanvasPos);},longTouchTimeoutMs);},250);}}};canvas.addEventListener("touchstart",onCanvasTouchStart,{passive:true});// canvas.addEventListener("touchcancel", e => console.log("touchcancel", e), {passive: true});
|
|
2775
|
+
var onCanvasTouchMove=function onCanvasTouchMove(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){onSingleTouchMove(copyCanvasPos(touch,math.vec2()));}};canvas.addEventListener("touchmove",onCanvasTouchMove,{passive:true});var onCanvasTouchEnd=function onCanvasTouchEnd(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){cleanup();var _canvasPos=copyCanvasPos(touch,math.vec2());onCommit(_canvasPos,pickWorldPos(_canvasPos));}};canvas.addEventListener("touchend",onCanvasTouchEnd,{passive:true});return cleanup;};};/** @private */var Wire=/*#__PURE__*/function(){function Wire(parentElement){var _this17=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Wire);this._color=cfg.color||"black";this._highlightClass="viewer-ruler-wire-highlighted";this._wire=document.createElement('div');this._wire.className+=this._wire.className?' viewer-ruler-wire':'viewer-ruler-wire';this._wireClickable=document.createElement('div');this._wireClickable.className+=this._wireClickable.className?' viewer-ruler-wire-clickable':'viewer-ruler-wire-clickable';this._thickness=cfg.thickness||1.0;this._thicknessClickable=cfg.thicknessClickable||6.0;this._visible=true;this._culled=false;var wire=this._wire;var wireStyle=wire.style;wireStyle.border="solid "+this._thickness+"px "+this._color;wireStyle.position="absolute";wireStyle["z-index"]=cfg.zIndex===undefined?"2000001":cfg.zIndex;wireStyle.width=0+"px";wireStyle.height=0+"px";wireStyle.visibility="visible";wireStyle.top=0+"px";wireStyle.left=0+"px";wireStyle['-webkit-transform-origin']="0 0";wireStyle['-moz-transform-origin']="0 0";wireStyle['-ms-transform-origin']="0 0";wireStyle['-o-transform-origin']="0 0";wireStyle['transform-origin']="0 0";wireStyle['-webkit-transform']='rotate(0deg)';wireStyle['-moz-transform']='rotate(0deg)';wireStyle['-ms-transform']='rotate(0deg)';wireStyle['-o-transform']='rotate(0deg)';wireStyle['transform']='rotate(0deg)';wireStyle["opacity"]=1.0;wireStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wire);var wireClickable=this._wireClickable;var wireClickableStyle=wireClickable.style;wireClickableStyle.border="solid "+this._thicknessClickable+"px "+this._color;wireClickableStyle.position="absolute";wireClickableStyle["z-index"]=cfg.zIndex===undefined?"2000002":cfg.zIndex+1;wireClickableStyle.width=0+"px";wireClickableStyle.height=0+"px";wireClickableStyle.visibility="visible";wireClickableStyle.top=0+"px";wireClickableStyle.left=0+"px";// wireClickableStyle["pointer-events"] = "none";
|
|
2775
2776
|
wireClickableStyle['-webkit-transform-origin']="0 0";wireClickableStyle['-moz-transform-origin']="0 0";wireClickableStyle['-ms-transform-origin']="0 0";wireClickableStyle['-o-transform-origin']="0 0";wireClickableStyle['transform-origin']="0 0";wireClickableStyle['-webkit-transform']='rotate(0deg)';wireClickableStyle['-moz-transform']='rotate(0deg)';wireClickableStyle['-ms-transform']='rotate(0deg)';wireClickableStyle['-o-transform']='rotate(0deg)';wireClickableStyle['transform']='rotate(0deg)';wireClickableStyle["opacity"]=0.0;wireClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wireClickable);if(cfg.onMouseOver){wireClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this17);});}if(cfg.onMouseLeave){wireClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this17);});}if(cfg.onMouseWheel){wireClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this17);});}if(cfg.onMouseDown){wireClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this17);});}if(cfg.onMouseUp){wireClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this17);});}if(cfg.onMouseMove){wireClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this17);});}if(cfg.onContextMenu){if(os.isIphoneSafari()){wireClickable.addEventListener('touchstart',function(event){event.preventDefault();if(_this17._timeout){clearTimeout(_this17._timeout);_this17._timeout=null;}_this17._timeout=setTimeout(function(){event.clientX=event.touches[0].clientX;event.clientY=event.touches[0].clientY;cfg.onContextMenu(event,_this17);clearTimeout(_this17._timeout);_this17._timeout=null;},500);});wireClickable.addEventListener('touchend',function(event){event.preventDefault();//stops short touches from calling the timeout
|
|
2776
2777
|
if(_this17._timeout){clearTimeout(_this17._timeout);_this17._timeout=null;}});}else{wireClickable.addEventListener('contextmenu',function(event){console.log(event);cfg.onContextMenu(event,_this17);event.preventDefault();event.stopPropagation();console.log("Label context menu");});}}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}_createClass(Wire,[{key:"visible",get:function get(){return this._wire.style.visibility==="visible";}},{key:"_update",value:function _update(){var length=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2)));var angle=Math.atan2(this._y2-this._y1,this._x2-this._x1)*180.0/Math.PI;var wireStyle=this._wire.style;wireStyle["width"]=Math.round(length)+'px';wireStyle["left"]=Math.round(this._x1)+'px';wireStyle["top"]=Math.round(this._y1)+'px';wireStyle['-webkit-transform']='rotate('+angle+'deg)';wireStyle['-moz-transform']='rotate('+angle+'deg)';wireStyle['-ms-transform']='rotate('+angle+'deg)';wireStyle['-o-transform']='rotate('+angle+'deg)';wireStyle['transform']='rotate('+angle+'deg)';var wireClickableStyle=this._wireClickable.style;wireClickableStyle["width"]=Math.round(length)+'px';wireClickableStyle["left"]=Math.round(this._x1)+'px';wireClickableStyle["top"]=Math.round(this._y1)+'px';wireClickableStyle['-webkit-transform']='rotate('+angle+'deg)';wireClickableStyle['-moz-transform']='rotate('+angle+'deg)';wireClickableStyle['-ms-transform']='rotate('+angle+'deg)';wireClickableStyle['-o-transform']='rotate('+angle+'deg)';wireClickableStyle['transform']='rotate('+angle+'deg)';}},{key:"setStartAndEnd",value:function setStartAndEnd(x1,y1,x2,y2){this._x1=x1;this._y1=y1;this._x2=x2;this._y2=y2;this._update();}},{key:"setColor",value:function setColor(color){this._color=color||"black";this._wire.style.border="solid "+this._thickness+"px "+this._color;}},{key:"setOpacity",value:function setOpacity(opacity){this._wire.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._wire.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._wireClickable.style["pointer-events"]=clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._wire.classList.add(this._highlightClass);}else{this._wire.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(visible){if(this._wire.parentElement){this._wire.parentElement.removeChild(this._wire);}if(this._wireClickable.parentElement){this._wireClickable.parentElement.removeChild(this._wireClickable);}}}]);return Wire;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this18=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Label);this._highlightClass="viewer-ruler-label-highlighted";this._prefix=cfg.prefix||"";this._x=0;this._y=0;this._visible=true;this._culled=false;this._label=document.createElement('div');this._label.className+=this._label.className?' viewer-ruler-label':'viewer-ruler-label';this._timeout=null;var label=this._label;var style=label.style;style["border-radius"]=5+"px";style.color="white";style.padding="4px";style.border="solid 1px";style.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";style.visibility="visible";style.top=0+"px";style.left=0+"px";style["pointer-events"]="all";style["opacity"]=1.0;if(cfg.onContextMenu);label.innerText="";parentElement.appendChild(label);this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.fillColor);this.setText(cfg.text);if(cfg.onMouseOver){label.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this18);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this18);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this18);});}if(cfg.onMouseDown){label.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this18);event.stopPropagation();});}if(cfg.onMouseUp){label.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this18);event.stopPropagation();});}if(cfg.onMouseMove){label.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this18);});}if(cfg.onContextMenu){if(os.isIphoneSafari()){label.addEventListener('touchstart',function(event){event.preventDefault();if(_this18._timeout){clearTimeout(_this18._timeout);_this18._timeout=null;}_this18._timeout=setTimeout(function(){event.clientX=event.touches[0].clientX;event.clientY=event.touches[0].clientY;cfg.onContextMenu(event,_this18);clearTimeout(_this18._timeout);_this18._timeout=null;},500);});label.addEventListener('touchend',function(event){event.preventDefault();//stops short touches from calling the timeout
|
|
2777
2778
|
if(_this18._timeout){clearTimeout(_this18._timeout);_this18._timeout=null;}});}else{label.addEventListener('contextmenu',function(event){console.log(event);cfg.onContextMenu(event,_this18);event.preventDefault();event.stopPropagation();console.log("Label context menu");});}}}_createClass(Label,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosOnWire",value:function setPosOnWire(x1,y1,x2,y2){var x=x1+(x2-x1)*0.5;var y=y1+(y2-y1)*0.5;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosBetweenWires",value:function setPosBetweenWires(x1,y1,x2,y2,x3,y3){var x=(x1+x2+x3)/3;var y=(y1+y2+y3)/3;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setText",value:function setText(text){this._label.innerHTML=this._prefix+(text||"");}},{key:"setFillColor",value:function setFillColor(color){this._fillColor=color||"lightgreen";this._label.style.background=this._fillColor;}},{key:"setBorderColor",value:function setBorderColor(color){this._borderColor=color||"black";this._label.style.border="solid 1px "+this._borderColor;}},{key:"setOpacity",value:function setOpacity(opacity){this._label.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._label.classList.add(this._highlightClass);}else{this._label.classList.remove(this._highlightClass);}}},{key:"setClickable",value:function setClickable(clickable){this._label.style["pointer-events"]=clickable?"all":"none";}},{key:"setPrefix",value:function setPrefix(prefix){if(this._prefix===prefix){return;}this._prefix=prefix;}},{key:"destroy",value:function destroy(){if(this._label.parentElement){this._label.parentElement.removeChild(this._label);}}}]);return Label;}();var originVec=math.vec3();var targetVec=math.vec3();/**
|
|
@@ -4702,7 +4703,7 @@ this._buildPositions();this.positionsDirty=false;this.aabbDirty=true;this.vbosDi
|
|
|
4702
4703
|
this.positionsBuf.setData(new Float32Array(this.positions));// Indices don't need updating
|
|
4703
4704
|
return;}this.positionsBuf.destroy();this.positionsBuf=null;this.indicesBuf.destroy();this.indicesBuf=null;}var gl=this.scene.canvas.gl;var lenPositions=this.numMarkers*3;var lenIndices=this.numMarkers;this.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this.positions),lenPositions,3,gl.STATIC_DRAW);this.indicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indices),lenIndices,1,gl.STATIC_DRAW);this.lenPositionsBuf=this.positions.length;}},{key:"_buildOcclusionTestList",value:function _buildOcclusionTestList(){var canvas=this.scene.canvas;var near=this.scene.camera.perspective.near;// Assume near enough to ortho near
|
|
4704
4705
|
var boundary=canvas.boundary;var canvasWidth=boundary[2];var canvasHeight=boundary[3];var lenPixels=0;this.lenOcclusionTestList=0;for(var _i53=0;_i53<this.numMarkers;_i53++){var marker=this.markerList[_i53];var _viewPos=marker.viewPos;if(_viewPos[2]>-near){// Clipped by near plane
|
|
4705
|
-
marker._setVisible(false);continue;}var
|
|
4706
|
+
marker._setVisible(false);continue;}var _canvasPos2=marker.canvasPos;var canvasX=_canvasPos2[0];var canvasY=_canvasPos2[1];if(canvasX+10<0||canvasY+10<0||canvasX-10>canvasWidth||canvasY-10>canvasHeight){marker._setVisible(false);continue;}if(marker.entity&&!marker.entity.visible){marker._setVisible(false);continue;}if(marker.occludable){this.occlusionTestList[this.lenOcclusionTestList++]=marker;this.pixels[lenPixels++]=canvasX;this.pixels[lenPixels++]=canvasY;continue;}marker._setVisible(true);}}},{key:"_updateActiveSectionPlanes",value:function _updateActiveSectionPlanes(){var sectionPlanes=this.scene._sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;if(numSectionPlanes>0){for(var _i54=0;_i54<numSectionPlanes;_i54++){var sectionPlane=sectionPlanes[_i54];if(!sectionPlane.active){this.sectionPlanesActive[_i54]=false;}else{var intersect=math.planeAABB3Intersect(sectionPlane.dir,sectionPlane.dist,this.aabb);var outside=intersect===-1;if(outside){this.culledBySectionPlanes=true;return;}var intersecting=intersect===0;this.sectionPlanesActive[_i54]=intersecting;}}}this.culledBySectionPlanes=false;}},{key:"destroy",value:function destroy(){this.markers={};this.markerList.length=0;if(this.positionsBuf){this.positionsBuf.destroy();}if(this.indicesBuf){this.indicesBuf.destroy();}}}]);return OcclusionLayer;}();var MARKER_COLOR=math.vec3([1.0,0.0,0.0]);var POINT_SIZE=20;var tempVec3a$J=math.vec3();/**
|
|
4706
4707
|
* Manages occlusion testing. Private member of a Renderer.
|
|
4707
4708
|
* @private
|
|
4708
4709
|
*/var OcclusionTester=/*#__PURE__*/function(){function OcclusionTester(scene,renderBufferManager){var _this33=this;_classCallCheck(this,OcclusionTester);this._scene=scene;this._renderBufferManager=renderBufferManager;this._occlusionLayers={};this._occlusionLayersList=[];this._occlusionLayersListDirty=false;this._shaderSource=null;this._program=null;this._shaderSourceHash=null;this._shaderSourceDirty=true;// Need to build shader source code ?
|
|
@@ -15040,7 +15041,7 @@ this._silhouetteRenderer=new TrianglesSilhouetteRenderer$1(this._scene);}if(!thi
|
|
|
15040
15041
|
* Gets the maximum batched geometry VBO size.
|
|
15041
15042
|
*/function get(){return maxGeometryBatchSize;},set:function set(value){if(value<100000){value=100000;}else if(value>5000000){value=5000000;}maxGeometryBatchSize=value;}}]);return Configs;}();var configs$2=new Configs();/**
|
|
15042
15043
|
* @private
|
|
15043
|
-
*/var VBOBatchingTrianglesBuffer=/*#__PURE__*/_createClass(function VBOBatchingTrianglesBuffer(){_classCallCheck(this,VBOBatchingTrianglesBuffer);this.maxVerts=
|
|
15044
|
+
*/var VBOBatchingTrianglesBuffer=/*#__PURE__*/_createClass(function VBOBatchingTrianglesBuffer(){var maxBatchSize=arguments.length>0&&arguments[0]!==undefined?arguments[0]:configs$2.maxGeometryBatchSize;_classCallCheck(this,VBOBatchingTrianglesBuffer);this.maxVerts=maxBatchSize;this.maxIndices=maxBatchSize*3;// Rough rule-of-thumb
|
|
15044
15045
|
this.positions=[];this.colors=[];this.uv=[];this.metallicRoughness=[];this.normals=[];this.pickColors=[];this.offsets=[];this.indices=[];this.edgeIndices=[];});var translate=math.mat4();var scale=math.mat4();/**
|
|
15045
15046
|
* @private
|
|
15046
15047
|
*/function quantizePositions(positions,aabb,positionsDecodeMatrix){// http://cg.postech.ac.kr/research/mesh_comp_mobile/mesh_comp_mobile_conference.pdf
|
|
@@ -18927,7 +18928,9 @@ cfg.normals=null;}this._geometries[cfg.id]=cfg;this._numTriangles+=cfg.indices?M
|
|
|
18927
18928
|
* @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
|
|
18928
18929
|
*/},{key:"createTexture",value:function createTexture(cfg){var _this81=this;var textureId=cfg.id;if(textureId===undefined||textureId===null){this.error("[createTexture] Config missing: id");return;}if(this._textures[textureId]){this.error("[createTexture] Texture already created: "+textureId);return;}if(!cfg.src&&!cfg.image&&!cfg.buffers){this.error("[createTexture] Param expected: `src`, `image' or 'buffers'");return null;}var minFilter=cfg.minFilter||LinearMipmapLinearFilter;if(minFilter!==LinearFilter&&minFilter!==LinearMipMapNearestFilter&&minFilter!==LinearMipmapLinearFilter&&minFilter!==NearestMipMapLinearFilter&&minFilter!==NearestMipMapNearestFilter){this.error("[createTexture] Unsupported value for 'minFilter' - \n supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, \n NearestMipMapLinearFilter and LinearMipmapLinearFilter. Defaulting to LinearMipmapLinearFilter.");minFilter=LinearMipmapLinearFilter;}var magFilter=cfg.magFilter||LinearFilter;if(magFilter!==LinearFilter&&magFilter!==NearestFilter){this.error("[createTexture] Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");magFilter=LinearFilter;}var wrapS=cfg.wrapS||RepeatWrapping;if(wrapS!==ClampToEdgeWrapping&&wrapS!==MirroredRepeatWrapping&&wrapS!==RepeatWrapping){this.error("[createTexture] Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");wrapS=RepeatWrapping;}var wrapT=cfg.wrapT||RepeatWrapping;if(wrapT!==ClampToEdgeWrapping&&wrapT!==MirroredRepeatWrapping&&wrapT!==RepeatWrapping){this.error("[createTexture] Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");wrapT=RepeatWrapping;}var wrapR=cfg.wrapR||RepeatWrapping;if(wrapR!==ClampToEdgeWrapping&&wrapR!==MirroredRepeatWrapping&&wrapR!==RepeatWrapping){this.error("[createTexture] Unsupported value for 'wrapR' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");wrapR=RepeatWrapping;}var encoding=cfg.encoding||LinearEncoding;if(encoding!==LinearEncoding&&encoding!==sRGBEncoding){this.error("[createTexture] Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");encoding=LinearEncoding;}var texture=new Texture2D({gl:this.scene.canvas.gl,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,// flipY: cfg.flipY,
|
|
18929
18930
|
encoding:encoding});if(cfg.preloadColor){texture.setPreloadColor(cfg.preloadColor);}if(cfg.image){// Ignore transcoder for Images
|
|
18930
|
-
var _image2=cfg.image;_image2.crossOrigin="Anonymous";
|
|
18931
|
+
var _image2=cfg.image;_image2.crossOrigin="Anonymous";if(_image2.compressed){// see `parsedImage` in @loaders.gl/gltf/src/lib/parsers/parse-gltf.ts
|
|
18932
|
+
// NOTE: @loaders.gl in its current version discards potential mipmaps, leaving only a single one
|
|
18933
|
+
var data=_image2.data;texture.setCompressedData({mipmaps:data,props:{format:data[0].format,minFilter:minFilter,magFilter:magFilter}});}else{texture.setImage(_image2,{minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,flipY:cfg.flipY,encoding:encoding});}}else if(cfg.src){var ext=cfg.src.split('.').pop();switch(ext){// Don't transcode recognized image file types
|
|
18931
18934
|
case"jpeg":case"jpg":case"png":case"gif":var _image3=new Image();_image3.onload=function(){texture.setImage(_image3,{minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,flipY:cfg.flipY,encoding:encoding});_this81.glRedraw();};_image3.src=cfg.src;// URL or Base64 string
|
|
18932
18935
|
break;default:// Assume other file types need transcoding
|
|
18933
18936
|
if(!this._textureTranscoder){this.error("[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('".concat(ext,"')"));}else{utils.loadArraybuffer(cfg.src,function(arrayBuffer){if(!arrayBuffer.byteLength){_this81.error("[createTexture] Can't create texture from 'src': file data is zero length");return;}_this81._textureTranscoder.transcode([arrayBuffer],texture).then(function(){_this81.glRedraw();});},function(errMsg){this.error("[createTexture] Can't create texture from 'src': ".concat(errMsg));});}break;}}else if(cfg.buffers){// Buffers implicitly require transcoding
|
|
@@ -19652,12 +19655,12 @@ _this86._xAxisLabelCulled=false;_this86._yAxisLabelCulled=false;_this86._zAxisLa
|
|
|
19652
19655
|
*
|
|
19653
19656
|
* @type {number[]}
|
|
19654
19657
|
*/function get(){return this._axesBasis;},set:function set(value){this._axesBasis=value.slice();this._wpDirty=true;this._needUpdate(0);// No lag
|
|
19655
|
-
}},{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){
|
|
19658
|
+
}},{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){var delta=math.subVec3(this._targetWorld,this._originWorld,tmpVec3);/**
|
|
19659
|
+
* The length detected for each measurement axis.
|
|
19660
|
+
*/this._factors=math.transformVec3(this._axesBasis,delta);this._measurementOrientation=determineMeasurementOrientation(this._originWorld,this._targetWorld,0);if(this._measurementOrientation==='Vertical'&&this.useRotationAdjustment){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._originWorld[0];//x-axis
|
|
19656
19661
|
this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._originWorld[0];//x-axis
|
|
19657
19662
|
this._wp[9]=this._targetWorld[1];//y-axis
|
|
19658
|
-
this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;}else{var
|
|
19659
|
-
* The length detected for each measurement axis.
|
|
19660
|
-
*/this._factors=math.transformVec3(this._axesBasis,delta);this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._originWorld[0]+this._axesBasis[0]*this._factors[0];this._wp[5]=this._originWorld[1]+this._axesBasis[4]*this._factors[0];this._wp[6]=this._originWorld[2]+this._axesBasis[8]*this._factors[0];this._wp[7]=1.0;this._wp[8]=this._originWorld[0]+this._axesBasis[0]*this._factors[0]+this._axesBasis[1]*this._factors[1];this._wp[9]=this._originWorld[1]+this._axesBasis[4]*this._factors[0]+this._axesBasis[5]*this._factors[1];this._wp[10]=this._originWorld[2]+this._axesBasis[8]*this._factors[0]+this._axesBasis[9]*this._factors[1];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;}this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originDot.viewPos[2];var vpz2=this._targetDot.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs(this._factors[0]*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs(this._factors[1]*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){if(this._measurementOrientation==='Vertical'&&this.useRotationAdjustment){this._zAxisLabel.setPrefix("");this._zAxisLabel.setText(tilde+Math.abs(math.lenVec3(math.subVec3(this._targetWorld,[this._originWorld[0],this._targetWorld[1],this._originWorld[2]],distVec3))*_scale5).toFixed(2)+unitAbbrev);}else{this._zAxisLabel.setPrefix("Z");this._zAxisLabel.setText(tilde+Math.abs(this._factors[2]*_scale5).toFixed(2)+unitAbbrev);}this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
|
|
19663
|
+
this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;}else{this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._originWorld[0]+this._axesBasis[0]*this._factors[0];this._wp[5]=this._originWorld[1]+this._axesBasis[4]*this._factors[0];this._wp[6]=this._originWorld[2]+this._axesBasis[8]*this._factors[0];this._wp[7]=1.0;this._wp[8]=this._originWorld[0]+this._axesBasis[0]*this._factors[0]+this._axesBasis[1]*this._factors[1];this._wp[9]=this._originWorld[1]+this._axesBasis[4]*this._factors[0]+this._axesBasis[5]*this._factors[1];this._wp[10]=this._originWorld[2]+this._axesBasis[8]*this._factors[0]+this._axesBasis[9]*this._factors[1];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;}this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originDot.viewPos[2];var vpz2=this._targetDot.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs(this._factors[0]*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs(this._factors[1]*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){if(this._measurementOrientation==='Vertical'&&this.useRotationAdjustment){this._zAxisLabel.setPrefix("");this._zAxisLabel.setText(tilde+Math.abs(math.lenVec3(math.subVec3(this._targetWorld,[this._originWorld[0],this._targetWorld[1],this._originWorld[2]],distVec3))*_scale5).toFixed(2)+unitAbbrev);}else{this._zAxisLabel.setPrefix("Z");this._zAxisLabel.setText(tilde+Math.abs(this._factors[2]*_scale5).toFixed(2)+unitAbbrev);}this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
|
|
19661
19664
|
// this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);
|
|
19662
19665
|
// this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);
|
|
19663
19666
|
// this._lengthLabel.setVisible(false);
|
|
@@ -20704,7 +20707,11 @@ return pickResult&&pickResult.worldPos?pickResult.worldPos:snap&&tryPickWorldPos
|
|
|
20704
20707
|
* Default data access strategy for {@link GLTFLoaderPlugin}.
|
|
20705
20708
|
*
|
|
20706
20709
|
* This just loads assets using XMLHttpRequest.
|
|
20707
|
-
*/var GLTFDefaultDataSource=/*#__PURE__*/function(){function GLTFDefaultDataSource(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,GLTFDefaultDataSource)
|
|
20710
|
+
*/var GLTFDefaultDataSource=/*#__PURE__*/function(){function GLTFDefaultDataSource(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,GLTFDefaultDataSource);/**
|
|
20711
|
+
* Set `true` to enable cache busting for HTTP GETs.
|
|
20712
|
+
* This is `true` by default.
|
|
20713
|
+
* @type {boolean}
|
|
20714
|
+
*/this.cacheBuster=cfg.cacheBuster!==false;}_createClass(GLTFDefaultDataSource,[{key:"_cacheBusterURL",value:function _cacheBusterURL(url){if(!this.cacheBuster){return url;}var timestamp=new Date().getTime();if(url.indexOf('?')>-1){return url+'&_='+timestamp;}else{return url+'?_='+timestamp;}}/**
|
|
20708
20715
|
* Gets metamodel JSON.
|
|
20709
20716
|
*
|
|
20710
20717
|
* @param {String|Number} metaModelSrc Identifies the metamodel JSON asset.
|
|
@@ -27132,7 +27139,7 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
27132
27139
|
* @param {Object} node The node to create.
|
|
27133
27140
|
|
|
27134
27141
|
* @return {HTMLElement} The html element for the node.
|
|
27135
|
-
*/},{key:"createNodeElement",value:function createNodeElement(node,expandHandler,checkHandler,contextmenuHandler,titleClickHandler){var nodeElement=document.createElement('li');nodeElement.id=node.nodeId;if(node.xrayed){nodeElement.classList.add('xrayed-node');}if(node.children.length>0){var switchElement=document.createElement('a');switchElement.href='#';switchElement.id="switch-".concat(node.nodeId);switchElement.textContent='+';switchElement.classList.add('plus');if(expandHandler)switchElement.addEventListener('click',expandHandler);nodeElement.appendChild(switchElement);}var checkbox=document.createElement('input');checkbox.id="checkbox-".concat(node.nodeId);checkbox.type="checkbox";checkbox.checked=node.checked;checkbox.style["pointer-events"]="all";if(checkHandler)checkbox.addEventListener("change",checkHandler);nodeElement.appendChild(checkbox);var span=document.createElement('span');span.textContent=node.title;nodeElement.appendChild(span);if(contextmenuHandler){span.oncontextmenu=contextmenuHandler;}if(titleClickHandler){span.onclick=titleClickHandler;}return nodeElement;}},{key:"createDisabledNodeElement",value:function createDisabledNodeElement(rootName){var li=document.createElement('li');var switchElement=document.createElement('a');switchElement.href='#';switchElement.textContent='!';switchElement.classList.add('warn');switchElement.classList.add('warning');li.appendChild(switchElement);var span=document.createElement('span');span.textContent=rootName;li.appendChild(span);return li;}},{key:"addChildren",value:function addChildren(element,nodes){var ul=document.createElement('ul');nodes.forEach(function(nodeElement){ul.appendChild(nodeElement);});element.parentElement.appendChild(ul);}},{key:"expand",value:function expand(element,expandHandler,collapseHandler){element.classList.remove('plus');element.classList.add('minus');element.textContent='-';element.removeEventListener('click',expandHandler);element.addEventListener('click',collapseHandler);}},{key:"collapse",value:function collapse(element,expandHandler,collapseHandler){if(!element){return;}var parent=element.parentElement;if(!parent){return;}var ul=parent.querySelector('ul');if(!ul){return;}parent.removeChild(ul);element.classList.remove('minus');element.classList.add('plus');element.textContent='+';element.removeEventListener('click',collapseHandler);element.addEventListener('click',expandHandler);}},{key:"isExpanded",value:function isExpanded(element){var parentElement=element.parentElement;return parentElement.getElementsByTagName('li')[0]!==undefined;}},{key:"getId",value:function getId(element){var parentElement=element.parentElement;return parentElement.id;}},{key:"getIdFromCheckbox",value:function getIdFromCheckbox(element){return element.id.replace('checkbox-','');}},{key:"getSwitchElement",value:function getSwitchElement(nodeId){return document.getElementById("switch-".concat(nodeId));}},{key:"isChecked",value:function isChecked(element){return element.checked;}},{key:"setCheckbox",value:function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}},{key:"setXRayed",value:function setXRayed(nodeId,xrayed){var treeNode=document.getElementById(nodeId);if(treeNode){if(xrayed){treeNode.classList.add('xrayed-node');}else{treeNode.classList.remove('xrayed-node');}}}},{key:"setHighlighted",value:function setHighlighted(nodeId,highlighted){var treeNode=document.getElementById(nodeId);if(treeNode){if(highlighted){treeNode.scrollIntoView({block:"center"});treeNode.classList.add('highlighted-node');}else{treeNode.classList.remove('highlighted-node');}}}}]);return RenderService;}();var treeViews=[];/**
|
|
27142
|
+
*/},{key:"createNodeElement",value:function createNodeElement(node,expandHandler,checkHandler,contextmenuHandler,titleClickHandler){var nodeElement=document.createElement('li');nodeElement.id=node.nodeId;if(node.xrayed){nodeElement.classList.add('xrayed-node');}if(node.children.length>0){var switchElement=document.createElement('a');switchElement.href='#';switchElement.id="switch-".concat(node.nodeId);switchElement.textContent='+';switchElement.classList.add('plus');if(expandHandler)switchElement.addEventListener('click',expandHandler);nodeElement.appendChild(switchElement);}var checkbox=document.createElement('input');checkbox.id="checkbox-".concat(node.nodeId);checkbox.type="checkbox";checkbox.checked=node.checked;checkbox.style["pointer-events"]="all";if(checkHandler)checkbox.addEventListener("change",checkHandler);nodeElement.appendChild(checkbox);var span=document.createElement('span');span.textContent=node.title;nodeElement.appendChild(span);if(contextmenuHandler){span.oncontextmenu=contextmenuHandler;}if(titleClickHandler){span.onclick=titleClickHandler;}return nodeElement;}},{key:"createDisabledNodeElement",value:function createDisabledNodeElement(rootName){var li=document.createElement('li');var switchElement=document.createElement('a');switchElement.href='#';switchElement.textContent='!';switchElement.classList.add('warn');switchElement.classList.add('warning');li.appendChild(switchElement);var span=document.createElement('span');span.textContent=rootName;li.appendChild(span);return li;}},{key:"addChildren",value:function addChildren(element,nodes){var ul=document.createElement('ul');nodes.forEach(function(nodeElement){ul.appendChild(nodeElement);});element.parentElement.appendChild(ul);}},{key:"expand",value:function expand(element,expandHandler,collapseHandler){element.classList.remove('plus');element.classList.add('minus');element.textContent='-';element.removeEventListener('click',expandHandler);element.addEventListener('click',collapseHandler);}},{key:"collapse",value:function collapse(element,expandHandler,collapseHandler){if(!element){return;}var parent=element.parentElement;if(!parent){return;}var ul=parent.querySelector('ul');if(!ul){return;}parent.removeChild(ul);element.classList.remove('minus');element.classList.add('plus');element.textContent='+';element.removeEventListener('click',collapseHandler);element.addEventListener('click',expandHandler);}},{key:"isExpanded",value:function isExpanded(element){var parentElement=element.parentElement;return parentElement.getElementsByTagName('li')[0]!==undefined;}},{key:"getId",value:function getId(element){var parentElement=element.parentElement;return parentElement.id;}},{key:"getIdFromCheckbox",value:function getIdFromCheckbox(element){return element.id.replace('checkbox-','');}},{key:"getSwitchElement",value:function getSwitchElement(nodeId){return document.getElementById("switch-".concat(nodeId));}},{key:"isChecked",value:function isChecked(element){return element.checked;}},{key:"setCheckbox",value:function setCheckbox(nodeId,checked){var indeterminate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}if(indeterminate!==checkbox.indeterminate){checkbox.indeterminate=indeterminate;}}}},{key:"setXRayed",value:function setXRayed(nodeId,xrayed){var treeNode=document.getElementById(nodeId);if(treeNode){if(xrayed){treeNode.classList.add('xrayed-node');}else{treeNode.classList.remove('xrayed-node');}}}},{key:"setHighlighted",value:function setHighlighted(nodeId,highlighted){var treeNode=document.getElementById(nodeId);if(treeNode){if(highlighted){treeNode.scrollIntoView({block:"center"});treeNode.classList.add('highlighted-node');}else{treeNode.classList.remove('highlighted-node');}}}}]);return RenderService;}();var treeViews=[];/**
|
|
27136
27143
|
* @desc A {@link Viewer} plugin that provides an HTML tree view to navigate the IFC elements in models.
|
|
27137
27144
|
* <br>
|
|
27138
27145
|
*
|
|
@@ -27487,7 +27494,8 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
27487
27494
|
* vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
|
|
27488
27495
|
* @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
|
|
27489
27496
|
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
|
|
27490
|
-
|
|
27497
|
+
* @param {Boolean} [cfg.showIndeterminate=false] When true, will show indeterminate state for checkboxes when some but not all child nodes are checked
|
|
27498
|
+
*/function TreeViewPlugin(viewer){var _cfg$showIndeterminat;var _this152;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this152=_super166.call(this,"TreeViewPlugin",viewer);/**
|
|
27491
27499
|
* Contains messages for any errors found while last rebuilding this TreeView.
|
|
27492
27500
|
* @type {String[]}
|
|
27493
27501
|
*/_this152.errors=[];/**
|
|
@@ -27496,9 +27504,9 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
27496
27504
|
*/_this152.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this152.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this152);}for(var _i544=0;;_i544++){if(!treeViews[_i544]){treeViews[_i544]=_assertThisInitialized(_this152);_this152._index=_i544;_this152._id="tree-".concat(_i544);break;}}_this152._containerElement=containerElement;_this152._metaModels={};_this152._autoAddModels=cfg.autoAddModels!==false;_this152._autoExpandDepth=cfg.autoExpandDepth||0;_this152._sortNodes=cfg.sortNodes!==false;_this152._viewer=viewer;_this152._rootElement=null;_this152._muteSceneEvents=false;_this152._muteTreeEvents=false;_this152._rootNodes=[];_this152._objectNodes={};// Object ID -> Node
|
|
27497
27505
|
_this152._nodeNodes={};// Node ID -> Node
|
|
27498
27506
|
_this152._rootNames={};// Node ID -> Root name
|
|
27499
|
-
_this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;_this152._showListItemElementId=null;_this152._renderService=cfg.renderService||new RenderService();if(!_this152._renderService){throw new Error('TreeViewPlugin: no render service set');}_this152._containerElement.oncontextmenu=function(e){e.preventDefault();};_this152._onObjectVisibility=_this152._viewer.scene.on("objectVisibility",function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
27500
|
-
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this152._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this152._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}_this152._muteTreeEvents=false;});_this152._onObjectXrayed=_this152._viewer.scene.on('objectXRayed',function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
27501
|
-
}_this152._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this152._renderService.setXRayed(node.nodeId,xrayed);_this152._muteTreeEvents=false;});_this152._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._expandSwitchElement(switchElement);};_this152._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._collapseSwitchElement(switchElement);};_this152._checkboxChangeHandler=function(event){if(_this152._muteTreeEvents){return;}_this152._muteSceneEvents=true;var checkbox=event.target;var visible=_this152._renderService.isChecked(checkbox);var nodeId=_this152._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this152._nodeNodes[nodeId];var objects=_this152._viewer.scene.objects;var numUpdated=0;_this152._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this152._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}_this152._muteSceneEvents=false;};_this152._hierarchy=cfg.hierarchy||"containment";_this152._autoExpandDepth=cfg.autoExpandDepth||0;if(_this152._autoAddModels){var modelIds=Object.keys(_this152.viewer.metaScene.metaModels);for(var _i545=0,len=modelIds.length;_i545<len;_i545++){var modelId=modelIds[_i545];var metaModel=_this152.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this152.addModel(modelId);}}_this152.viewer.scene.on("modelLoaded",function(modelId){if(_this152.viewer.metaScene.metaModels[modelId]){_this152.addModel(modelId);}});}_this152.hierarchy=cfg.hierarchy;return _this152;}/**
|
|
27507
|
+
_this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;_this152._showListItemElementId=null;_this152._renderService=cfg.renderService||new RenderService();_this152._showIndeterminate=(_cfg$showIndeterminat=cfg.showIndeterminate)!==null&&_cfg$showIndeterminat!==void 0?_cfg$showIndeterminat:false;if(!_this152._renderService){throw new Error('TreeViewPlugin: no render service set');}_this152._containerElement.oncontextmenu=function(e){e.preventDefault();};_this152._onObjectVisibility=_this152._viewer.scene.on("objectVisibility",function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
27508
|
+
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this152._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this152._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this152._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0,indeterminate);parent=parent.parent;}_this152._muteTreeEvents=false;});_this152._onObjectXrayed=_this152._viewer.scene.on('objectXRayed',function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
27509
|
+
}_this152._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this152._renderService.setXRayed(node.nodeId,xrayed);_this152._muteTreeEvents=false;});_this152._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._expandSwitchElement(switchElement);};_this152._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._collapseSwitchElement(switchElement);};_this152._checkboxChangeHandler=function(event){if(_this152._muteTreeEvents){return;}_this152._muteSceneEvents=true;var checkbox=event.target;var visible=_this152._renderService.isChecked(checkbox);var nodeId=_this152._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this152._nodeNodes[nodeId];var objects=_this152._viewer.scene.objects;var numUpdated=0;_this152._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this152._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}var indeterminate=_this152._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0,indeterminate);parent=parent.parent;}_this152._muteSceneEvents=false;};_this152._hierarchy=cfg.hierarchy||"containment";_this152._autoExpandDepth=cfg.autoExpandDepth||0;if(_this152._autoAddModels){var modelIds=Object.keys(_this152.viewer.metaScene.metaModels);for(var _i545=0,len=modelIds.length;_i545<len;_i545++){var modelId=modelIds[_i545];var metaModel=_this152.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this152.addModel(modelId);}}_this152.viewer.scene.on("modelLoaded",function(modelId){if(_this152.viewer.metaScene.metaModels[modelId]){_this152.addModel(modelId);}});}_this152.hierarchy=cfg.hierarchy;return _this152;}/**
|
|
27502
27510
|
* Sets how the nodes are organized within this tree view.
|
|
27503
27511
|
*
|
|
27504
27512
|
* Accepted values are:
|
|
@@ -27552,7 +27560,7 @@ _this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;
|
|
|
27552
27560
|
*
|
|
27553
27561
|
* @param {String} objectId ID of the {@link Entity}.
|
|
27554
27562
|
*/},{key:"showNode",value:function showNode(objectId){this.unShowNode();var node=this._objectNodes[objectId];if(!node){return;// Node may not exist for the given object if (this._pruneEmptyNodes == true)
|
|
27555
|
-
}var nodeId=node.nodeId;var switchElement=this._renderService.getSwitchElement(nodeId);if(switchElement){this._expandSwitchElement(switchElement);switchElement.scrollIntoView();return true;}var path=[];path.unshift(node);var parent=node.parent;while(parent){path.unshift(parent);parent=parent.parent;}for(var _i546=0,len=path.length;_i546<len;_i546++){var _switchElement=this._renderService.getSwitchElement(path[_i546].nodeId);if(_switchElement){this._expandSwitchElement(_switchElement);}}this._renderService.setHighlighted(nodeId,true);this._showListItemElementId=nodeId;}/**
|
|
27563
|
+
}this.collapse();var nodeId=node.nodeId;var switchElement=this._renderService.getSwitchElement(nodeId);if(switchElement){this._expandSwitchElement(switchElement);switchElement.scrollIntoView();return true;}var path=[];path.unshift(node);var parent=node.parent;while(parent){path.unshift(parent);parent=parent.parent;}for(var _i546=0,len=path.length;_i546<len;_i546++){var _switchElement=this._renderService.getSwitchElement(path[_i546].nodeId);if(_switchElement){this._expandSwitchElement(_switchElement);}}this._renderService.setHighlighted(nodeId,true);this._showListItemElementId=nodeId;}/**
|
|
27556
27564
|
* De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.
|
|
27557
27565
|
*
|
|
27558
27566
|
* Does nothing if no node is currently shown.
|
|
@@ -27566,7 +27574,7 @@ _this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;
|
|
|
27566
27574
|
* @param {Number} depth Depth to expand to.
|
|
27567
27575
|
*/},{key:"expandToDepth",value:function expandToDepth(depth){var _this154=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this154._renderService.getSwitchElement(node.nodeId);if(switchElement){_this154._expandSwitchElement(switchElement);var childNodes=node.children;for(var i=0,len=childNodes.length;i<len;i++){var childNode=childNodes[i];expand(childNode,countDepth+1);}}};for(var _i547=0,len=this._rootNodes.length;_i547<len;_i547++){var rootNode=this._rootNodes[_i547];expand(rootNode,0);}}/**
|
|
27568
27576
|
* Closes all the nodes in the tree.
|
|
27569
|
-
*/},{key:"collapse",value:function collapse(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];var
|
|
27577
|
+
*/},{key:"collapse",value:function collapse(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
|
|
27570
27578
|
* Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
|
|
27571
27579
|
* node in depth-first pre-order.
|
|
27572
27580
|
*
|
|
@@ -30116,8 +30124,8 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30116
30124
|
* set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.
|
|
30117
30125
|
* * When loading, can set the World-space position, scale and rotation of each model within World space,
|
|
30118
30126
|
* along with initial properties for all the model's {@link Entity}s.
|
|
30119
|
-
* * Allows to mask which
|
|
30120
|
-
* * Allows to configure initial viewer state for specified
|
|
30127
|
+
* * Allows to mask which types we want to load.
|
|
30128
|
+
* * Allows to configure initial viewer state for specified types (color, visibility, selection, highlighted, X-rayed, pickable, etc).
|
|
30121
30129
|
*
|
|
30122
30130
|
* ## Usage
|
|
30123
30131
|
*
|
|
@@ -30187,9 +30195,9 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30187
30195
|
* });
|
|
30188
30196
|
* ````
|
|
30189
30197
|
*
|
|
30190
|
-
* ## Including and excluding
|
|
30198
|
+
* ## Including and excluding types
|
|
30191
30199
|
*
|
|
30192
|
-
* We can also load only those objects that have the specified
|
|
30200
|
+
* We can also load only those objects that have the specified types. In the example below, we'll load only the
|
|
30193
30201
|
* objects that represent walls.
|
|
30194
30202
|
*
|
|
30195
30203
|
* ````javascript
|
|
@@ -30200,7 +30208,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30200
30208
|
* });
|
|
30201
30209
|
* ````
|
|
30202
30210
|
*
|
|
30203
|
-
* We can also load only those objects that **don't** have the specified
|
|
30211
|
+
* We can also load only those objects that **don't** have the specified types. In the example below, we'll load only the
|
|
30204
30212
|
* objects that do not represent empty space.
|
|
30205
30213
|
*
|
|
30206
30214
|
* ````javascript
|
|
@@ -30211,13 +30219,13 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30211
30219
|
* });
|
|
30212
30220
|
* ````
|
|
30213
30221
|
*
|
|
30214
|
-
* # Configuring initial
|
|
30222
|
+
* # Configuring initial object appearances
|
|
30215
30223
|
*
|
|
30216
|
-
* We can specify the custom initial appearance of loaded objects according to their
|
|
30224
|
+
* We can specify the custom initial appearance of loaded objects according to their types.
|
|
30217
30225
|
*
|
|
30218
30226
|
* This is useful for things like:
|
|
30219
30227
|
*
|
|
30220
|
-
* * setting the colors to our objects according to their
|
|
30228
|
+
* * setting the colors to our objects according to their types,
|
|
30221
30229
|
* * automatically hiding ````IfcSpace```` objects, and
|
|
30222
30230
|
* * ensuring that ````IfcWindow```` objects are always transparent.
|
|
30223
30231
|
* <br>
|
|
@@ -30249,7 +30257,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30249
30257
|
* });
|
|
30250
30258
|
* ````
|
|
30251
30259
|
*
|
|
30252
|
-
* When we don't customize the appearance of
|
|
30260
|
+
* When we don't customize the appearance of types, as just above, then IfcSpace elements tend to obscure other
|
|
30253
30261
|
* elements, which can be confusing.
|
|
30254
30262
|
*
|
|
30255
30263
|
* It's often helpful to make IfcSpaces transparent and unpickable, like this:
|
|
@@ -30368,7 +30376,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30368
30376
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
|
|
30369
30377
|
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this177=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,backfaces:params.backfaces,dtxEnabled:params.dtxEnabled,rotation:params.rotation,origin:params.origin}));var modelId=sceneModel.id;// In case ID was auto-generated
|
|
30370
30378
|
if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
|
|
30371
|
-
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i609=0,len=params.includeTypes.length;_i609<len;_i609++){includeTypes[params.includeTypes[_i609]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i610=0,_len128=params.excludeTypes.length;_i610<_len128;_i610++){includeTypes[params.excludeTypes[_i610]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshLoaded={};var
|
|
30379
|
+
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i609=0,len=params.includeTypes.length;_i609<len;_i609++){includeTypes[params.includeTypes[_i609]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i610=0,_len128=params.excludeTypes.length;_i610<_len128;_i610++){includeTypes[params.excludeTypes[_i610]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshLoaded={};var projectId=math.createUUID();var siteId=math.createUUID();var buildingId=math.createUUID();var buildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:projectId,name:"Project",type:"Project",parent:null},{id:siteId,name:"Site",type:"Site",parent:projectId},{id:buildingId,name:"Building",type:"Building",parent:siteId},{id:buildingStoryId,name:"BuildingStorey",type:"BuildingStorey",parent:buildingId}],propertySets:[]};var parseDBMesh=function parseDBMesh(dbMeshId,element){if(dbMeshLoaded[dbMeshId]){return;}var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;var _loop8=function _loop8(_i611,_len129){var element=dbElements[_i611];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){return"continue";}if(includeTypes&&!includeTypes[elementType]){return"continue";}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i611;var dbMeshId=element.mesh_id;var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;if(element.face_colors===undefined){parseDBMesh(dbMeshId,element);var meshId="".concat(objectId,"-mesh");var _color12=element.color?[element.color.r/255.0,element.color.g/255.0,element.color.b/255.0]:[1,1,1];var _opacity7=element.color?element.color.a/255.0:1.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color12=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity7=props.opacity;}}sceneModel.createMesh({id:meshId,geometryId:dbMeshId,color:_color12,opacity:_opacity7,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});sceneModel.createEntity({id:objectId,meshIds:[meshId],visible:visible,pickable:pickable,isObject:true});}else{var faceColors=element.face_colors;var coloredTrianglesDictionary={};var currentTriangleIndicesCount=0;var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});for(var _i612=0,_len130=faceColors.length;_i612<_len130;_i612+=4){var faceColor=[faceColors[_i612],faceColors[_i612+1],faceColors[_i612+2],faceColors[_i612+3]];if(coloredTrianglesDictionary[faceColor]===undefined){coloredTrianglesDictionary[faceColor]=[];}var indexForPoint0=dbMesh.indices[currentTriangleIndicesCount];var x0=dbMesh.coordinates[indexForPoint0*3];var y0=dbMesh.coordinates[indexForPoint0*3+1];var z0=dbMesh.coordinates[indexForPoint0*3+2];var indexForPoint1=dbMesh.indices[currentTriangleIndicesCount+1];var x1=dbMesh.coordinates[indexForPoint1*3];var y1=dbMesh.coordinates[indexForPoint1*3+1];var z1=dbMesh.coordinates[indexForPoint1*3+2];var indexForPoint2=dbMesh.indices[currentTriangleIndicesCount+2];var x2=dbMesh.coordinates[indexForPoint2*3];var y2=dbMesh.coordinates[indexForPoint2*3+1];var z2=dbMesh.coordinates[indexForPoint2*3+2];coloredTrianglesDictionary[faceColor].push(x0,y0,z0,x1,y1,z1,x2,y2,z2);currentTriangleIndicesCount+=3;}var meshIds=[];for(var _i613=0,_Object$entries5=Object.entries(coloredTrianglesDictionary);_i613<_Object$entries5.length;_i613++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i613],2),_faceColor=_Object$entries5$_i[0],trianglesCoordinates=_Object$entries5$_i[1];sceneModel.createGeometry({id:"".concat(dbMeshId,"-").concat(_faceColor),primitive:"triangles",positions:trianglesCoordinates,indices:_toConsumableArray(Array(trianglesCoordinates.length/3).keys())});var _meshId3="".concat(objectId,"-mesh-").concat(_faceColor);var faceColorArray=_faceColor.split(',').map(Number);var _color13=[faceColorArray[0]/255.0,faceColorArray[1]/255.0,faceColorArray[2]/255.0];var _opacity8=faceColorArray[3]/255.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color13=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity8=props.opacity;}}sceneModel.createMesh({id:_meshId3,geometryId:"".concat(dbMeshId,"-").concat(_faceColor),color:_color13,opacity:_opacity8,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});meshIds.push(_meshId3);}sceneModel.createEntity({id:objectId,meshIds:meshIds,visible:visible,pickable:pickable,isObject:true});}var properties=[];for(var infoKey in info){properties.push({name:infoKey,value:info[infoKey]});}metaModelData.propertySets.push({id:objectId,properties:properties});metaModelData.metaObjects.push({id:objectId,name:info&&info.Name&&info.Name!=="None"?info.Name:"".concat(element.type," ").concat(objectId),type:element.type,parent:buildingStoryId,propertySetIds:[objectId]});};for(var _i611=0,_len129=dbElements.length;_i611<_len129;_i611++){var _ret2=_loop8(_i611,_len129);if(_ret2==="continue")continue;}sceneModel.finalize();_this177.viewer.metaScene.createMetaModel(modelId,metaModelData);sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
30372
30380
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
30373
30381
|
});};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
|
|
30374
30382
|
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this177.viewer.scene.canvas.spinner.processes--;},function(err){_this177.viewer.scene.canvas.spinner.processes--;_this177.error(err);});}else if(params.dotBIM){var ctx={fileData:params.dotBIM,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);}sceneModel.once("destroyed",function(){_this177.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
|
|
@@ -30380,8 +30388,7 @@ var ind=(_ref23=[]).concat.apply(_ref23,_toConsumableArray(baseTriangles));mesh=
|
|
|
30380
30388
|
geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:alpha!==undefined?alpha:0.5,backfaces:true,diffuse:hex2rgb(color)})});}catch(e){mesh=null;}}if(mesh){mesh.visible=!!points;}};updateBase(null);return{updateBase:updateBase,destroy:function destroy(){return mesh&&mesh.destroy();}};};var startAARectCreateUI=function startAARectCreateUI(scene,markersColor,pointerLens,select3dPoint,withPoints,onPointsSelected){var marker1=marker3D(scene,markersColor);var marker2=marker3D(scene,markersColor);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker1.update(null);},function(canvasPos,worldPos){updatePointerLens(canvasPos);marker1.update(worldPos);},function(point1CanvasPos,point1WorldPos){marker1.update(point1WorldPos);deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker2.update(null);withPoints(null);},function(canvasPos,point2WorldPos){updatePointerLens(canvasPos);marker2.update(point2WorldPos);withPoints(math.distVec3(point1WorldPos,point2WorldPos)>0.01&&[point1WorldPos,point2WorldPos]);},function(point2CanvasPos,point2WorldPos){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
30381
30389
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
30382
30390
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
30383
|
-
marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointerLens(null);onPointsSelected([point1WorldPos,point2WorldPos]);});});return{deactivate:function deactivate(){deactivatePointSelection();marker1.destroy();marker2.destroy();updatePointerLens(null);}};};var mousePointSelector=function mousePointSelector(viewer,ray2WorldPos){return function(onCancel,onChange,onCommit){var scene=viewer.scene;var canvas=scene.canvas.canvas;var moveTolerance=20;var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var buttonDown=false;var resetAction=function resetAction(){buttonDown=false;};var cleanup=function cleanup(){resetAction();canvas.removeEventListener("mousedown",onMouseDown);canvas.removeEventListener("mousemove",onMouseMove);viewer.cameraControl.off(onCameraControlRayMove);canvas.removeEventListener("mouseup",onMouseUp);};var startCanvasPos=math.vec2();var onMouseDown=function onMouseDown(event){if(event.which===1){copyCanvasPos(event,startCanvasPos);buttonDown=true;}};canvas.addEventListener("mousedown",onMouseDown);var onMouseMove=function onMouseMove(event){var canvasPos=copyCanvasPos(event,math.vec2());if(buttonDown&&math.distVec2(startCanvasPos,canvasPos)>moveTolerance){resetAction();onCancel();}};canvas.addEventListener("mousemove",onMouseMove);var onCameraControlRayMove=viewer.cameraControl.on("rayMove",function(event){var canvasPos=event.canvasPos;onChange(canvasPos,pickWorldPos(canvasPos));});var onMouseUp=function onMouseUp(event){if(event.which===1&&buttonDown){cleanup();var
|
|
30384
|
-
var onCanvasTouchMove=function onCanvasTouchMove(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){onSingleTouchMove(copyCanvasPos(touch,math.vec2()));}};canvas.addEventListener("touchmove",onCanvasTouchMove,{passive:true});var onCanvasTouchEnd=function onCanvasTouchEnd(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){cleanup();var _canvasPos3=copyCanvasPos(touch,math.vec2());onCommit(_canvasPos3,pickWorldPos(_canvasPos3));}};canvas.addEventListener("touchend",onCanvasTouchEnd,{passive:true});return cleanup;};};var planeIntersect=function planeIntersect(p0,n,origin,direction){var t=-(math.dotVec3(origin,n)-p0)/math.dotVec3(direction,n);{var worldPos=math.vec3();math.mulVec3Scalar(direction,t,worldPos);math.addVec3(origin,worldPos,worldPos);return worldPos;}};/**
|
|
30391
|
+
marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointerLens(null);onPointsSelected([point1WorldPos,point2WorldPos]);});});return{deactivate:function deactivate(){deactivatePointSelection();marker1.destroy();marker2.destroy();updatePointerLens(null);}};};var mousePointSelector=function mousePointSelector(viewer,ray2WorldPos){return function(onCancel,onChange,onCommit){var scene=viewer.scene;var canvas=scene.canvas.canvas;var moveTolerance=20;var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var buttonDown=false;var resetAction=function resetAction(){buttonDown=false;};var cleanup=function cleanup(){resetAction();canvas.removeEventListener("mousedown",onMouseDown);canvas.removeEventListener("mousemove",onMouseMove);viewer.cameraControl.off(onCameraControlRayMove);canvas.removeEventListener("mouseup",onMouseUp);};var startCanvasPos=math.vec2();var onMouseDown=function onMouseDown(event){if(event.which===1){copyCanvasPos(event,startCanvasPos);buttonDown=true;}};canvas.addEventListener("mousedown",onMouseDown);var onMouseMove=function onMouseMove(event){var canvasPos=copyCanvasPos(event,math.vec2());if(buttonDown&&math.distVec2(startCanvasPos,canvasPos)>moveTolerance){resetAction();onCancel();}};canvas.addEventListener("mousemove",onMouseMove);var onCameraControlRayMove=viewer.cameraControl.on("rayMove",function(event){var canvasPos=event.canvasPos;onChange(canvasPos,pickWorldPos(canvasPos));});var onMouseUp=function onMouseUp(event){if(event.which===1&&buttonDown){cleanup();var _canvasPos3=copyCanvasPos(event,math.vec2());onCommit(_canvasPos3,pickWorldPos(_canvasPos3));}};canvas.addEventListener("mouseup",onMouseUp);return cleanup;};};var planeIntersect=function planeIntersect(p0,n,origin,direction){var t=-(math.dotVec3(origin,n)-p0)/math.dotVec3(direction,n);{var worldPos=math.vec3();math.mulVec3Scalar(direction,t,worldPos);math.addVec3(origin,worldPos,worldPos);return worldPos;}};/**
|
|
30385
30392
|
* @desc Renders a transparent box between two 3D points.
|
|
30386
30393
|
*
|
|
30387
30394
|
* See {@link ZonesPlugin} for more info.
|
|
@@ -30496,4 +30503,4 @@ o4===0&&onSegment(c,b,d))// c, d and b are collinear and b lies on segment cd
|
|
|
30496
30503
|
{return true;}}return false;};}();deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker.update(null);wire&&wire.update(null);basePolygon.updateBase(markers.length>2?markers.map(function(m){return m.getWorldPos();}):null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);firstMarker&&firstMarker.setHighlighted(!!snappedFirst);updatePointerLens(snappedFirst?snappedFirst.canvasPos:canvasPos);marker.update(!snappedFirst&&worldPos);wire&&wire.update(snappedFirst?snappedFirst.worldPos:worldPos);if(markers.length>=2){var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);var inter=lastSegmentIntersects(pos.map(function(p){return[p[0],p[2]];}),snappedFirst);basePolygon.updateBase(inter?null:pos);}else basePolygon.updateBase(null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);basePolygon.updateBase(pos);var pos2D=pos.map(function(p){return[p[0],p[2]];});if(markers.length>2&&lastSegmentIntersects(pos2D,snappedFirst)){cleanups.pop()();selectNextPoint(markers);}else if(snappedFirst){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
30497
30504
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
30498
30505
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
30499
|
-
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceMouseControl,_Component44);var _super179=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this183;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this183=_super179.call(this,zonesPlugin.viewer.scene);_this183.zonesPlugin=zonesPlugin;_this183.pointerLens=cfg.pointerLens;_this183._action=null;return _this183;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceTouchControl,_Component45);var _super180=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this184;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this184=_super180.call(this,zonesPlugin.viewer.scene);_this184.zonesPlugin=zonesPlugin;_this184.pointerLens=cfg.pointerLens;_this184.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this184._action=null;return _this184;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component46){_inherits(ZoneEditControl,_Component46);var _super181=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this185;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this185=_super181.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this185.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this185._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this185;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super182=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super182.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super183=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super183.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component47){_inherits(ZoneTranslateControl,_Component47);var _super184=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this186;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this186=_super184.call(this,scene);var self=_assertThisInitialized(_this186);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos4=copyCanvasPos(e,math.vec2());onChange(_canvasPos4);updatePointerLens(_canvasPos4);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this186._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this186;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super185=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super185.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super186=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super186.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$2 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,math,meshSurfaceArea,meshVolume,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions};
|
|
30506
|
+
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceMouseControl,_Component44);var _super179=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this183;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this183=_super179.call(this,zonesPlugin.viewer.scene);_this183.zonesPlugin=zonesPlugin;_this183.pointerLens=cfg.pointerLens;_this183._action=null;return _this183;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceTouchControl,_Component45);var _super180=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this184;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this184=_super180.call(this,zonesPlugin.viewer.scene);_this184.zonesPlugin=zonesPlugin;_this184.pointerLens=cfg.pointerLens;_this184.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this184._action=null;return _this184;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component46){_inherits(ZoneEditControl,_Component46);var _super181=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this185;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this185=_super181.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this185.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this185._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this185;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super182=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super182.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super183=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super183.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component47){_inherits(ZoneTranslateControl,_Component47);var _super184=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this186;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this186=_super184.call(this,scene);var self=_assertThisInitialized(_this186);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos4=copyCanvasPos(e,math.vec2());onChange(_canvasPos4);updatePointerLens(_canvasPos4);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this186._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this186;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super185=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super185.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super186=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super186.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$2 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,math,meshSurfaceArea,meshVolume,rtcToWorldPos,sRGBEncoding,setFrustum,stats,touchPointSelector$1 as touchPointSelector,transformToNode,utils,worldToRTCPos,worldToRTCPositions};
|