vim-web 0.3.44-dev.44 → 0.3.44-dev.46
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/types/core-viewers/webgl/index.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +2 -33
- package/dist/types/core-viewers/webgl/viewer/raycaster.d.ts +30 -41
- package/dist/types/core-viewers/webgl/viewer/webglInputsAdapter.d.ts +1 -1
- package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +4 -3
- package/dist/types/react-viewers/helpers/reactUtils.d.ts +233 -9
- package/dist/types/react-viewers/panels/icons.d.ts +1 -0
- package/dist/types/react-viewers/settings/settings.d.ts +3 -1
- package/dist/types/react-viewers/state/cameraState.d.ts +3 -5
- package/dist/types/react-viewers/state/controlBarState.d.ts +1 -25
- package/dist/types/react-viewers/state/sectionBoxState.d.ts +1 -1
- package/dist/types/react-viewers/ultra/ultraControlBarState.d.ts +2 -14
- package/dist/vim-web.iife.js +305 -239
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +305 -239
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
package/dist/vim-web.js
CHANGED
|
@@ -50664,13 +50664,11 @@ class CameraLerp extends CameraMovement {
|
|
|
50664
50664
|
return this._clock.running;
|
|
50665
50665
|
}
|
|
50666
50666
|
init(duration) {
|
|
50667
|
-
console.log("init lerp");
|
|
50668
50667
|
this.cancel();
|
|
50669
50668
|
this._duration = Math.max(duration, 0.01);
|
|
50670
50669
|
this._clock.start();
|
|
50671
50670
|
}
|
|
50672
50671
|
cancel() {
|
|
50673
|
-
console.log("cancel");
|
|
50674
50672
|
this._clock.stop();
|
|
50675
50673
|
this.onProgress = void 0;
|
|
50676
50674
|
}
|
|
@@ -51654,24 +51652,24 @@ class RaycastResult {
|
|
|
51654
51652
|
__publicField(this, "intersections");
|
|
51655
51653
|
__publicField(this, "firstHit");
|
|
51656
51654
|
this.intersections = intersections;
|
|
51657
|
-
const [markerHit, marker] = this.
|
|
51655
|
+
const [markerHit, marker] = this.getFirstMarkerHit(intersections);
|
|
51658
51656
|
if (marker) {
|
|
51659
51657
|
this.object = marker;
|
|
51660
51658
|
this.firstHit = markerHit;
|
|
51661
51659
|
return;
|
|
51662
51660
|
}
|
|
51663
|
-
const [objectHit, obj] = this.
|
|
51661
|
+
const [objectHit, obj] = this.getFirstVimHit(intersections);
|
|
51664
51662
|
this.firstHit = objectHit;
|
|
51665
51663
|
this.object = obj;
|
|
51666
51664
|
}
|
|
51667
|
-
|
|
51665
|
+
getFirstVimHit(intersections) {
|
|
51668
51666
|
for (let i = 0; i < intersections.length; i++) {
|
|
51669
51667
|
const obj = this.getVimObjectFromHit(intersections[i]);
|
|
51670
51668
|
if (obj == null ? void 0 : obj.visible) return [intersections[i], obj];
|
|
51671
51669
|
}
|
|
51672
51670
|
return [];
|
|
51673
51671
|
}
|
|
51674
|
-
|
|
51672
|
+
getFirstMarkerHit(intersections) {
|
|
51675
51673
|
for (let i = 0; i < intersections.length; i++) {
|
|
51676
51674
|
const data2 = intersections[i].object.userData.vim;
|
|
51677
51675
|
if (data2 instanceof GizmoMarkers) {
|
|
@@ -51688,7 +51686,7 @@ class RaycastResult {
|
|
|
51688
51686
|
const sub = mesh.merged ? mesh.getSubmeshFromFace(hit.faceIndex) : mesh.getSubMesh(hit.instanceId);
|
|
51689
51687
|
return sub.object;
|
|
51690
51688
|
}
|
|
51691
|
-
// Convenience
|
|
51689
|
+
// Convenience getters for hit information
|
|
51692
51690
|
get isHit() {
|
|
51693
51691
|
return !!this.firstHit;
|
|
51694
51692
|
}
|
|
@@ -51710,28 +51708,27 @@ class RaycastResult {
|
|
|
51710
51708
|
}
|
|
51711
51709
|
}
|
|
51712
51710
|
class Raycaster2 {
|
|
51713
|
-
constructor(
|
|
51714
|
-
__publicField(this, "_viewport");
|
|
51711
|
+
constructor(camera2, scene, renderer) {
|
|
51715
51712
|
__publicField(this, "_camera");
|
|
51716
51713
|
__publicField(this, "_scene");
|
|
51717
51714
|
__publicField(this, "_renderer");
|
|
51718
51715
|
__publicField(this, "_raycaster", new Raycaster$1());
|
|
51719
|
-
this._viewport = viewport;
|
|
51720
51716
|
this._camera = camera2;
|
|
51721
51717
|
this._scene = scene;
|
|
51722
51718
|
this._renderer = renderer;
|
|
51723
51719
|
}
|
|
51724
51720
|
/**
|
|
51725
|
-
* Performs a raycast
|
|
51726
|
-
*
|
|
51721
|
+
* Performs a raycast from the camera using normalized screen coordinates.
|
|
51722
|
+
* Coordinates must be within [0, 1] for both x and y.
|
|
51723
|
+
* If the coordinates are out of bounds, an error is logged and an empty result is returned.
|
|
51724
|
+
*
|
|
51725
|
+
* @param {THREE.Vector2} position - The normalized screen position for raycasting.
|
|
51727
51726
|
*/
|
|
51728
|
-
|
|
51729
|
-
if (position.x < 0 || position.y < 0) {
|
|
51727
|
+
raycastFromScreen(position) {
|
|
51728
|
+
if (position.x < 0 || position.y < 0 || position.x > 1 || position.y > 1) {
|
|
51730
51729
|
console.error("Invalid position for raycasting");
|
|
51731
51730
|
return new RaycastResult([]);
|
|
51732
51731
|
}
|
|
51733
|
-
position.x *= position.x < 1 ? this._viewport.getSize().x : 1;
|
|
51734
|
-
position.y *= position.y < 1 ? this._viewport.getSize().y : 1;
|
|
51735
51732
|
this._raycaster = this.fromPoint2(position, this._raycaster);
|
|
51736
51733
|
let hits = this._raycaster.intersectObjects(this._scene.scene.children);
|
|
51737
51734
|
hits = this.filterHits(hits);
|
|
@@ -51741,35 +51738,46 @@ class Raycaster2 {
|
|
|
51741
51738
|
return this._renderer.section.active ? hits.filter((i) => this._renderer.section.box.containsPoint(i.point)) : hits;
|
|
51742
51739
|
}
|
|
51743
51740
|
/**
|
|
51744
|
-
* Performs a raycast
|
|
51745
|
-
*
|
|
51741
|
+
* Performs a raycast from the camera towards a specified world position.
|
|
51742
|
+
*
|
|
51743
|
+
* @param {THREE.Vector3} position - The target world position for raycasting.
|
|
51746
51744
|
*/
|
|
51747
|
-
|
|
51745
|
+
raycastFromWorld(position) {
|
|
51748
51746
|
this._raycaster = this.fromPoint3(position, this._raycaster);
|
|
51749
51747
|
let hits = this._raycaster.intersectObjects(this._scene.scene.children);
|
|
51750
51748
|
hits = this.filterHits(hits);
|
|
51751
51749
|
return new RaycastResult(hits);
|
|
51752
51750
|
}
|
|
51753
51751
|
/**
|
|
51754
|
-
* Performs a raycast
|
|
51752
|
+
* Performs a raycast starting from the camera's current target position.
|
|
51755
51753
|
*/
|
|
51756
51754
|
raycastForward() {
|
|
51757
|
-
return this.
|
|
51755
|
+
return this.raycastFromWorld(this._camera.target);
|
|
51758
51756
|
}
|
|
51759
51757
|
/**
|
|
51760
|
-
*
|
|
51758
|
+
* Creates and returns a THREE.Raycaster that casts a ray from the camera's position
|
|
51759
|
+
* through the provided normalized screen coordinate (x and y in the range [0, 1]).
|
|
51760
|
+
*
|
|
51761
|
+
* @param {THREE.Vector2} position - The normalized screen position for raycasting.
|
|
51762
|
+
* @param {THREE.Raycaster} target - Optional existing raycaster instance to update.
|
|
51763
|
+
* @returns {THREE.Raycaster} A configured raycaster for performing raycasting.
|
|
51761
51764
|
*/
|
|
51762
51765
|
fromPoint2(position, target = new Raycaster$1()) {
|
|
51763
|
-
const
|
|
51764
|
-
|
|
51765
|
-
|
|
51766
|
-
|
|
51766
|
+
const pos = new Vector2(
|
|
51767
|
+
position.x * 2 - 1,
|
|
51768
|
+
-position.y * 2 + 1
|
|
51769
|
+
);
|
|
51770
|
+
target.setFromCamera(pos, this._camera.three);
|
|
51767
51771
|
return target;
|
|
51768
51772
|
}
|
|
51769
51773
|
/**
|
|
51770
|
-
*
|
|
51771
|
-
*
|
|
51772
|
-
*
|
|
51774
|
+
* Creates and returns a THREE.Raycaster that casts a ray from the camera's position
|
|
51775
|
+
* towards the specified world position.
|
|
51776
|
+
* The ray's direction is computed as the normalized vector from the camera position to the target position.
|
|
51777
|
+
*
|
|
51778
|
+
* @param {THREE.Vector3} position - The world position for raycasting.
|
|
51779
|
+
* @param {THREE.Raycaster} target - Optional existing raycaster instance to update.
|
|
51780
|
+
* @returns {THREE.Raycaster} A configured raycaster for performing raycasting.
|
|
51773
51781
|
*/
|
|
51774
51782
|
fromPoint3(position, target = new Raycaster$1()) {
|
|
51775
51783
|
const direction = position.clone().sub(this._camera.position).normalize();
|
|
@@ -51777,37 +51785,6 @@ class Raycaster2 {
|
|
|
51777
51785
|
return target;
|
|
51778
51786
|
}
|
|
51779
51787
|
}
|
|
51780
|
-
class InputAction {
|
|
51781
|
-
constructor(type, modifier, position, raycaster) {
|
|
51782
|
-
__publicField(this, "position");
|
|
51783
|
-
__publicField(this, "modifier");
|
|
51784
|
-
__publicField(this, "type");
|
|
51785
|
-
__publicField(this, "_raycaster");
|
|
51786
|
-
__publicField(this, "_raycast");
|
|
51787
|
-
this.type = type;
|
|
51788
|
-
this.modifier = modifier;
|
|
51789
|
-
this.position = position;
|
|
51790
|
-
this._raycaster = raycaster;
|
|
51791
|
-
}
|
|
51792
|
-
/**
|
|
51793
|
-
* A THREE.Raycaster object for custom raycasting.
|
|
51794
|
-
*/
|
|
51795
|
-
get raycaster() {
|
|
51796
|
-
return this._raycaster.fromPoint2(this.position);
|
|
51797
|
-
}
|
|
51798
|
-
/**
|
|
51799
|
-
* Performs raycasting for VIM objects at the current point. This operation can be computationally expensive.
|
|
51800
|
-
*/
|
|
51801
|
-
get raycast() {
|
|
51802
|
-
return this._raycast ?? (this._raycast = this._raycaster.raycast2(this.position));
|
|
51803
|
-
}
|
|
51804
|
-
/**
|
|
51805
|
-
* Returns the object at the current point. This operation can cause a computationally expensive raycast evaluation.
|
|
51806
|
-
*/
|
|
51807
|
-
get object() {
|
|
51808
|
-
return this.raycast.object;
|
|
51809
|
-
}
|
|
51810
|
-
}
|
|
51811
51788
|
class CSS2DObject extends Object3D$1 {
|
|
51812
51789
|
constructor(element = document.createElement("div")) {
|
|
51813
51790
|
super();
|
|
@@ -52905,7 +52882,7 @@ class GizmoRectangle {
|
|
|
52905
52882
|
*/
|
|
52906
52883
|
getClosestHit() {
|
|
52907
52884
|
if (!this.points) return;
|
|
52908
|
-
const hits = this.points.map((p) => this.viewer.raycaster.
|
|
52885
|
+
const hits = this.points.map((p) => this.viewer.raycaster.raycastFromWorld(p)).filter((h) => h.isHit);
|
|
52909
52886
|
let position;
|
|
52910
52887
|
let dist2;
|
|
52911
52888
|
hits.forEach((h) => {
|
|
@@ -53882,7 +53859,7 @@ class Measure {
|
|
|
53882
53859
|
this._stage = "ready";
|
|
53883
53860
|
this._previousOnClick = this._viewer.inputs.mouse.onClick;
|
|
53884
53861
|
this._viewer.inputs.mouse.onClick = (pos, ctrl) => {
|
|
53885
|
-
const hit = this._viewer.raycaster.
|
|
53862
|
+
const hit = this._viewer.raycaster.raycastFromScreen(pos);
|
|
53886
53863
|
if (!hit.isHit) return;
|
|
53887
53864
|
switch (this._stage) {
|
|
53888
53865
|
case "ready":
|
|
@@ -54007,10 +53984,8 @@ class BoxInputs {
|
|
|
54007
53984
|
__publicField(this, "_raycaster", new Raycaster$1());
|
|
54008
53985
|
/** The box state before the current drag. */
|
|
54009
53986
|
__publicField(this, "_lastBox", new Box3());
|
|
54010
|
-
/** A
|
|
54011
|
-
__publicField(this, "
|
|
54012
|
-
/** The ID of the pointer that is captured, if any. */
|
|
54013
|
-
__publicField(this, "_capturedPointerId");
|
|
53987
|
+
/** A callback to restore the original input listeners after unregistering. */
|
|
53988
|
+
__publicField(this, "_restoreOriginalInputs");
|
|
54014
53989
|
// -------------------------------------------------------------------------
|
|
54015
53990
|
// Callbacks
|
|
54016
53991
|
// -------------------------------------------------------------------------
|
|
@@ -54041,78 +54016,50 @@ class BoxInputs {
|
|
|
54041
54016
|
* If already registered, it does nothing.
|
|
54042
54017
|
*/
|
|
54043
54018
|
register() {
|
|
54044
|
-
if (this.
|
|
54045
|
-
const
|
|
54046
|
-
|
|
54047
|
-
|
|
54048
|
-
|
|
54049
|
-
|
|
54019
|
+
if (this._restoreOriginalInputs) return;
|
|
54020
|
+
const mouse = this._viewer.inputs.mouse;
|
|
54021
|
+
const up = mouse.onButtonUp;
|
|
54022
|
+
const down = mouse.onButtonDown;
|
|
54023
|
+
const move = mouse.onMouseMove;
|
|
54024
|
+
const drag = mouse.onDrag;
|
|
54025
|
+
this._restoreOriginalInputs = () => {
|
|
54026
|
+
mouse.onButtonUp = up;
|
|
54027
|
+
mouse.onButtonDown = down;
|
|
54028
|
+
mouse.onMouseMove = move;
|
|
54029
|
+
mouse.onDrag = drag;
|
|
54030
|
+
};
|
|
54031
|
+
mouse.onButtonUp = (pos, btn) => {
|
|
54032
|
+
up(pos, btn);
|
|
54033
|
+
this.onMouseUp(pos);
|
|
54034
|
+
};
|
|
54035
|
+
mouse.onButtonDown = (pos, btn) => {
|
|
54036
|
+
down(pos, btn);
|
|
54037
|
+
this.onMouseDown(pos);
|
|
54038
|
+
};
|
|
54039
|
+
mouse.onMouseMove = (pos) => {
|
|
54040
|
+
move(pos);
|
|
54041
|
+
this.onMouseMove(pos);
|
|
54042
|
+
};
|
|
54043
|
+
mouse.onDrag = (pos, btn) => {
|
|
54044
|
+
if (this._handle) return;
|
|
54045
|
+
drag(pos, btn);
|
|
54046
|
+
};
|
|
54050
54047
|
}
|
|
54051
54048
|
/**
|
|
54052
54049
|
* Unregisters any previously set pointer event listeners, releasing pointer capture
|
|
54053
54050
|
* and resetting drag state.
|
|
54054
54051
|
*/
|
|
54055
54052
|
unregister() {
|
|
54056
|
-
var _a2;
|
|
54053
|
+
var _a2, _b2;
|
|
54057
54054
|
this._mouseDown = false;
|
|
54058
54055
|
(_a2 = this._handle) == null ? void 0 : _a2.highlight(false);
|
|
54059
54056
|
this._handle = void 0;
|
|
54060
|
-
this.
|
|
54061
|
-
this.
|
|
54062
|
-
this._unregisters.forEach((unreg) => unreg());
|
|
54063
|
-
this._unregisters.length = 0;
|
|
54064
|
-
}
|
|
54065
|
-
/**
|
|
54066
|
-
* Indicates if a pointer is currently captured for dragging.
|
|
54067
|
-
*/
|
|
54068
|
-
get pointerCaptured() {
|
|
54069
|
-
return this._capturedPointerId !== void 0;
|
|
54057
|
+
(_b2 = this._restoreOriginalInputs) == null ? void 0 : _b2.call(this);
|
|
54058
|
+
this._restoreOriginalInputs = void 0;
|
|
54070
54059
|
}
|
|
54071
54060
|
// -------------------------------------------------------------------------
|
|
54072
54061
|
// Private Methods
|
|
54073
54062
|
// -------------------------------------------------------------------------
|
|
54074
|
-
/**
|
|
54075
|
-
* A helper method to attach an event listener and store its unregister callback.
|
|
54076
|
-
*
|
|
54077
|
-
* @param handler - The DOM element or Window to attach the listener to.
|
|
54078
|
-
* @param type - The pointer event type, e.g. 'pointerdown'.
|
|
54079
|
-
* @param listener - The event handler function.
|
|
54080
|
-
*/
|
|
54081
|
-
reg(handler, type, listener2) {
|
|
54082
|
-
handler.addEventListener(type, listener2);
|
|
54083
|
-
this._unregisters.push(() => handler.removeEventListener(type, listener2));
|
|
54084
|
-
}
|
|
54085
|
-
/**
|
|
54086
|
-
* Called when the pointer leaves the canvas. If not dragging,
|
|
54087
|
-
* invokes {@link onFaceEnter} to indicate no active handle is hovered.
|
|
54088
|
-
*
|
|
54089
|
-
* @param event - The pointerleave event.
|
|
54090
|
-
*/
|
|
54091
|
-
onPointerLeave(event) {
|
|
54092
|
-
var _a2, _b2;
|
|
54093
|
-
if (!this.pointerCaptured) {
|
|
54094
|
-
(_b2 = this.onFaceEnter) == null ? void 0 : _b2.call(this, ((_a2 = this._handle) == null ? void 0 : _a2.forward) ?? new Vector3());
|
|
54095
|
-
}
|
|
54096
|
-
}
|
|
54097
|
-
/**
|
|
54098
|
-
* Sets pointer capture on the canvas for a specific pointer (ID).
|
|
54099
|
-
*
|
|
54100
|
-
* @param pointerId - The pointer ID to capture.
|
|
54101
|
-
*/
|
|
54102
|
-
capturePointer(pointerId) {
|
|
54103
|
-
this.releasePointer();
|
|
54104
|
-
this._viewer.viewport.canvas.setPointerCapture(pointerId);
|
|
54105
|
-
this._capturedPointerId = pointerId;
|
|
54106
|
-
}
|
|
54107
|
-
/**
|
|
54108
|
-
* Releases any captured pointer on the canvas, if present.
|
|
54109
|
-
*/
|
|
54110
|
-
releasePointer() {
|
|
54111
|
-
if (this.pointerCaptured) {
|
|
54112
|
-
this._viewer.viewport.canvas.releasePointerCapture(this._capturedPointerId);
|
|
54113
|
-
this._capturedPointerId = void 0;
|
|
54114
|
-
}
|
|
54115
|
-
}
|
|
54116
54063
|
/**
|
|
54117
54064
|
* Handles pointer movement events.
|
|
54118
54065
|
* - If dragging, calls {@link onDrag}.
|
|
@@ -54120,19 +54067,19 @@ class BoxInputs {
|
|
|
54120
54067
|
*
|
|
54121
54068
|
* @param event - The pointermove event.
|
|
54122
54069
|
*/
|
|
54123
|
-
onMouseMove(
|
|
54124
|
-
var _a2, _b2, _c, _d;
|
|
54070
|
+
onMouseMove(position) {
|
|
54071
|
+
var _a2, _b2, _c, _d, _e;
|
|
54125
54072
|
if (this._mouseDown) {
|
|
54126
|
-
this.onDrag(
|
|
54073
|
+
this.onDrag(position);
|
|
54127
54074
|
return;
|
|
54128
54075
|
}
|
|
54129
|
-
const hits = this.raycast(
|
|
54130
|
-
const handle = (_b2 = (_a2 = hits == null ? void 0 : hits[0]) == null ? void 0 : _a2.object) == null ? void 0 : _b2.userData.handle;
|
|
54076
|
+
const hits = this.raycast(position);
|
|
54077
|
+
const handle = (_c = (_b2 = (_a2 = hits == null ? void 0 : hits[0]) == null ? void 0 : _a2.object) == null ? void 0 : _b2.userData) == null ? void 0 : _c.handle;
|
|
54131
54078
|
if (handle !== this._handle) {
|
|
54132
|
-
(
|
|
54079
|
+
(_d = this._handle) == null ? void 0 : _d.highlight(false);
|
|
54133
54080
|
handle == null ? void 0 : handle.highlight(true);
|
|
54134
54081
|
this._handle = handle;
|
|
54135
|
-
(
|
|
54082
|
+
(_e = this.onFaceEnter) == null ? void 0 : _e.call(this, (handle == null ? void 0 : handle.forward) ?? new Vector3());
|
|
54136
54083
|
}
|
|
54137
54084
|
}
|
|
54138
54085
|
/**
|
|
@@ -54140,39 +54087,29 @@ class BoxInputs {
|
|
|
54140
54087
|
*
|
|
54141
54088
|
* @param event - The pointerup event.
|
|
54142
54089
|
*/
|
|
54143
|
-
onMouseUp(
|
|
54144
|
-
var _a2
|
|
54145
|
-
this.
|
|
54146
|
-
|
|
54147
|
-
|
|
54148
|
-
|
|
54149
|
-
if (event.pointerType === "mouse") {
|
|
54150
|
-
this.onMouseMove(event);
|
|
54151
|
-
} else {
|
|
54152
|
-
this._handle = void 0;
|
|
54153
|
-
(_a2 = this.onFaceEnter) == null ? void 0 : _a2.call(this, new Vector3());
|
|
54154
|
-
}
|
|
54155
|
-
(_b2 = this.onBoxConfirm) == null ? void 0 : _b2.call(this, this._sharedBox);
|
|
54156
|
-
}
|
|
54090
|
+
onMouseUp(position) {
|
|
54091
|
+
var _a2;
|
|
54092
|
+
if (!this._mouseDown) return;
|
|
54093
|
+
this._mouseDown = false;
|
|
54094
|
+
this.onMouseMove(position);
|
|
54095
|
+
(_a2 = this.onBoxConfirm) == null ? void 0 : _a2.call(this, this._sharedBox);
|
|
54157
54096
|
}
|
|
54158
54097
|
/**
|
|
54159
54098
|
* Handles pointer down events. Begins drag if a handle is hit, capturing the pointer.
|
|
54160
54099
|
*
|
|
54161
54100
|
* @param event - The pointerdown event.
|
|
54162
54101
|
*/
|
|
54163
|
-
onMouseDown(
|
|
54102
|
+
onMouseDown(position) {
|
|
54164
54103
|
var _a2, _b2, _c, _d;
|
|
54165
|
-
const hits = this.raycast(
|
|
54104
|
+
const hits = this.raycast(position);
|
|
54166
54105
|
const handle = (_c = (_b2 = (_a2 = hits == null ? void 0 : hits[0]) == null ? void 0 : _a2.object) == null ? void 0 : _b2.userData) == null ? void 0 : _c.handle;
|
|
54167
54106
|
if (!handle) return;
|
|
54168
54107
|
this._handle = handle;
|
|
54169
|
-
this.capturePointer(event.pointerId);
|
|
54170
54108
|
this._lastBox.copy(this._sharedBox);
|
|
54171
54109
|
this._dragOrigin.copy(handle.position);
|
|
54172
54110
|
const dist2 = handle.position.clone().dot(this._viewer.camera.forward);
|
|
54173
54111
|
this._dragPlane.set(this._viewer.camera.forward, -dist2);
|
|
54174
54112
|
this._mouseDown = true;
|
|
54175
|
-
this._viewer.inputs.unregisterAll();
|
|
54176
54113
|
(_d = this.onFaceEnter) == null ? void 0 : _d.call(this, this._handle.forward.clone());
|
|
54177
54114
|
}
|
|
54178
54115
|
/**
|
|
@@ -54181,10 +54118,10 @@ class BoxInputs {
|
|
|
54181
54118
|
*
|
|
54182
54119
|
* @param event - The pointermove event while dragging.
|
|
54183
54120
|
*/
|
|
54184
|
-
onDrag(
|
|
54121
|
+
onDrag(position) {
|
|
54185
54122
|
var _a2;
|
|
54186
54123
|
if (!this._handle) return;
|
|
54187
|
-
const point = this.raycastPlane(
|
|
54124
|
+
const point = this.raycastPlane(position) ?? this._dragOrigin.clone();
|
|
54188
54125
|
const delta = point.sub(this._dragOrigin);
|
|
54189
54126
|
const amount = delta.dot(this._handle.forward);
|
|
54190
54127
|
const box = this.stretch(this._handle.axis, this._handle.sign, amount);
|
|
@@ -57065,7 +57002,7 @@ function toRotation(delta, speed) {
|
|
|
57065
57002
|
rot.multiplyScalar(180 * speed);
|
|
57066
57003
|
return rot;
|
|
57067
57004
|
}
|
|
57068
|
-
function
|
|
57005
|
+
function webglInputHandler(viewer) {
|
|
57069
57006
|
return new CoreInputHandler(
|
|
57070
57007
|
viewer.viewport.canvas,
|
|
57071
57008
|
createAdapter$1(viewer),
|
|
@@ -57105,7 +57042,7 @@ function createAdapter$1(viewer) {
|
|
|
57105
57042
|
}
|
|
57106
57043
|
},
|
|
57107
57044
|
selectAtPointer: (pos, add) => {
|
|
57108
|
-
const pointer = viewer.raycaster.
|
|
57045
|
+
const pointer = viewer.raycaster.raycastFromScreen(pos);
|
|
57109
57046
|
if (add) {
|
|
57110
57047
|
viewer.selection.add(pointer.object);
|
|
57111
57048
|
} else {
|
|
@@ -57113,7 +57050,7 @@ function createAdapter$1(viewer) {
|
|
|
57113
57050
|
}
|
|
57114
57051
|
},
|
|
57115
57052
|
frameAtPointer: (pos) => {
|
|
57116
|
-
const pointer = viewer.raycaster.
|
|
57053
|
+
const pointer = viewer.raycaster.raycastFromScreen(pos);
|
|
57117
57054
|
viewer.camera.lerp(0.75).frame(pointer.object);
|
|
57118
57055
|
},
|
|
57119
57056
|
zoom: (value) => {
|
|
@@ -57192,13 +57129,12 @@ class Viewer {
|
|
|
57192
57129
|
this._camera,
|
|
57193
57130
|
this.settings
|
|
57194
57131
|
);
|
|
57195
|
-
this.inputs =
|
|
57132
|
+
this.inputs = webglInputHandler(this);
|
|
57196
57133
|
this.gizmos = new Gizmos(this, this._camera);
|
|
57197
57134
|
this.materials.applySettings(this.settings);
|
|
57198
57135
|
this.environment = new Environment(this.camera, this.renderer, this.materials, this.settings);
|
|
57199
57136
|
this.selection = new Selection(this.materials);
|
|
57200
57137
|
this.raycaster = new Raycaster2(
|
|
57201
|
-
this.viewport,
|
|
57202
57138
|
this._camera,
|
|
57203
57139
|
scene,
|
|
57204
57140
|
this.renderer
|
|
@@ -57484,7 +57420,6 @@ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
57484
57420
|
},
|
|
57485
57421
|
HitTestResult: RaycastResult,
|
|
57486
57422
|
IProgressLogs: distExports$2.IProgressLogs,
|
|
57487
|
-
InputAction,
|
|
57488
57423
|
InsertableMesh,
|
|
57489
57424
|
Object3D: Object3D2,
|
|
57490
57425
|
Scene: Scene2,
|
|
@@ -61015,7 +60950,7 @@ class VimCollection {
|
|
|
61015
60950
|
const defaultRenderSettings = {
|
|
61016
60951
|
...defaultSceneSettings,
|
|
61017
60952
|
lockIblRotation: true,
|
|
61018
|
-
ghostColor: new RGBA(
|
|
60953
|
+
ghostColor: new RGBA(14 / 255, 14 / 255, 14 / 255, 1 / 255)
|
|
61019
60954
|
};
|
|
61020
60955
|
class Renderer2 {
|
|
61021
60956
|
/**
|
|
@@ -61366,16 +61301,13 @@ function createAdapter(viewer) {
|
|
|
61366
61301
|
viewer.rpc.RPCSetMoveSpeed(10);
|
|
61367
61302
|
},
|
|
61368
61303
|
orbitCamera: (value) => {
|
|
61369
|
-
console.log("orbitCamera");
|
|
61370
61304
|
},
|
|
61371
61305
|
rotateCamera: (value) => {
|
|
61372
|
-
console.log("rotateCamera");
|
|
61373
61306
|
},
|
|
61374
61307
|
panCamera: (value) => {
|
|
61375
|
-
console.log("panCamera");
|
|
61376
61308
|
},
|
|
61377
61309
|
toggleOrthographic: () => {
|
|
61378
|
-
console.log("toggleOrthographic");
|
|
61310
|
+
console.log("toggleOrthographic. Not supported yet");
|
|
61379
61311
|
},
|
|
61380
61312
|
resetCamera: () => {
|
|
61381
61313
|
viewer.camera.restoreSavedPosition();
|
|
@@ -61387,9 +61319,7 @@ function createAdapter(viewer) {
|
|
|
61387
61319
|
frameContext(viewer);
|
|
61388
61320
|
},
|
|
61389
61321
|
selectAtPointer: async (pos, add) => {
|
|
61390
|
-
console.log("selectAtPointer", pos, add);
|
|
61391
61322
|
const hit = await viewer.selection.hitTest(pos);
|
|
61392
|
-
console.log("hit", hit);
|
|
61393
61323
|
if (!hit) {
|
|
61394
61324
|
viewer.selection.clear();
|
|
61395
61325
|
return;
|
|
@@ -61412,7 +61342,6 @@ function createAdapter(viewer) {
|
|
|
61412
61342
|
viewer.rpc.RPCMouseScrollEvent(value >= 1 ? 1 : -1);
|
|
61413
61343
|
},
|
|
61414
61344
|
moveCamera: (value) => {
|
|
61415
|
-
console.log("moveCamera");
|
|
61416
61345
|
},
|
|
61417
61346
|
keyDown: (code) => {
|
|
61418
61347
|
const key = CODE_TO_KEYCODE[code];
|
|
@@ -66437,6 +66366,55 @@ function hidden({ height, width, fill: fill2, className = "" }) {
|
|
|
66437
66366
|
}
|
|
66438
66367
|
);
|
|
66439
66368
|
}
|
|
66369
|
+
function frameScene({ height, width, fill: fill2, className }) {
|
|
66370
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
66371
|
+
"svg",
|
|
66372
|
+
{
|
|
66373
|
+
className,
|
|
66374
|
+
height,
|
|
66375
|
+
width,
|
|
66376
|
+
viewBox: "0 0 256 256",
|
|
66377
|
+
children: [
|
|
66378
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
|
|
66379
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66380
|
+
"path",
|
|
66381
|
+
{
|
|
66382
|
+
fill: fill2,
|
|
66383
|
+
d: "M236,12H20C9,12,0,21,0,32V224c0,11,9,20,20,20H236c11,0,20-9,20-20V32c0-11-9-20-20-20Zm-4,200c0,4.418-3.582,8-8,8H32c-4.418,0-8-3.582-8-8V44c0-4.418,3.582-8,8-8H224c4.418,0,8,3.582,8,8V212Z"
|
|
66384
|
+
}
|
|
66385
|
+
),
|
|
66386
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66387
|
+
"path",
|
|
66388
|
+
{
|
|
66389
|
+
fill: fill2,
|
|
66390
|
+
d: "M210,204h-42c-6.627,0-12-5.373-12-12h0c0-6.627,5.373-12,12-12h24s0-24,0-24c0-6.627,5.373-12,12-12h0\r\n c6.627,0,12,5.373,12,12v42c0,3.314-2.686,6-6,6Z"
|
|
66391
|
+
}
|
|
66392
|
+
),
|
|
66393
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66394
|
+
"path",
|
|
66395
|
+
{
|
|
66396
|
+
fill: fill2,
|
|
66397
|
+
d: "M40,198v-42c0-6.627,5.373-12,12-12h0c6.627,0,12,5.373,12,12v24s24,0,24,0\r\n c6.627,0,12,5.373,12,12h0c0,6.627-5.373,12-12,12H46c-3.314,0-6-2.686-6-6Z"
|
|
66398
|
+
}
|
|
66399
|
+
),
|
|
66400
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66401
|
+
"path",
|
|
66402
|
+
{
|
|
66403
|
+
fill: fill2,
|
|
66404
|
+
d: "M46,52h42c6.627,0,12,5.373,12,12h0c0,6.627-5.373,12-12,12h-24s0,24,0,24\r\n c0,6.627-5.373,12-12,12h0c-6.627,0-12-5.373-12-12V58c0-3.314,2.686-6,6-6Z"
|
|
66405
|
+
}
|
|
66406
|
+
),
|
|
66407
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66408
|
+
"path",
|
|
66409
|
+
{
|
|
66410
|
+
fill: fill2,
|
|
66411
|
+
d: "M216,58v42c0,6.627-5.373,12-12,12h0c-6.627,0-12-5.373-12-12v-24s-24,0-24,0\r\n c-6.627,0-12-5.373-12-12h0c0-6.627,5.373-12,12-12h42c3.314,0,6,2.686,6,6Z"
|
|
66412
|
+
}
|
|
66413
|
+
)
|
|
66414
|
+
]
|
|
66415
|
+
}
|
|
66416
|
+
);
|
|
66417
|
+
}
|
|
66440
66418
|
function autoCamera({ height, width, fill: fill2 = "", className }) {
|
|
66441
66419
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
|
|
66442
66420
|
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
|
|
@@ -66985,6 +66963,7 @@ const icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
66985
66963
|
close,
|
|
66986
66964
|
collapse,
|
|
66987
66965
|
frameRect,
|
|
66966
|
+
frameScene,
|
|
66988
66967
|
frameSelection,
|
|
66989
66968
|
fullArrowLeft,
|
|
66990
66969
|
fullsScreen,
|
|
@@ -67030,7 +67009,7 @@ function anyUiAxesButton(settings2) {
|
|
|
67030
67009
|
return settings2.ui.orthographic || settings2.ui.resetCamera || settings2.ui.enableGhost;
|
|
67031
67010
|
}
|
|
67032
67011
|
function anyUiCursorButton(settings2) {
|
|
67033
|
-
return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow)
|
|
67012
|
+
return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow);
|
|
67034
67013
|
}
|
|
67035
67014
|
function anyUiSettingButton(settings2) {
|
|
67036
67015
|
return isTrue(settings2.ui.projectInspector) || isTrue(settings2.ui.settings) || isTrue(settings2.ui.help) || isTrue(settings2.ui.maximise);
|
|
@@ -67068,7 +67047,10 @@ const defaultSettings = {
|
|
|
67068
67047
|
pan: true,
|
|
67069
67048
|
zoom: true,
|
|
67070
67049
|
zoomWindow: true,
|
|
67071
|
-
|
|
67050
|
+
// Control bar - camera
|
|
67051
|
+
autoCamera: true,
|
|
67052
|
+
frameScene: true,
|
|
67053
|
+
frameSelection: true,
|
|
67072
67054
|
// Control bar - tools
|
|
67073
67055
|
sectioningMode: true,
|
|
67074
67056
|
measuringMode: true,
|
|
@@ -67227,7 +67209,10 @@ const ids = {
|
|
|
67227
67209
|
sectionMeasure: "controlBar.sectionMeasure",
|
|
67228
67210
|
sectionSectionBox: "controlBar.sectionSectionBox",
|
|
67229
67211
|
// Camera buttons
|
|
67212
|
+
buttonCameraFrameSelection: "controlBar.camera.frameSelection",
|
|
67213
|
+
buttonCameraFrameScene: "controlBar.camera.frameScene",
|
|
67230
67214
|
buttonCameraAuto: "controlBar.camera.auto",
|
|
67215
|
+
// Camera Control buttons
|
|
67231
67216
|
buttonCameraOrbit: "controlBar.camera.orbit",
|
|
67232
67217
|
buttonCameraLook: "controlBarcamera.look",
|
|
67233
67218
|
buttonCameraPan: "controlBar.camera.pan",
|
|
@@ -67240,16 +67225,15 @@ const ids = {
|
|
|
67240
67225
|
buttonMaximize: "controlBar.maximize",
|
|
67241
67226
|
// Action Buttons
|
|
67242
67227
|
buttonToggleIsolation: "controlBar.action.toggleIsolation",
|
|
67243
|
-
buttonZoomToFit: "controlBar.action.zoomToFit",
|
|
67244
67228
|
// Tools buttons
|
|
67245
67229
|
buttonSectionBox: "controlBar.sectionBox",
|
|
67246
67230
|
buttonMeasure: "controlBar.measure",
|
|
67247
67231
|
// Section box buttons
|
|
67248
67232
|
buttonSectionBoxEnable: "controlBar.sectionBox.enable",
|
|
67249
67233
|
buttonSectionBoxVisible: "controlBar.sectionBox.visible",
|
|
67250
|
-
|
|
67234
|
+
buttonSectionBoxToSelection: "controlBar.sectionBox.sectionSelection",
|
|
67235
|
+
buttonSectionBoxToScene: "controlBar.sectionBox.sectionScene",
|
|
67251
67236
|
buttonSectionBoxAuto: "controlBar.sectionBox.auto",
|
|
67252
|
-
buttonSectionBoxReset: "controlBar.sectionBox.reset",
|
|
67253
67237
|
buttonSectionBoxSettings: "controlBar.sectionBox.settings"
|
|
67254
67238
|
};
|
|
67255
67239
|
function ControlBar(props) {
|
|
@@ -67482,7 +67466,7 @@ function controlBarSectionBox(section, hasSelection) {
|
|
|
67482
67466
|
icon: sectionBox
|
|
67483
67467
|
},
|
|
67484
67468
|
{
|
|
67485
|
-
id: ids.
|
|
67469
|
+
id: ids.buttonSectionBoxToSelection,
|
|
67486
67470
|
tip: "Fit Section",
|
|
67487
67471
|
enabled: () => section.enable.get(),
|
|
67488
67472
|
isOn: () => hasSelection,
|
|
@@ -67491,11 +67475,11 @@ function controlBarSectionBox(section, hasSelection) {
|
|
|
67491
67475
|
icon: sectionBoxShrink
|
|
67492
67476
|
},
|
|
67493
67477
|
{
|
|
67494
|
-
id: ids.
|
|
67478
|
+
id: ids.buttonSectionBoxToScene,
|
|
67495
67479
|
tip: "Reset Section",
|
|
67496
67480
|
enabled: () => section.enable.get(),
|
|
67497
67481
|
style: (on) => buttonDefaultStyle(on),
|
|
67498
|
-
action: () => section.
|
|
67482
|
+
action: () => section.sectionScene.call(),
|
|
67499
67483
|
icon: sectionBoxReset
|
|
67500
67484
|
},
|
|
67501
67485
|
{
|
|
@@ -67591,15 +67575,6 @@ function controlBarActions(camera2, settings2, isolation, measure$1) {
|
|
|
67591
67575
|
enable: () => true,
|
|
67592
67576
|
style: sectionDefaultStyle,
|
|
67593
67577
|
buttons: [
|
|
67594
|
-
{
|
|
67595
|
-
id: ids.buttonZoomToFit,
|
|
67596
|
-
enabled: () => isTrue(settings2.ui.zoomToFit),
|
|
67597
|
-
tip: "Frame Camera",
|
|
67598
|
-
action: () => camera2.frameSelection.call(),
|
|
67599
|
-
icon: frameSelection,
|
|
67600
|
-
isOn: () => false,
|
|
67601
|
-
style: buttonDefaultStyle
|
|
67602
|
-
},
|
|
67603
67578
|
{
|
|
67604
67579
|
id: ids.buttonToggleIsolation,
|
|
67605
67580
|
enabled: () => isTrue(settings2.ui.toggleIsolation),
|
|
@@ -67675,6 +67650,24 @@ function controlBarCamera(camera2) {
|
|
|
67675
67650
|
action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
|
|
67676
67651
|
icon: autoCamera,
|
|
67677
67652
|
style: buttonDefaultStyle
|
|
67653
|
+
},
|
|
67654
|
+
{
|
|
67655
|
+
id: ids.buttonCameraFrameSelection,
|
|
67656
|
+
// enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
|
|
67657
|
+
tip: "Frame Selection",
|
|
67658
|
+
action: () => camera2.frameSelection.call(),
|
|
67659
|
+
icon: frameSelection,
|
|
67660
|
+
isOn: () => false,
|
|
67661
|
+
style: buttonDefaultStyle
|
|
67662
|
+
},
|
|
67663
|
+
{
|
|
67664
|
+
id: ids.buttonCameraFrameScene,
|
|
67665
|
+
// enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
|
|
67666
|
+
tip: "Frame All",
|
|
67667
|
+
action: () => camera2.frameScene.call(),
|
|
67668
|
+
icon: frameScene,
|
|
67669
|
+
isOn: () => false,
|
|
67670
|
+
style: buttonDefaultStyle
|
|
67678
67671
|
}
|
|
67679
67672
|
]
|
|
67680
67673
|
};
|
|
@@ -74094,9 +74087,9 @@ function MenuSettings(props) {
|
|
|
74094
74087
|
(settings2, value) => settings2.ui.zoomWindow = value
|
|
74095
74088
|
),
|
|
74096
74089
|
settingsToggle(
|
|
74097
|
-
"Show Zoom
|
|
74098
|
-
(settings2) => settings2.ui.
|
|
74099
|
-
(settings2, value) => settings2.ui.
|
|
74090
|
+
"Show Zoom Frame Selection Button",
|
|
74091
|
+
(settings2) => settings2.ui.frameSelection,
|
|
74092
|
+
(settings2, value) => settings2.ui.frameSelection = value
|
|
74100
74093
|
),
|
|
74101
74094
|
settingsSubtitle("Control Bar - Tools"),
|
|
74102
74095
|
settingsToggle(
|
|
@@ -75296,26 +75289,50 @@ function useStateRef(initialValue) {
|
|
|
75296
75289
|
event.current.dispatch(finalValue);
|
|
75297
75290
|
};
|
|
75298
75291
|
return {
|
|
75292
|
+
/**
|
|
75293
|
+
* Returns the current state value.
|
|
75294
|
+
*/
|
|
75299
75295
|
get() {
|
|
75300
75296
|
return ref.current;
|
|
75301
75297
|
},
|
|
75302
75298
|
set: set3,
|
|
75299
|
+
/**
|
|
75300
|
+
* Confirms the current state by applying the confirm function and updating the state.
|
|
75301
|
+
*/
|
|
75303
75302
|
confirm() {
|
|
75304
75303
|
set3(confirm.current(ref.current));
|
|
75305
75304
|
},
|
|
75305
|
+
/**
|
|
75306
|
+
* Registers a callback to be invoked when the state changes.
|
|
75307
|
+
* @param on - The callback function that receives the new state value.
|
|
75308
|
+
*/
|
|
75306
75309
|
useOnChange(on) {
|
|
75307
75310
|
useEffect(() => {
|
|
75308
75311
|
return event.current.subscribe(on);
|
|
75309
75312
|
}, []);
|
|
75310
75313
|
},
|
|
75314
|
+
/**
|
|
75315
|
+
* Memoizes a value based on the current state and additional dependencies.
|
|
75316
|
+
* @param on - A function that computes a value based on the current state.
|
|
75317
|
+
* @param deps - Optional additional dependencies.
|
|
75318
|
+
* @returns The memoized value.
|
|
75319
|
+
*/
|
|
75311
75320
|
useMemo(on, deps) {
|
|
75312
75321
|
return useMemo(() => on(value), [...deps || [], value]);
|
|
75313
75322
|
},
|
|
75323
|
+
/**
|
|
75324
|
+
* Sets a validation function to process any new state value before updating.
|
|
75325
|
+
* @param on - A function that validates (and optionally transforms) the new state value.
|
|
75326
|
+
*/
|
|
75314
75327
|
useValidate(on) {
|
|
75315
75328
|
useEffect(() => {
|
|
75316
75329
|
validate.current = on;
|
|
75317
75330
|
}, []);
|
|
75318
75331
|
},
|
|
75332
|
+
/**
|
|
75333
|
+
* Sets a confirmation function to process the state value during confirmation.
|
|
75334
|
+
* @param on - A function that confirms (and optionally transforms) the current state value.
|
|
75335
|
+
*/
|
|
75319
75336
|
useConfirm(on) {
|
|
75320
75337
|
useEffect(() => {
|
|
75321
75338
|
confirm.current = on;
|
|
@@ -75332,8 +75349,22 @@ function useActionRef(action) {
|
|
|
75332
75349
|
get() {
|
|
75333
75350
|
return ref.current;
|
|
75334
75351
|
},
|
|
75335
|
-
set(
|
|
75336
|
-
ref.current =
|
|
75352
|
+
set(fn) {
|
|
75353
|
+
ref.current = fn;
|
|
75354
|
+
},
|
|
75355
|
+
prepend(fn) {
|
|
75356
|
+
const oldFn = ref.current;
|
|
75357
|
+
ref.current = () => {
|
|
75358
|
+
fn();
|
|
75359
|
+
oldFn();
|
|
75360
|
+
};
|
|
75361
|
+
},
|
|
75362
|
+
append(fn) {
|
|
75363
|
+
const oldFn = ref.current;
|
|
75364
|
+
ref.current = () => {
|
|
75365
|
+
oldFn();
|
|
75366
|
+
fn();
|
|
75367
|
+
};
|
|
75337
75368
|
}
|
|
75338
75369
|
};
|
|
75339
75370
|
}
|
|
@@ -75343,30 +75374,83 @@ function useArgActionRef(action) {
|
|
|
75343
75374
|
call(arg) {
|
|
75344
75375
|
ref == null ? void 0 : ref.current(arg);
|
|
75345
75376
|
},
|
|
75346
|
-
|
|
75347
|
-
ref.current
|
|
75377
|
+
get() {
|
|
75378
|
+
return ref.current;
|
|
75379
|
+
},
|
|
75380
|
+
set(fn) {
|
|
75381
|
+
ref.current = fn;
|
|
75382
|
+
},
|
|
75383
|
+
prepend(fn) {
|
|
75384
|
+
const oldFn = ref.current;
|
|
75385
|
+
ref.current = (arg) => {
|
|
75386
|
+
fn(arg);
|
|
75387
|
+
oldFn(arg);
|
|
75388
|
+
};
|
|
75389
|
+
},
|
|
75390
|
+
append(fn) {
|
|
75391
|
+
const oldFn = ref.current;
|
|
75392
|
+
ref.current = (arg) => {
|
|
75393
|
+
oldFn(arg);
|
|
75394
|
+
fn(arg);
|
|
75395
|
+
};
|
|
75348
75396
|
}
|
|
75349
75397
|
};
|
|
75350
75398
|
}
|
|
75351
|
-
function useFuncRef(
|
|
75352
|
-
const ref = useRef(
|
|
75399
|
+
function useFuncRef(fn) {
|
|
75400
|
+
const ref = useRef(fn);
|
|
75353
75401
|
return {
|
|
75354
75402
|
call() {
|
|
75355
75403
|
return ref == null ? void 0 : ref.current();
|
|
75356
75404
|
},
|
|
75357
|
-
|
|
75358
|
-
ref.current
|
|
75405
|
+
get() {
|
|
75406
|
+
return ref.current;
|
|
75407
|
+
},
|
|
75408
|
+
set(fn2) {
|
|
75409
|
+
ref.current = fn2;
|
|
75410
|
+
},
|
|
75411
|
+
prepend(fn2) {
|
|
75412
|
+
const oldFn = ref.current;
|
|
75413
|
+
ref.current = () => {
|
|
75414
|
+
fn2();
|
|
75415
|
+
return oldFn();
|
|
75416
|
+
};
|
|
75417
|
+
},
|
|
75418
|
+
append(fn2) {
|
|
75419
|
+
const oldFn = ref.current;
|
|
75420
|
+
ref.current = () => {
|
|
75421
|
+
const result = oldFn();
|
|
75422
|
+
fn2();
|
|
75423
|
+
return result;
|
|
75424
|
+
};
|
|
75359
75425
|
}
|
|
75360
75426
|
};
|
|
75361
75427
|
}
|
|
75362
|
-
function useAsyncFuncRef(
|
|
75363
|
-
const ref = useRef(
|
|
75428
|
+
function useAsyncFuncRef(fn) {
|
|
75429
|
+
const ref = useRef(fn);
|
|
75364
75430
|
return {
|
|
75365
75431
|
async call() {
|
|
75366
75432
|
return ref == null ? void 0 : ref.current();
|
|
75367
75433
|
},
|
|
75368
|
-
|
|
75369
|
-
ref.current
|
|
75434
|
+
get() {
|
|
75435
|
+
return ref.current;
|
|
75436
|
+
},
|
|
75437
|
+
set(fn2) {
|
|
75438
|
+
ref.current = fn2;
|
|
75439
|
+
},
|
|
75440
|
+
prepend(fn2) {
|
|
75441
|
+
const oldFn = ref.current;
|
|
75442
|
+
ref.current = async () => {
|
|
75443
|
+
await fn2();
|
|
75444
|
+
return await oldFn();
|
|
75445
|
+
};
|
|
75446
|
+
},
|
|
75447
|
+
append(fn2) {
|
|
75448
|
+
const oldFn = ref.current;
|
|
75449
|
+
ref.current = async () => {
|
|
75450
|
+
const result = await oldFn();
|
|
75451
|
+
await fn2();
|
|
75452
|
+
return result;
|
|
75453
|
+
};
|
|
75370
75454
|
}
|
|
75371
75455
|
};
|
|
75372
75456
|
}
|
|
@@ -75433,9 +75517,10 @@ function useSectionBox(adapter) {
|
|
|
75433
75517
|
sideOffset,
|
|
75434
75518
|
bottomOffset,
|
|
75435
75519
|
sectionSelection,
|
|
75436
|
-
|
|
75520
|
+
sectionScene,
|
|
75437
75521
|
sectionBox: sectionBox2,
|
|
75438
75522
|
getBox: () => adapter.getBox(),
|
|
75523
|
+
// TODO - Remove these from here, it should be overriden at the component level.
|
|
75439
75524
|
getSceneBox,
|
|
75440
75525
|
getSelectionBox
|
|
75441
75526
|
};
|
|
@@ -75477,7 +75562,7 @@ function useWebglSectionBox(viewer) {
|
|
|
75477
75562
|
};
|
|
75478
75563
|
return useSectionBox(vimAdapter);
|
|
75479
75564
|
}
|
|
75480
|
-
function useCamera(adapter) {
|
|
75565
|
+
function useCamera(adapter, section) {
|
|
75481
75566
|
const autoCamera2 = useStateRef(false);
|
|
75482
75567
|
autoCamera2.useOnChange((v) => {
|
|
75483
75568
|
if (v) {
|
|
@@ -75485,22 +75570,25 @@ function useCamera(adapter) {
|
|
|
75485
75570
|
}
|
|
75486
75571
|
});
|
|
75487
75572
|
useEffect(() => {
|
|
75488
|
-
|
|
75573
|
+
const refresh = () => {
|
|
75489
75574
|
if (autoCamera2.get()) {
|
|
75490
75575
|
frameSelection2.call();
|
|
75491
75576
|
}
|
|
75492
|
-
}
|
|
75577
|
+
};
|
|
75578
|
+
section.sectionSelection.append(refresh);
|
|
75579
|
+
section.sectionScene.append(refresh);
|
|
75580
|
+
adapter.onSelectionChanged.sub(refresh);
|
|
75493
75581
|
}, []);
|
|
75494
75582
|
const reset = useActionRef(() => adapter.resetCamera(1));
|
|
75495
75583
|
const getSelectionBox = useAsyncFuncRef(adapter.getSelectionBox);
|
|
75496
75584
|
const getSceneBox = useAsyncFuncRef(adapter.getSceneBox);
|
|
75497
75585
|
const frameSelection2 = useAsyncFuncRef(async () => {
|
|
75498
75586
|
const box = await getSelectionBox.call() ?? await getSceneBox.call();
|
|
75499
|
-
frame(adapter, box);
|
|
75587
|
+
frame(adapter, section, box);
|
|
75500
75588
|
});
|
|
75501
|
-
const
|
|
75589
|
+
const frameScene2 = useAsyncFuncRef(async () => {
|
|
75502
75590
|
const box = await getSceneBox.call();
|
|
75503
|
-
frame(adapter, box);
|
|
75591
|
+
frame(adapter, section, box);
|
|
75504
75592
|
});
|
|
75505
75593
|
return {
|
|
75506
75594
|
getSelectionBox,
|
|
@@ -75508,17 +75596,18 @@ function useCamera(adapter) {
|
|
|
75508
75596
|
autoCamera: autoCamera2,
|
|
75509
75597
|
reset,
|
|
75510
75598
|
frameSelection: frameSelection2,
|
|
75511
|
-
frameScene
|
|
75599
|
+
frameScene: frameScene2
|
|
75512
75600
|
};
|
|
75513
75601
|
}
|
|
75514
|
-
function frame(adapter, box) {
|
|
75515
|
-
if (
|
|
75516
|
-
|
|
75602
|
+
function frame(adapter, section, box) {
|
|
75603
|
+
if (!box) return;
|
|
75604
|
+
if (section.enable.get()) {
|
|
75605
|
+
const sectionBox2 = section.getBox();
|
|
75517
75606
|
if (section) {
|
|
75518
|
-
box.intersect(
|
|
75607
|
+
box.intersect(sectionBox2);
|
|
75519
75608
|
}
|
|
75520
75609
|
if (box.isEmpty()) {
|
|
75521
|
-
box.copy(
|
|
75610
|
+
box.copy(sectionBox2);
|
|
75522
75611
|
}
|
|
75523
75612
|
}
|
|
75524
75613
|
adapter.frameCamera(box, 1);
|
|
@@ -75529,10 +75618,8 @@ function useWebglCamera(viewer, section) {
|
|
|
75529
75618
|
frameCamera: (box, duration) => viewer.camera.lerp(duration).frame(box),
|
|
75530
75619
|
resetCamera: (duration) => viewer.camera.lerp(duration).reset(),
|
|
75531
75620
|
getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox()),
|
|
75532
|
-
|
|
75533
|
-
|
|
75534
|
-
isSectionBoxEnabled: () => section.enable.get()
|
|
75535
|
-
});
|
|
75621
|
+
getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox())
|
|
75622
|
+
}, section);
|
|
75536
75623
|
}
|
|
75537
75624
|
function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
|
|
75538
75625
|
const promise2 = new DeferredPromise();
|
|
@@ -76035,39 +76122,18 @@ function useUltraSectionBox(viewer) {
|
|
|
76035
76122
|
function useUltraControlBar(viewer, section, camera2, customization) {
|
|
76036
76123
|
const sectionSectionBox = controlBarSectionBox(section, viewer.selection.count > 0);
|
|
76037
76124
|
const sectionCamera = controlBarCamera(camera2);
|
|
76038
|
-
|
|
76039
|
-
let bar = [sectionCamera, frame2, sectionSectionBox];
|
|
76125
|
+
let bar = [sectionCamera, sectionSectionBox];
|
|
76040
76126
|
bar = (customization == null ? void 0 : customization(bar)) ?? bar;
|
|
76041
76127
|
return bar;
|
|
76042
76128
|
}
|
|
76043
|
-
function frameSection(camera2) {
|
|
76044
|
-
return {
|
|
76045
|
-
id: ids.sectionActions,
|
|
76046
|
-
enable: () => true,
|
|
76047
|
-
style: sectionDefaultStyle,
|
|
76048
|
-
buttons: [
|
|
76049
|
-
{
|
|
76050
|
-
id: ids.buttonZoomToFit,
|
|
76051
|
-
enabled: () => true,
|
|
76052
|
-
tip: "Frame Camera",
|
|
76053
|
-
action: () => camera2.frameSelection.call(),
|
|
76054
|
-
icon: frameSelection,
|
|
76055
|
-
isOn: () => false,
|
|
76056
|
-
style: buttonDefaultStyle
|
|
76057
|
-
}
|
|
76058
|
-
]
|
|
76059
|
-
};
|
|
76060
|
-
}
|
|
76061
76129
|
function useUltraCamera(viewer, section) {
|
|
76062
76130
|
return useCamera({
|
|
76063
76131
|
onSelectionChanged: viewer.selection.onValueChanged,
|
|
76064
76132
|
frameCamera: (box, duration) => void viewer.camera.frameBox(box, duration),
|
|
76065
76133
|
resetCamera: (duration) => viewer.camera.restoreSavedPosition(duration),
|
|
76066
76134
|
getSelectionBox: () => viewer.selection.getBoundingBox(),
|
|
76067
|
-
getSceneBox: () => viewer.renderer.getBoundingBox()
|
|
76068
|
-
|
|
76069
|
-
isSectionBoxEnabled: () => section.enable.get()
|
|
76070
|
-
});
|
|
76135
|
+
getSceneBox: () => viewer.renderer.getBoundingBox()
|
|
76136
|
+
}, section);
|
|
76071
76137
|
}
|
|
76072
76138
|
function createUltraComponent(container) {
|
|
76073
76139
|
const promise2 = new DeferredPromise();
|