@xeokit/xeokit-sdk 2.6.0-beta-6 → 2.6.0-beta-8
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 +18 -18
- package/dist/xeokit-sdk.es.js +18 -18
- package/dist/xeokit-sdk.es5.js +4 -6
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +7 -7
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +5 -10
- package/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +1 -1
- package/src/viewer/Plugin.js +1 -1
- package/src/viewer/Viewer.js +1 -1
- package/src/viewer/scene/CameraControl/lib/CameraUpdater.js +4 -1
- package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +3 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js +1 -1
- package/src/viewer/scene/utils/FileLoader.js +1 -1
- package/src/viewer/scene/utils.js +1 -1
package/dist/web-ifc.wasm
CHANGED
|
Binary file
|
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -12170,6 +12170,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12170
12170
|
const mouseWorldPos = math.vec3();
|
|
12171
12171
|
const mouseHoverCanvasPos = math.vec2();
|
|
12172
12172
|
this._currentAngleMeasurement = null;
|
|
12173
|
+
|
|
12174
|
+
const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));
|
|
12175
|
+
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
12176
|
+
|
|
12173
12177
|
this._onMouseHoverSurface = cameraControl.on(
|
|
12174
12178
|
this._snapping
|
|
12175
12179
|
? "hoverSnapOrSurface"
|
|
@@ -12201,13 +12205,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12201
12205
|
mouseHoverCanvasPos.set(canvasPos);
|
|
12202
12206
|
switch (this._mouseState) {
|
|
12203
12207
|
case MOUSE_FINDING_ORIGIN:
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
12208
|
-
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
12209
|
-
this.markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
12210
|
-
this.markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
12208
|
+
this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
|
|
12209
|
+
this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
|
|
12210
|
+
|
|
12211
12211
|
break;
|
|
12212
12212
|
case MOUSE_FINDING_CORNER:
|
|
12213
12213
|
if (this._currentAngleMeasurement) {
|
|
@@ -77176,7 +77176,9 @@ class DTXTrianglesLayer {
|
|
|
77176
77176
|
// Color
|
|
77177
77177
|
|
|
77178
77178
|
let f0;
|
|
77179
|
-
if (!visible || culled || xrayed
|
|
77179
|
+
if (!visible || culled || xrayed
|
|
77180
|
+
|| (highlighted && !this.model.scene.highlightMaterial.glowThrough)
|
|
77181
|
+
|| (selected && !this.model.scene.selectedMaterial.glowThrough)) {
|
|
77180
77182
|
f0 = RENDER_PASSES.NOT_RENDERED;
|
|
77181
77183
|
} else {
|
|
77182
77184
|
if (transparent) {
|
|
@@ -85987,6 +85989,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85987
85989
|
|
|
85988
85990
|
this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
|
|
85989
85991
|
|
|
85992
|
+
const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));
|
|
85993
|
+
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
85994
|
+
|
|
85990
85995
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
85991
85996
|
this._snapping
|
|
85992
85997
|
? "hoverSnapOrSurface"
|
|
@@ -85997,16 +86002,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85997
86002
|
pointerCanvasPos.set(event.canvasPos);
|
|
85998
86003
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
85999
86004
|
|
|
86000
|
-
|
|
86001
|
-
|
|
86002
|
-
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
86003
|
-
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
86004
|
-
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
86005
|
-
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
86006
|
-
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
86007
|
-
|
|
86008
|
-
this._markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
86009
|
-
this._markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
86005
|
+
this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
|
|
86006
|
+
this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
|
|
86010
86007
|
|
|
86011
86008
|
this._markerDiv.style.background = "pink";
|
|
86012
86009
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
@@ -94108,6 +94105,9 @@ class CameraUpdater {
|
|
|
94108
94105
|
}
|
|
94109
94106
|
}
|
|
94110
94107
|
}
|
|
94108
|
+
} else {
|
|
94109
|
+
dollyDistFactor = 1;
|
|
94110
|
+
followPointerWorldPos = null;
|
|
94111
94111
|
}
|
|
94112
94112
|
|
|
94113
94113
|
const dollyDeltaForDist = (updates.dollyDelta * dollyDistFactor);
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -12166,6 +12166,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12166
12166
|
const mouseWorldPos = math.vec3();
|
|
12167
12167
|
const mouseHoverCanvasPos = math.vec2();
|
|
12168
12168
|
this._currentAngleMeasurement = null;
|
|
12169
|
+
|
|
12170
|
+
const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));
|
|
12171
|
+
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
12172
|
+
|
|
12169
12173
|
this._onMouseHoverSurface = cameraControl.on(
|
|
12170
12174
|
this._snapping
|
|
12171
12175
|
? "hoverSnapOrSurface"
|
|
@@ -12197,13 +12201,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12197
12201
|
mouseHoverCanvasPos.set(canvasPos);
|
|
12198
12202
|
switch (this._mouseState) {
|
|
12199
12203
|
case MOUSE_FINDING_ORIGIN:
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
12204
|
-
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
12205
|
-
this.markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
12206
|
-
this.markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
12204
|
+
this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
|
|
12205
|
+
this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
|
|
12206
|
+
|
|
12207
12207
|
break;
|
|
12208
12208
|
case MOUSE_FINDING_CORNER:
|
|
12209
12209
|
if (this._currentAngleMeasurement) {
|
|
@@ -77172,7 +77172,9 @@ class DTXTrianglesLayer {
|
|
|
77172
77172
|
// Color
|
|
77173
77173
|
|
|
77174
77174
|
let f0;
|
|
77175
|
-
if (!visible || culled || xrayed
|
|
77175
|
+
if (!visible || culled || xrayed
|
|
77176
|
+
|| (highlighted && !this.model.scene.highlightMaterial.glowThrough)
|
|
77177
|
+
|| (selected && !this.model.scene.selectedMaterial.glowThrough)) {
|
|
77176
77178
|
f0 = RENDER_PASSES.NOT_RENDERED;
|
|
77177
77179
|
} else {
|
|
77178
77180
|
if (transparent) {
|
|
@@ -85983,6 +85985,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85983
85985
|
|
|
85984
85986
|
this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
|
|
85985
85987
|
|
|
85988
|
+
const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));
|
|
85989
|
+
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
85990
|
+
|
|
85986
85991
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
85987
85992
|
this._snapping
|
|
85988
85993
|
? "hoverSnapOrSurface"
|
|
@@ -85993,16 +85998,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85993
85998
|
pointerCanvasPos.set(event.canvasPos);
|
|
85994
85999
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
85995
86000
|
|
|
85996
|
-
|
|
85997
|
-
|
|
85998
|
-
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
85999
|
-
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
86000
|
-
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
86001
|
-
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
86002
|
-
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
86003
|
-
|
|
86004
|
-
this._markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
86005
|
-
this._markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
86001
|
+
this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
|
|
86002
|
+
this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
|
|
86006
86003
|
|
|
86007
86004
|
this._markerDiv.style.background = "pink";
|
|
86008
86005
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
@@ -94104,6 +94101,9 @@ class CameraUpdater {
|
|
|
94104
94101
|
}
|
|
94105
94102
|
}
|
|
94106
94103
|
}
|
|
94104
|
+
} else {
|
|
94105
|
+
dollyDistFactor = 1;
|
|
94106
|
+
followPointerWorldPos = null;
|
|
94107
94107
|
}
|
|
94108
94108
|
|
|
94109
94109
|
const dollyDeltaForDist = (updates.dollyDelta * dollyDistFactor);
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -2988,7 +2988,7 @@ _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothi
|
|
|
2988
2988
|
*/function get(){return this._snapping;}/**
|
|
2989
2989
|
* Activates this AngleMeasurementsMouseControl, ready to respond to input.
|
|
2990
2990
|
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
|
|
2991
|
-
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:
|
|
2991
|
+
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;var getTop=function getTop(el){return el.offsetTop+(el.offsetParent&&getTop(el.offsetParent));};var getLeft=function getLeft(el){return el.offsetLeft+(el.offsetParent&&getLeft(el.offsetParent));};this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19.markerDiv.style.left="".concat(getLeft(canvas)+canvasPos[0]-5,"px");_this19.markerDiv.style.top="".concat(getTop(canvas)+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;_this19._currentAngleMeasurement.corner.entity=event.entity;}_this19.markerDiv.style.left="-10000px";_this19.markerDiv.style.top="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;_this19._currentAngleMeasurement.target.entity=event.entity;}_this19.markerDiv.style.left="-10000px";_this19.markerDiv.style.top="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.origin.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.corner.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.entity=hoveredEntity;_this19._currentAngleMeasurement.clickable=true;hoveredEntity=null;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.left="-100px";_this19.markerDiv.style.top="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
|
|
2992
2992
|
* Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
|
|
2993
2993
|
*
|
|
2994
2994
|
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
@@ -16199,8 +16199,7 @@ Math.floor(subPortionId/512),// yoffset
|
|
|
16199
16199
|
1,//height
|
|
16200
16200
|
gl.RGBA_INTEGER,gl.UNSIGNED_BYTE,tempUint8Array4);// gl.bindTexture (gl.TEXTURE_2D, null);
|
|
16201
16201
|
}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"_setFlags",value:function _setFlags(portionId,flags,transparent){var deferred=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var subPortionIds=this._portionToSubPortionsMap[portionId];for(var _i369=0,len=subPortionIds.length;_i369<len;_i369++){this._subPortionSetFlags(subPortionIds[_i369],flags,transparent,deferred);}}},{key:"_subPortionSetFlags",value:function _subPortionSetFlags(subPortionId,flags,transparent){var deferred=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(!this._finalized){throw"Not finalized";}var visible=!!(flags&ENTITY_FLAGS.VISIBLE);var xrayed=!!(flags&ENTITY_FLAGS.XRAYED);var highlighted=!!(flags&ENTITY_FLAGS.HIGHLIGHTED);var selected=!!(flags&ENTITY_FLAGS.SELECTED);var edges=!!(flags&ENTITY_FLAGS.EDGES);var pickable=!!(flags&ENTITY_FLAGS.PICKABLE);var culled=!!(flags&ENTITY_FLAGS.CULLED);// Color
|
|
16202
|
-
var f0;if(!visible||culled||xrayed){//
|
|
16203
|
-
f0=RENDER_PASSES.NOT_RENDERED;}else{if(transparent){f0=RENDER_PASSES.COLOR_TRANSPARENT;}else{f0=RENDER_PASSES.COLOR_OPAQUE;}}// Silhouette
|
|
16202
|
+
var f0;if(!visible||culled||xrayed||highlighted&&!this.model.scene.highlightMaterial.glowThrough||selected&&!this.model.scene.selectedMaterial.glowThrough){f0=RENDER_PASSES.NOT_RENDERED;}else{if(transparent){f0=RENDER_PASSES.COLOR_TRANSPARENT;}else{f0=RENDER_PASSES.COLOR_OPAQUE;}}// Silhouette
|
|
16204
16203
|
var f1;if(!visible||culled){f1=RENDER_PASSES.NOT_RENDERED;}else if(selected){f1=RENDER_PASSES.SILHOUETTE_SELECTED;}else if(highlighted){f1=RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;}else if(xrayed){f1=RENDER_PASSES.SILHOUETTE_XRAYED;}else{f1=RENDER_PASSES.NOT_RENDERED;}// Edges
|
|
16205
16204
|
var f2=0;if(!visible||culled){f2=RENDER_PASSES.NOT_RENDERED;}else if(selected){f2=RENDER_PASSES.EDGES_SELECTED;}else if(highlighted){f2=RENDER_PASSES.EDGES_HIGHLIGHTED;}else if(xrayed){f2=RENDER_PASSES.EDGES_XRAYED;}else if(edges){if(transparent){f2=RENDER_PASSES.EDGES_COLOR_TRANSPARENT;}else{f2=RENDER_PASSES.EDGES_COLOR_OPAQUE;}}else{f2=RENDER_PASSES.NOT_RENDERED;}// Pick
|
|
16206
16205
|
var f3=visible&&!culled&&pickable?RENDER_PASSES.PICK:RENDER_PASSES.NOT_RENDERED;var textureState=this._dtxState;var gl=this.model.scene.canvas.gl;tempUint8Array4[0]=f0;tempUint8Array4[1]=f1;tempUint8Array4[2]=f2;tempUint8Array4[3]=f3;// object flags
|
|
@@ -19250,8 +19249,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19250
19249
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
19251
19250
|
*/function get(){return this._snapping;}/**
|
|
19252
19251
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
19253
|
-
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){
|
|
19254
|
-
var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this82._markerDiv.style.left="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.top="".concat(canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.left="-10000px";_this82._markerDiv.style.top="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.left="-10000px";_this82._markerDiv.style.top="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.left="-100px";_this82._markerDiv.style.top="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
19252
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;var getTop=function getTop(el){return el.offsetTop+(el.offsetParent&&getTop(el.offsetParent));};var getLeft=function getLeft(el){return el.offsetLeft+(el.offsetParent&&getLeft(el.offsetParent));};this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){_this82._markerDiv.style.left="".concat(getLeft(canvas)+canvasPos[0]-5,"px");_this82._markerDiv.style.top="".concat(getTop(canvas)+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.left="-10000px";_this82._markerDiv.style.top="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.left="-10000px";_this82._markerDiv.style.top="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.left="-100px";_this82._markerDiv.style.top="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
19255
19253
|
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
19256
19254
|
*
|
|
19257
19255
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
@@ -22138,7 +22136,7 @@ if(Math.abs(updates.rotateDeltaX)<EPSILON){updates.rotateDeltaX=0;}if(Math.abs(u
|
|
|
22138
22136
|
// which empty background shows, that the pointer may inadvertently be over. In these cases, we don't
|
|
22139
22137
|
// want dolly speed wildly varying depending on how accurately the user avoids the gaps with the pointer.
|
|
22140
22138
|
//----------------------------------------------------------------------------------------------------------
|
|
22141
|
-
if(configs.followPointer){if(--countDown<=0){countDown=SCALE_DOLLY_EACH_FRAME;if(updates.dollyDelta!==0){if(updates.rotateDeltaY===0&&updates.rotateDeltaX===0){if(configs.followPointer&&states.followPointerDirty){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(pickController.pickResult&&pickController.pickResult.worldPos){followPointerWorldPos=pickController.pickResult.worldPos;}else{dollyDistFactor=1.0;followPointerWorldPos=null;}states.followPointerDirty=false;}}if(followPointerWorldPos){var dist=Math.abs(math.lenVec3(math.subVec3(followPointerWorldPos,scene.camera.eye,tempVec3$2)));dollyDistFactor=dist/configs.dollyProximityThreshold;}if(dollyDistFactor<configs.dollyMinSpeed){dollyDistFactor=configs.dollyMinSpeed;}}}}var dollyDeltaForDist=updates.dollyDelta*dollyDistFactor;//----------------------------------------------------------------------------------------------------------
|
|
22139
|
+
if(configs.followPointer){if(--countDown<=0){countDown=SCALE_DOLLY_EACH_FRAME;if(updates.dollyDelta!==0){if(updates.rotateDeltaY===0&&updates.rotateDeltaX===0){if(configs.followPointer&&states.followPointerDirty){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(pickController.pickResult&&pickController.pickResult.worldPos){followPointerWorldPos=pickController.pickResult.worldPos;}else{dollyDistFactor=1.0;followPointerWorldPos=null;}states.followPointerDirty=false;}}if(followPointerWorldPos){var dist=Math.abs(math.lenVec3(math.subVec3(followPointerWorldPos,scene.camera.eye,tempVec3$2)));dollyDistFactor=dist/configs.dollyProximityThreshold;}if(dollyDistFactor<configs.dollyMinSpeed){dollyDistFactor=configs.dollyMinSpeed;}}}}else{dollyDistFactor=1;followPointerWorldPos=null;}var dollyDeltaForDist=updates.dollyDelta*dollyDistFactor;//----------------------------------------------------------------------------------------------------------
|
|
22142
22140
|
// Rotation
|
|
22143
22141
|
//----------------------------------------------------------------------------------------------------------
|
|
22144
22142
|
if(updates.rotateDeltaY!==0||updates.rotateDeltaX!==0){if(!configs.firstPerson&&configs.followPointer&&pivotController.getPivoting()){pivotController.continuePivot(updates.rotateDeltaY,updates.rotateDeltaX);pivotController.showPivot();}else{if(updates.rotateDeltaX!==0){if(configs.firstPerson){camera.pitch(-updates.rotateDeltaX);}else{camera.orbitPitch(updates.rotateDeltaX);}}if(updates.rotateDeltaY!==0){if(configs.firstPerson){camera.yaw(updates.rotateDeltaY);}else{camera.orbitYaw(updates.rotateDeltaY);}}}updates.rotateDeltaX*=configs.rotationInertia;updates.rotateDeltaY*=configs.rotationInertia;cursorType="grabbing";}//----------------------------------------------------------------------------------------------------------
|