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.iife.js
CHANGED
|
@@ -50680,13 +50680,11 @@ void main() {
|
|
|
50680
50680
|
return this._clock.running;
|
|
50681
50681
|
}
|
|
50682
50682
|
init(duration) {
|
|
50683
|
-
console.log("init lerp");
|
|
50684
50683
|
this.cancel();
|
|
50685
50684
|
this._duration = Math.max(duration, 0.01);
|
|
50686
50685
|
this._clock.start();
|
|
50687
50686
|
}
|
|
50688
50687
|
cancel() {
|
|
50689
|
-
console.log("cancel");
|
|
50690
50688
|
this._clock.stop();
|
|
50691
50689
|
this.onProgress = void 0;
|
|
50692
50690
|
}
|
|
@@ -51670,24 +51668,24 @@ void main() {
|
|
|
51670
51668
|
__publicField(this, "intersections");
|
|
51671
51669
|
__publicField(this, "firstHit");
|
|
51672
51670
|
this.intersections = intersections;
|
|
51673
|
-
const [markerHit, marker] = this.
|
|
51671
|
+
const [markerHit, marker] = this.getFirstMarkerHit(intersections);
|
|
51674
51672
|
if (marker) {
|
|
51675
51673
|
this.object = marker;
|
|
51676
51674
|
this.firstHit = markerHit;
|
|
51677
51675
|
return;
|
|
51678
51676
|
}
|
|
51679
|
-
const [objectHit, obj] = this.
|
|
51677
|
+
const [objectHit, obj] = this.getFirstVimHit(intersections);
|
|
51680
51678
|
this.firstHit = objectHit;
|
|
51681
51679
|
this.object = obj;
|
|
51682
51680
|
}
|
|
51683
|
-
|
|
51681
|
+
getFirstVimHit(intersections) {
|
|
51684
51682
|
for (let i2 = 0; i2 < intersections.length; i2++) {
|
|
51685
51683
|
const obj = this.getVimObjectFromHit(intersections[i2]);
|
|
51686
51684
|
if (obj == null ? void 0 : obj.visible) return [intersections[i2], obj];
|
|
51687
51685
|
}
|
|
51688
51686
|
return [];
|
|
51689
51687
|
}
|
|
51690
|
-
|
|
51688
|
+
getFirstMarkerHit(intersections) {
|
|
51691
51689
|
for (let i2 = 0; i2 < intersections.length; i2++) {
|
|
51692
51690
|
const data2 = intersections[i2].object.userData.vim;
|
|
51693
51691
|
if (data2 instanceof GizmoMarkers) {
|
|
@@ -51704,7 +51702,7 @@ void main() {
|
|
|
51704
51702
|
const sub = mesh.merged ? mesh.getSubmeshFromFace(hit.faceIndex) : mesh.getSubMesh(hit.instanceId);
|
|
51705
51703
|
return sub.object;
|
|
51706
51704
|
}
|
|
51707
|
-
// Convenience
|
|
51705
|
+
// Convenience getters for hit information
|
|
51708
51706
|
get isHit() {
|
|
51709
51707
|
return !!this.firstHit;
|
|
51710
51708
|
}
|
|
@@ -51726,28 +51724,27 @@ void main() {
|
|
|
51726
51724
|
}
|
|
51727
51725
|
}
|
|
51728
51726
|
class Raycaster {
|
|
51729
|
-
constructor(
|
|
51730
|
-
__publicField(this, "_viewport");
|
|
51727
|
+
constructor(camera2, scene, renderer) {
|
|
51731
51728
|
__publicField(this, "_camera");
|
|
51732
51729
|
__publicField(this, "_scene");
|
|
51733
51730
|
__publicField(this, "_renderer");
|
|
51734
51731
|
__publicField(this, "_raycaster", new Raycaster$1());
|
|
51735
|
-
this._viewport = viewport;
|
|
51736
51732
|
this._camera = camera2;
|
|
51737
51733
|
this._scene = scene;
|
|
51738
51734
|
this._renderer = renderer;
|
|
51739
51735
|
}
|
|
51740
51736
|
/**
|
|
51741
|
-
* Performs a raycast
|
|
51742
|
-
*
|
|
51737
|
+
* Performs a raycast from the camera using normalized screen coordinates.
|
|
51738
|
+
* Coordinates must be within [0, 1] for both x and y.
|
|
51739
|
+
* If the coordinates are out of bounds, an error is logged and an empty result is returned.
|
|
51740
|
+
*
|
|
51741
|
+
* @param {THREE.Vector2} position - The normalized screen position for raycasting.
|
|
51743
51742
|
*/
|
|
51744
|
-
|
|
51745
|
-
if (position.x < 0 || position.y < 0) {
|
|
51743
|
+
raycastFromScreen(position) {
|
|
51744
|
+
if (position.x < 0 || position.y < 0 || position.x > 1 || position.y > 1) {
|
|
51746
51745
|
console.error("Invalid position for raycasting");
|
|
51747
51746
|
return new RaycastResult([]);
|
|
51748
51747
|
}
|
|
51749
|
-
position.x *= position.x < 1 ? this._viewport.getSize().x : 1;
|
|
51750
|
-
position.y *= position.y < 1 ? this._viewport.getSize().y : 1;
|
|
51751
51748
|
this._raycaster = this.fromPoint2(position, this._raycaster);
|
|
51752
51749
|
let hits = this._raycaster.intersectObjects(this._scene.scene.children);
|
|
51753
51750
|
hits = this.filterHits(hits);
|
|
@@ -51757,35 +51754,46 @@ void main() {
|
|
|
51757
51754
|
return this._renderer.section.active ? hits.filter((i2) => this._renderer.section.box.containsPoint(i2.point)) : hits;
|
|
51758
51755
|
}
|
|
51759
51756
|
/**
|
|
51760
|
-
* Performs a raycast
|
|
51761
|
-
*
|
|
51757
|
+
* Performs a raycast from the camera towards a specified world position.
|
|
51758
|
+
*
|
|
51759
|
+
* @param {THREE.Vector3} position - The target world position for raycasting.
|
|
51762
51760
|
*/
|
|
51763
|
-
|
|
51761
|
+
raycastFromWorld(position) {
|
|
51764
51762
|
this._raycaster = this.fromPoint3(position, this._raycaster);
|
|
51765
51763
|
let hits = this._raycaster.intersectObjects(this._scene.scene.children);
|
|
51766
51764
|
hits = this.filterHits(hits);
|
|
51767
51765
|
return new RaycastResult(hits);
|
|
51768
51766
|
}
|
|
51769
51767
|
/**
|
|
51770
|
-
* Performs a raycast
|
|
51768
|
+
* Performs a raycast starting from the camera's current target position.
|
|
51771
51769
|
*/
|
|
51772
51770
|
raycastForward() {
|
|
51773
|
-
return this.
|
|
51771
|
+
return this.raycastFromWorld(this._camera.target);
|
|
51774
51772
|
}
|
|
51775
51773
|
/**
|
|
51776
|
-
*
|
|
51774
|
+
* Creates and returns a THREE.Raycaster that casts a ray from the camera's position
|
|
51775
|
+
* through the provided normalized screen coordinate (x and y in the range [0, 1]).
|
|
51776
|
+
*
|
|
51777
|
+
* @param {THREE.Vector2} position - The normalized screen position for raycasting.
|
|
51778
|
+
* @param {THREE.Raycaster} target - Optional existing raycaster instance to update.
|
|
51779
|
+
* @returns {THREE.Raycaster} A configured raycaster for performing raycasting.
|
|
51777
51780
|
*/
|
|
51778
51781
|
fromPoint2(position, target = new Raycaster$1()) {
|
|
51779
|
-
const
|
|
51780
|
-
|
|
51781
|
-
|
|
51782
|
-
|
|
51782
|
+
const pos = new Vector2(
|
|
51783
|
+
position.x * 2 - 1,
|
|
51784
|
+
-position.y * 2 + 1
|
|
51785
|
+
);
|
|
51786
|
+
target.setFromCamera(pos, this._camera.three);
|
|
51783
51787
|
return target;
|
|
51784
51788
|
}
|
|
51785
51789
|
/**
|
|
51786
|
-
*
|
|
51787
|
-
*
|
|
51788
|
-
*
|
|
51790
|
+
* Creates and returns a THREE.Raycaster that casts a ray from the camera's position
|
|
51791
|
+
* towards the specified world position.
|
|
51792
|
+
* The ray's direction is computed as the normalized vector from the camera position to the target position.
|
|
51793
|
+
*
|
|
51794
|
+
* @param {THREE.Vector3} position - The world position for raycasting.
|
|
51795
|
+
* @param {THREE.Raycaster} target - Optional existing raycaster instance to update.
|
|
51796
|
+
* @returns {THREE.Raycaster} A configured raycaster for performing raycasting.
|
|
51789
51797
|
*/
|
|
51790
51798
|
fromPoint3(position, target = new Raycaster$1()) {
|
|
51791
51799
|
const direction = position.clone().sub(this._camera.position).normalize();
|
|
@@ -51793,37 +51801,6 @@ void main() {
|
|
|
51793
51801
|
return target;
|
|
51794
51802
|
}
|
|
51795
51803
|
}
|
|
51796
|
-
class InputAction {
|
|
51797
|
-
constructor(type, modifier, position, raycaster) {
|
|
51798
|
-
__publicField(this, "position");
|
|
51799
|
-
__publicField(this, "modifier");
|
|
51800
|
-
__publicField(this, "type");
|
|
51801
|
-
__publicField(this, "_raycaster");
|
|
51802
|
-
__publicField(this, "_raycast");
|
|
51803
|
-
this.type = type;
|
|
51804
|
-
this.modifier = modifier;
|
|
51805
|
-
this.position = position;
|
|
51806
|
-
this._raycaster = raycaster;
|
|
51807
|
-
}
|
|
51808
|
-
/**
|
|
51809
|
-
* A THREE.Raycaster object for custom raycasting.
|
|
51810
|
-
*/
|
|
51811
|
-
get raycaster() {
|
|
51812
|
-
return this._raycaster.fromPoint2(this.position);
|
|
51813
|
-
}
|
|
51814
|
-
/**
|
|
51815
|
-
* Performs raycasting for VIM objects at the current point. This operation can be computationally expensive.
|
|
51816
|
-
*/
|
|
51817
|
-
get raycast() {
|
|
51818
|
-
return this._raycast ?? (this._raycast = this._raycaster.raycast2(this.position));
|
|
51819
|
-
}
|
|
51820
|
-
/**
|
|
51821
|
-
* Returns the object at the current point. This operation can cause a computationally expensive raycast evaluation.
|
|
51822
|
-
*/
|
|
51823
|
-
get object() {
|
|
51824
|
-
return this.raycast.object;
|
|
51825
|
-
}
|
|
51826
|
-
}
|
|
51827
51804
|
class CSS2DObject extends Object3D$1 {
|
|
51828
51805
|
constructor(element = document.createElement("div")) {
|
|
51829
51806
|
super();
|
|
@@ -52921,7 +52898,7 @@ void main() {
|
|
|
52921
52898
|
*/
|
|
52922
52899
|
getClosestHit() {
|
|
52923
52900
|
if (!this.points) return;
|
|
52924
|
-
const hits = this.points.map((p) => this.viewer.raycaster.
|
|
52901
|
+
const hits = this.points.map((p) => this.viewer.raycaster.raycastFromWorld(p)).filter((h) => h.isHit);
|
|
52925
52902
|
let position;
|
|
52926
52903
|
let dist2;
|
|
52927
52904
|
hits.forEach((h) => {
|
|
@@ -53898,7 +53875,7 @@ void main() {
|
|
|
53898
53875
|
this._stage = "ready";
|
|
53899
53876
|
this._previousOnClick = this._viewer.inputs.mouse.onClick;
|
|
53900
53877
|
this._viewer.inputs.mouse.onClick = (pos, ctrl) => {
|
|
53901
|
-
const hit = this._viewer.raycaster.
|
|
53878
|
+
const hit = this._viewer.raycaster.raycastFromScreen(pos);
|
|
53902
53879
|
if (!hit.isHit) return;
|
|
53903
53880
|
switch (this._stage) {
|
|
53904
53881
|
case "ready":
|
|
@@ -54023,10 +54000,8 @@ void main() {
|
|
|
54023
54000
|
__publicField(this, "_raycaster", new Raycaster$1());
|
|
54024
54001
|
/** The box state before the current drag. */
|
|
54025
54002
|
__publicField(this, "_lastBox", new Box3());
|
|
54026
|
-
/** A
|
|
54027
|
-
__publicField(this, "
|
|
54028
|
-
/** The ID of the pointer that is captured, if any. */
|
|
54029
|
-
__publicField(this, "_capturedPointerId");
|
|
54003
|
+
/** A callback to restore the original input listeners after unregistering. */
|
|
54004
|
+
__publicField(this, "_restoreOriginalInputs");
|
|
54030
54005
|
// -------------------------------------------------------------------------
|
|
54031
54006
|
// Callbacks
|
|
54032
54007
|
// -------------------------------------------------------------------------
|
|
@@ -54057,78 +54032,50 @@ void main() {
|
|
|
54057
54032
|
* If already registered, it does nothing.
|
|
54058
54033
|
*/
|
|
54059
54034
|
register() {
|
|
54060
|
-
if (this.
|
|
54061
|
-
const
|
|
54062
|
-
|
|
54063
|
-
|
|
54064
|
-
|
|
54065
|
-
|
|
54035
|
+
if (this._restoreOriginalInputs) return;
|
|
54036
|
+
const mouse = this._viewer.inputs.mouse;
|
|
54037
|
+
const up = mouse.onButtonUp;
|
|
54038
|
+
const down = mouse.onButtonDown;
|
|
54039
|
+
const move = mouse.onMouseMove;
|
|
54040
|
+
const drag = mouse.onDrag;
|
|
54041
|
+
this._restoreOriginalInputs = () => {
|
|
54042
|
+
mouse.onButtonUp = up;
|
|
54043
|
+
mouse.onButtonDown = down;
|
|
54044
|
+
mouse.onMouseMove = move;
|
|
54045
|
+
mouse.onDrag = drag;
|
|
54046
|
+
};
|
|
54047
|
+
mouse.onButtonUp = (pos, btn) => {
|
|
54048
|
+
up(pos, btn);
|
|
54049
|
+
this.onMouseUp(pos);
|
|
54050
|
+
};
|
|
54051
|
+
mouse.onButtonDown = (pos, btn) => {
|
|
54052
|
+
down(pos, btn);
|
|
54053
|
+
this.onMouseDown(pos);
|
|
54054
|
+
};
|
|
54055
|
+
mouse.onMouseMove = (pos) => {
|
|
54056
|
+
move(pos);
|
|
54057
|
+
this.onMouseMove(pos);
|
|
54058
|
+
};
|
|
54059
|
+
mouse.onDrag = (pos, btn) => {
|
|
54060
|
+
if (this._handle) return;
|
|
54061
|
+
drag(pos, btn);
|
|
54062
|
+
};
|
|
54066
54063
|
}
|
|
54067
54064
|
/**
|
|
54068
54065
|
* Unregisters any previously set pointer event listeners, releasing pointer capture
|
|
54069
54066
|
* and resetting drag state.
|
|
54070
54067
|
*/
|
|
54071
54068
|
unregister() {
|
|
54072
|
-
var _a2;
|
|
54069
|
+
var _a2, _b2;
|
|
54073
54070
|
this._mouseDown = false;
|
|
54074
54071
|
(_a2 = this._handle) == null ? void 0 : _a2.highlight(false);
|
|
54075
54072
|
this._handle = void 0;
|
|
54076
|
-
this.
|
|
54077
|
-
this.
|
|
54078
|
-
this._unregisters.forEach((unreg) => unreg());
|
|
54079
|
-
this._unregisters.length = 0;
|
|
54080
|
-
}
|
|
54081
|
-
/**
|
|
54082
|
-
* Indicates if a pointer is currently captured for dragging.
|
|
54083
|
-
*/
|
|
54084
|
-
get pointerCaptured() {
|
|
54085
|
-
return this._capturedPointerId !== void 0;
|
|
54073
|
+
(_b2 = this._restoreOriginalInputs) == null ? void 0 : _b2.call(this);
|
|
54074
|
+
this._restoreOriginalInputs = void 0;
|
|
54086
54075
|
}
|
|
54087
54076
|
// -------------------------------------------------------------------------
|
|
54088
54077
|
// Private Methods
|
|
54089
54078
|
// -------------------------------------------------------------------------
|
|
54090
|
-
/**
|
|
54091
|
-
* A helper method to attach an event listener and store its unregister callback.
|
|
54092
|
-
*
|
|
54093
|
-
* @param handler - The DOM element or Window to attach the listener to.
|
|
54094
|
-
* @param type - The pointer event type, e.g. 'pointerdown'.
|
|
54095
|
-
* @param listener - The event handler function.
|
|
54096
|
-
*/
|
|
54097
|
-
reg(handler, type, listener2) {
|
|
54098
|
-
handler.addEventListener(type, listener2);
|
|
54099
|
-
this._unregisters.push(() => handler.removeEventListener(type, listener2));
|
|
54100
|
-
}
|
|
54101
|
-
/**
|
|
54102
|
-
* Called when the pointer leaves the canvas. If not dragging,
|
|
54103
|
-
* invokes {@link onFaceEnter} to indicate no active handle is hovered.
|
|
54104
|
-
*
|
|
54105
|
-
* @param event - The pointerleave event.
|
|
54106
|
-
*/
|
|
54107
|
-
onPointerLeave(event) {
|
|
54108
|
-
var _a2, _b2;
|
|
54109
|
-
if (!this.pointerCaptured) {
|
|
54110
|
-
(_b2 = this.onFaceEnter) == null ? void 0 : _b2.call(this, ((_a2 = this._handle) == null ? void 0 : _a2.forward) ?? new Vector3());
|
|
54111
|
-
}
|
|
54112
|
-
}
|
|
54113
|
-
/**
|
|
54114
|
-
* Sets pointer capture on the canvas for a specific pointer (ID).
|
|
54115
|
-
*
|
|
54116
|
-
* @param pointerId - The pointer ID to capture.
|
|
54117
|
-
*/
|
|
54118
|
-
capturePointer(pointerId) {
|
|
54119
|
-
this.releasePointer();
|
|
54120
|
-
this._viewer.viewport.canvas.setPointerCapture(pointerId);
|
|
54121
|
-
this._capturedPointerId = pointerId;
|
|
54122
|
-
}
|
|
54123
|
-
/**
|
|
54124
|
-
* Releases any captured pointer on the canvas, if present.
|
|
54125
|
-
*/
|
|
54126
|
-
releasePointer() {
|
|
54127
|
-
if (this.pointerCaptured) {
|
|
54128
|
-
this._viewer.viewport.canvas.releasePointerCapture(this._capturedPointerId);
|
|
54129
|
-
this._capturedPointerId = void 0;
|
|
54130
|
-
}
|
|
54131
|
-
}
|
|
54132
54079
|
/**
|
|
54133
54080
|
* Handles pointer movement events.
|
|
54134
54081
|
* - If dragging, calls {@link onDrag}.
|
|
@@ -54136,19 +54083,19 @@ void main() {
|
|
|
54136
54083
|
*
|
|
54137
54084
|
* @param event - The pointermove event.
|
|
54138
54085
|
*/
|
|
54139
|
-
onMouseMove(
|
|
54140
|
-
var _a2, _b2, _c, _d;
|
|
54086
|
+
onMouseMove(position) {
|
|
54087
|
+
var _a2, _b2, _c, _d, _e;
|
|
54141
54088
|
if (this._mouseDown) {
|
|
54142
|
-
this.onDrag(
|
|
54089
|
+
this.onDrag(position);
|
|
54143
54090
|
return;
|
|
54144
54091
|
}
|
|
54145
|
-
const hits = this.raycast(
|
|
54146
|
-
const handle = (_b2 = (_a2 = hits == null ? void 0 : hits[0]) == null ? void 0 : _a2.object) == null ? void 0 : _b2.userData.handle;
|
|
54092
|
+
const hits = this.raycast(position);
|
|
54093
|
+
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;
|
|
54147
54094
|
if (handle !== this._handle) {
|
|
54148
|
-
(
|
|
54095
|
+
(_d = this._handle) == null ? void 0 : _d.highlight(false);
|
|
54149
54096
|
handle == null ? void 0 : handle.highlight(true);
|
|
54150
54097
|
this._handle = handle;
|
|
54151
|
-
(
|
|
54098
|
+
(_e = this.onFaceEnter) == null ? void 0 : _e.call(this, (handle == null ? void 0 : handle.forward) ?? new Vector3());
|
|
54152
54099
|
}
|
|
54153
54100
|
}
|
|
54154
54101
|
/**
|
|
@@ -54156,39 +54103,29 @@ void main() {
|
|
|
54156
54103
|
*
|
|
54157
54104
|
* @param event - The pointerup event.
|
|
54158
54105
|
*/
|
|
54159
|
-
onMouseUp(
|
|
54160
|
-
var _a2
|
|
54161
|
-
this.
|
|
54162
|
-
|
|
54163
|
-
|
|
54164
|
-
|
|
54165
|
-
if (event.pointerType === "mouse") {
|
|
54166
|
-
this.onMouseMove(event);
|
|
54167
|
-
} else {
|
|
54168
|
-
this._handle = void 0;
|
|
54169
|
-
(_a2 = this.onFaceEnter) == null ? void 0 : _a2.call(this, new Vector3());
|
|
54170
|
-
}
|
|
54171
|
-
(_b2 = this.onBoxConfirm) == null ? void 0 : _b2.call(this, this._sharedBox);
|
|
54172
|
-
}
|
|
54106
|
+
onMouseUp(position) {
|
|
54107
|
+
var _a2;
|
|
54108
|
+
if (!this._mouseDown) return;
|
|
54109
|
+
this._mouseDown = false;
|
|
54110
|
+
this.onMouseMove(position);
|
|
54111
|
+
(_a2 = this.onBoxConfirm) == null ? void 0 : _a2.call(this, this._sharedBox);
|
|
54173
54112
|
}
|
|
54174
54113
|
/**
|
|
54175
54114
|
* Handles pointer down events. Begins drag if a handle is hit, capturing the pointer.
|
|
54176
54115
|
*
|
|
54177
54116
|
* @param event - The pointerdown event.
|
|
54178
54117
|
*/
|
|
54179
|
-
onMouseDown(
|
|
54118
|
+
onMouseDown(position) {
|
|
54180
54119
|
var _a2, _b2, _c, _d;
|
|
54181
|
-
const hits = this.raycast(
|
|
54120
|
+
const hits = this.raycast(position);
|
|
54182
54121
|
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;
|
|
54183
54122
|
if (!handle) return;
|
|
54184
54123
|
this._handle = handle;
|
|
54185
|
-
this.capturePointer(event.pointerId);
|
|
54186
54124
|
this._lastBox.copy(this._sharedBox);
|
|
54187
54125
|
this._dragOrigin.copy(handle.position);
|
|
54188
54126
|
const dist2 = handle.position.clone().dot(this._viewer.camera.forward);
|
|
54189
54127
|
this._dragPlane.set(this._viewer.camera.forward, -dist2);
|
|
54190
54128
|
this._mouseDown = true;
|
|
54191
|
-
this._viewer.inputs.unregisterAll();
|
|
54192
54129
|
(_d = this.onFaceEnter) == null ? void 0 : _d.call(this, this._handle.forward.clone());
|
|
54193
54130
|
}
|
|
54194
54131
|
/**
|
|
@@ -54197,10 +54134,10 @@ void main() {
|
|
|
54197
54134
|
*
|
|
54198
54135
|
* @param event - The pointermove event while dragging.
|
|
54199
54136
|
*/
|
|
54200
|
-
onDrag(
|
|
54137
|
+
onDrag(position) {
|
|
54201
54138
|
var _a2;
|
|
54202
54139
|
if (!this._handle) return;
|
|
54203
|
-
const point = this.raycastPlane(
|
|
54140
|
+
const point = this.raycastPlane(position) ?? this._dragOrigin.clone();
|
|
54204
54141
|
const delta = point.sub(this._dragOrigin);
|
|
54205
54142
|
const amount = delta.dot(this._handle.forward);
|
|
54206
54143
|
const box = this.stretch(this._handle.axis, this._handle.sign, amount);
|
|
@@ -57081,7 +57018,7 @@ void main() {
|
|
|
57081
57018
|
rot.multiplyScalar(180 * speed);
|
|
57082
57019
|
return rot;
|
|
57083
57020
|
}
|
|
57084
|
-
function
|
|
57021
|
+
function webglInputHandler(viewer) {
|
|
57085
57022
|
return new CoreInputHandler(
|
|
57086
57023
|
viewer.viewport.canvas,
|
|
57087
57024
|
createAdapter$1(viewer),
|
|
@@ -57121,7 +57058,7 @@ void main() {
|
|
|
57121
57058
|
}
|
|
57122
57059
|
},
|
|
57123
57060
|
selectAtPointer: (pos, add) => {
|
|
57124
|
-
const pointer = viewer.raycaster.
|
|
57061
|
+
const pointer = viewer.raycaster.raycastFromScreen(pos);
|
|
57125
57062
|
if (add) {
|
|
57126
57063
|
viewer.selection.add(pointer.object);
|
|
57127
57064
|
} else {
|
|
@@ -57129,7 +57066,7 @@ void main() {
|
|
|
57129
57066
|
}
|
|
57130
57067
|
},
|
|
57131
57068
|
frameAtPointer: (pos) => {
|
|
57132
|
-
const pointer = viewer.raycaster.
|
|
57069
|
+
const pointer = viewer.raycaster.raycastFromScreen(pos);
|
|
57133
57070
|
viewer.camera.lerp(0.75).frame(pointer.object);
|
|
57134
57071
|
},
|
|
57135
57072
|
zoom: (value) => {
|
|
@@ -57208,13 +57145,12 @@ void main() {
|
|
|
57208
57145
|
this._camera,
|
|
57209
57146
|
this.settings
|
|
57210
57147
|
);
|
|
57211
|
-
this.inputs =
|
|
57148
|
+
this.inputs = webglInputHandler(this);
|
|
57212
57149
|
this.gizmos = new Gizmos(this, this._camera);
|
|
57213
57150
|
this.materials.applySettings(this.settings);
|
|
57214
57151
|
this.environment = new Environment(this.camera, this.renderer, this.materials, this.settings);
|
|
57215
57152
|
this.selection = new Selection(this.materials);
|
|
57216
57153
|
this.raycaster = new Raycaster(
|
|
57217
|
-
this.viewport,
|
|
57218
57154
|
this._camera,
|
|
57219
57155
|
scene,
|
|
57220
57156
|
this.renderer
|
|
@@ -57500,7 +57436,6 @@ void main() {
|
|
|
57500
57436
|
},
|
|
57501
57437
|
HitTestResult: RaycastResult,
|
|
57502
57438
|
IProgressLogs: distExports$2.IProgressLogs,
|
|
57503
|
-
InputAction,
|
|
57504
57439
|
InsertableMesh,
|
|
57505
57440
|
Object3D,
|
|
57506
57441
|
Scene,
|
|
@@ -61031,7 +60966,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61031
60966
|
const defaultRenderSettings = {
|
|
61032
60967
|
...defaultSceneSettings,
|
|
61033
60968
|
lockIblRotation: true,
|
|
61034
|
-
ghostColor: new RGBA(
|
|
60969
|
+
ghostColor: new RGBA(14 / 255, 14 / 255, 14 / 255, 1 / 255)
|
|
61035
60970
|
};
|
|
61036
60971
|
class Renderer {
|
|
61037
60972
|
/**
|
|
@@ -61382,16 +61317,13 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61382
61317
|
viewer.rpc.RPCSetMoveSpeed(10);
|
|
61383
61318
|
},
|
|
61384
61319
|
orbitCamera: (value) => {
|
|
61385
|
-
console.log("orbitCamera");
|
|
61386
61320
|
},
|
|
61387
61321
|
rotateCamera: (value) => {
|
|
61388
|
-
console.log("rotateCamera");
|
|
61389
61322
|
},
|
|
61390
61323
|
panCamera: (value) => {
|
|
61391
|
-
console.log("panCamera");
|
|
61392
61324
|
},
|
|
61393
61325
|
toggleOrthographic: () => {
|
|
61394
|
-
console.log("toggleOrthographic");
|
|
61326
|
+
console.log("toggleOrthographic. Not supported yet");
|
|
61395
61327
|
},
|
|
61396
61328
|
resetCamera: () => {
|
|
61397
61329
|
viewer.camera.restoreSavedPosition();
|
|
@@ -61403,9 +61335,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61403
61335
|
frameContext(viewer);
|
|
61404
61336
|
},
|
|
61405
61337
|
selectAtPointer: async (pos, add) => {
|
|
61406
|
-
console.log("selectAtPointer", pos, add);
|
|
61407
61338
|
const hit = await viewer.selection.hitTest(pos);
|
|
61408
|
-
console.log("hit", hit);
|
|
61409
61339
|
if (!hit) {
|
|
61410
61340
|
viewer.selection.clear();
|
|
61411
61341
|
return;
|
|
@@ -61428,7 +61358,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61428
61358
|
viewer.rpc.RPCMouseScrollEvent(value >= 1 ? 1 : -1);
|
|
61429
61359
|
},
|
|
61430
61360
|
moveCamera: (value) => {
|
|
61431
|
-
console.log("moveCamera");
|
|
61432
61361
|
},
|
|
61433
61362
|
keyDown: (code) => {
|
|
61434
61363
|
const key = CODE_TO_KEYCODE[code];
|
|
@@ -66453,6 +66382,55 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
66453
66382
|
}
|
|
66454
66383
|
);
|
|
66455
66384
|
}
|
|
66385
|
+
function frameScene({ height, width, fill: fill2, className }) {
|
|
66386
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
66387
|
+
"svg",
|
|
66388
|
+
{
|
|
66389
|
+
className,
|
|
66390
|
+
height,
|
|
66391
|
+
width,
|
|
66392
|
+
viewBox: "0 0 256 256",
|
|
66393
|
+
children: [
|
|
66394
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
|
|
66395
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66396
|
+
"path",
|
|
66397
|
+
{
|
|
66398
|
+
fill: fill2,
|
|
66399
|
+
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"
|
|
66400
|
+
}
|
|
66401
|
+
),
|
|
66402
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66403
|
+
"path",
|
|
66404
|
+
{
|
|
66405
|
+
fill: fill2,
|
|
66406
|
+
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"
|
|
66407
|
+
}
|
|
66408
|
+
),
|
|
66409
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66410
|
+
"path",
|
|
66411
|
+
{
|
|
66412
|
+
fill: fill2,
|
|
66413
|
+
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"
|
|
66414
|
+
}
|
|
66415
|
+
),
|
|
66416
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66417
|
+
"path",
|
|
66418
|
+
{
|
|
66419
|
+
fill: fill2,
|
|
66420
|
+
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"
|
|
66421
|
+
}
|
|
66422
|
+
),
|
|
66423
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66424
|
+
"path",
|
|
66425
|
+
{
|
|
66426
|
+
fill: fill2,
|
|
66427
|
+
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"
|
|
66428
|
+
}
|
|
66429
|
+
)
|
|
66430
|
+
]
|
|
66431
|
+
}
|
|
66432
|
+
);
|
|
66433
|
+
}
|
|
66456
66434
|
function autoCamera({ height, width, fill: fill2 = "", className }) {
|
|
66457
66435
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
|
|
66458
66436
|
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
|
|
@@ -67001,6 +66979,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67001
66979
|
close,
|
|
67002
66980
|
collapse,
|
|
67003
66981
|
frameRect,
|
|
66982
|
+
frameScene,
|
|
67004
66983
|
frameSelection,
|
|
67005
66984
|
fullArrowLeft,
|
|
67006
66985
|
fullsScreen,
|
|
@@ -67046,7 +67025,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67046
67025
|
return settings2.ui.orthographic || settings2.ui.resetCamera || settings2.ui.enableGhost;
|
|
67047
67026
|
}
|
|
67048
67027
|
function anyUiCursorButton(settings2) {
|
|
67049
|
-
return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow)
|
|
67028
|
+
return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow);
|
|
67050
67029
|
}
|
|
67051
67030
|
function anyUiSettingButton(settings2) {
|
|
67052
67031
|
return isTrue(settings2.ui.projectInspector) || isTrue(settings2.ui.settings) || isTrue(settings2.ui.help) || isTrue(settings2.ui.maximise);
|
|
@@ -67084,7 +67063,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67084
67063
|
pan: true,
|
|
67085
67064
|
zoom: true,
|
|
67086
67065
|
zoomWindow: true,
|
|
67087
|
-
|
|
67066
|
+
// Control bar - camera
|
|
67067
|
+
autoCamera: true,
|
|
67068
|
+
frameScene: true,
|
|
67069
|
+
frameSelection: true,
|
|
67088
67070
|
// Control bar - tools
|
|
67089
67071
|
sectioningMode: true,
|
|
67090
67072
|
measuringMode: true,
|
|
@@ -67243,7 +67225,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67243
67225
|
sectionMeasure: "controlBar.sectionMeasure",
|
|
67244
67226
|
sectionSectionBox: "controlBar.sectionSectionBox",
|
|
67245
67227
|
// Camera buttons
|
|
67228
|
+
buttonCameraFrameSelection: "controlBar.camera.frameSelection",
|
|
67229
|
+
buttonCameraFrameScene: "controlBar.camera.frameScene",
|
|
67246
67230
|
buttonCameraAuto: "controlBar.camera.auto",
|
|
67231
|
+
// Camera Control buttons
|
|
67247
67232
|
buttonCameraOrbit: "controlBar.camera.orbit",
|
|
67248
67233
|
buttonCameraLook: "controlBarcamera.look",
|
|
67249
67234
|
buttonCameraPan: "controlBar.camera.pan",
|
|
@@ -67256,16 +67241,15 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67256
67241
|
buttonMaximize: "controlBar.maximize",
|
|
67257
67242
|
// Action Buttons
|
|
67258
67243
|
buttonToggleIsolation: "controlBar.action.toggleIsolation",
|
|
67259
|
-
buttonZoomToFit: "controlBar.action.zoomToFit",
|
|
67260
67244
|
// Tools buttons
|
|
67261
67245
|
buttonSectionBox: "controlBar.sectionBox",
|
|
67262
67246
|
buttonMeasure: "controlBar.measure",
|
|
67263
67247
|
// Section box buttons
|
|
67264
67248
|
buttonSectionBoxEnable: "controlBar.sectionBox.enable",
|
|
67265
67249
|
buttonSectionBoxVisible: "controlBar.sectionBox.visible",
|
|
67266
|
-
|
|
67250
|
+
buttonSectionBoxToSelection: "controlBar.sectionBox.sectionSelection",
|
|
67251
|
+
buttonSectionBoxToScene: "controlBar.sectionBox.sectionScene",
|
|
67267
67252
|
buttonSectionBoxAuto: "controlBar.sectionBox.auto",
|
|
67268
|
-
buttonSectionBoxReset: "controlBar.sectionBox.reset",
|
|
67269
67253
|
buttonSectionBoxSettings: "controlBar.sectionBox.settings"
|
|
67270
67254
|
};
|
|
67271
67255
|
function ControlBar(props) {
|
|
@@ -67498,7 +67482,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67498
67482
|
icon: sectionBox
|
|
67499
67483
|
},
|
|
67500
67484
|
{
|
|
67501
|
-
id: ids.
|
|
67485
|
+
id: ids.buttonSectionBoxToSelection,
|
|
67502
67486
|
tip: "Fit Section",
|
|
67503
67487
|
enabled: () => section.enable.get(),
|
|
67504
67488
|
isOn: () => hasSelection,
|
|
@@ -67507,11 +67491,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67507
67491
|
icon: sectionBoxShrink
|
|
67508
67492
|
},
|
|
67509
67493
|
{
|
|
67510
|
-
id: ids.
|
|
67494
|
+
id: ids.buttonSectionBoxToScene,
|
|
67511
67495
|
tip: "Reset Section",
|
|
67512
67496
|
enabled: () => section.enable.get(),
|
|
67513
67497
|
style: (on) => buttonDefaultStyle(on),
|
|
67514
|
-
action: () => section.
|
|
67498
|
+
action: () => section.sectionScene.call(),
|
|
67515
67499
|
icon: sectionBoxReset
|
|
67516
67500
|
},
|
|
67517
67501
|
{
|
|
@@ -67607,15 +67591,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67607
67591
|
enable: () => true,
|
|
67608
67592
|
style: sectionDefaultStyle,
|
|
67609
67593
|
buttons: [
|
|
67610
|
-
{
|
|
67611
|
-
id: ids.buttonZoomToFit,
|
|
67612
|
-
enabled: () => isTrue(settings2.ui.zoomToFit),
|
|
67613
|
-
tip: "Frame Camera",
|
|
67614
|
-
action: () => camera2.frameSelection.call(),
|
|
67615
|
-
icon: frameSelection,
|
|
67616
|
-
isOn: () => false,
|
|
67617
|
-
style: buttonDefaultStyle
|
|
67618
|
-
},
|
|
67619
67594
|
{
|
|
67620
67595
|
id: ids.buttonToggleIsolation,
|
|
67621
67596
|
enabled: () => isTrue(settings2.ui.toggleIsolation),
|
|
@@ -67691,6 +67666,24 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
67691
67666
|
action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
|
|
67692
67667
|
icon: autoCamera,
|
|
67693
67668
|
style: buttonDefaultStyle
|
|
67669
|
+
},
|
|
67670
|
+
{
|
|
67671
|
+
id: ids.buttonCameraFrameSelection,
|
|
67672
|
+
// enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
|
|
67673
|
+
tip: "Frame Selection",
|
|
67674
|
+
action: () => camera2.frameSelection.call(),
|
|
67675
|
+
icon: frameSelection,
|
|
67676
|
+
isOn: () => false,
|
|
67677
|
+
style: buttonDefaultStyle
|
|
67678
|
+
},
|
|
67679
|
+
{
|
|
67680
|
+
id: ids.buttonCameraFrameScene,
|
|
67681
|
+
// enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
|
|
67682
|
+
tip: "Frame All",
|
|
67683
|
+
action: () => camera2.frameScene.call(),
|
|
67684
|
+
icon: frameScene,
|
|
67685
|
+
isOn: () => false,
|
|
67686
|
+
style: buttonDefaultStyle
|
|
67694
67687
|
}
|
|
67695
67688
|
]
|
|
67696
67689
|
};
|
|
@@ -74110,9 +74103,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
74110
74103
|
(settings2, value) => settings2.ui.zoomWindow = value
|
|
74111
74104
|
),
|
|
74112
74105
|
settingsToggle(
|
|
74113
|
-
"Show Zoom
|
|
74114
|
-
(settings2) => settings2.ui.
|
|
74115
|
-
(settings2, value) => settings2.ui.
|
|
74106
|
+
"Show Zoom Frame Selection Button",
|
|
74107
|
+
(settings2) => settings2.ui.frameSelection,
|
|
74108
|
+
(settings2, value) => settings2.ui.frameSelection = value
|
|
74116
74109
|
),
|
|
74117
74110
|
settingsSubtitle("Control Bar - Tools"),
|
|
74118
74111
|
settingsToggle(
|
|
@@ -75312,26 +75305,50 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75312
75305
|
event.current.dispatch(finalValue);
|
|
75313
75306
|
};
|
|
75314
75307
|
return {
|
|
75308
|
+
/**
|
|
75309
|
+
* Returns the current state value.
|
|
75310
|
+
*/
|
|
75315
75311
|
get() {
|
|
75316
75312
|
return ref.current;
|
|
75317
75313
|
},
|
|
75318
75314
|
set: set2,
|
|
75315
|
+
/**
|
|
75316
|
+
* Confirms the current state by applying the confirm function and updating the state.
|
|
75317
|
+
*/
|
|
75319
75318
|
confirm() {
|
|
75320
75319
|
set2(confirm.current(ref.current));
|
|
75321
75320
|
},
|
|
75321
|
+
/**
|
|
75322
|
+
* Registers a callback to be invoked when the state changes.
|
|
75323
|
+
* @param on - The callback function that receives the new state value.
|
|
75324
|
+
*/
|
|
75322
75325
|
useOnChange(on) {
|
|
75323
75326
|
React2.useEffect(() => {
|
|
75324
75327
|
return event.current.subscribe(on);
|
|
75325
75328
|
}, []);
|
|
75326
75329
|
},
|
|
75330
|
+
/**
|
|
75331
|
+
* Memoizes a value based on the current state and additional dependencies.
|
|
75332
|
+
* @param on - A function that computes a value based on the current state.
|
|
75333
|
+
* @param deps - Optional additional dependencies.
|
|
75334
|
+
* @returns The memoized value.
|
|
75335
|
+
*/
|
|
75327
75336
|
useMemo(on, deps) {
|
|
75328
75337
|
return React2.useMemo(() => on(value), [...deps || [], value]);
|
|
75329
75338
|
},
|
|
75339
|
+
/**
|
|
75340
|
+
* Sets a validation function to process any new state value before updating.
|
|
75341
|
+
* @param on - A function that validates (and optionally transforms) the new state value.
|
|
75342
|
+
*/
|
|
75330
75343
|
useValidate(on) {
|
|
75331
75344
|
React2.useEffect(() => {
|
|
75332
75345
|
validate.current = on;
|
|
75333
75346
|
}, []);
|
|
75334
75347
|
},
|
|
75348
|
+
/**
|
|
75349
|
+
* Sets a confirmation function to process the state value during confirmation.
|
|
75350
|
+
* @param on - A function that confirms (and optionally transforms) the current state value.
|
|
75351
|
+
*/
|
|
75335
75352
|
useConfirm(on) {
|
|
75336
75353
|
React2.useEffect(() => {
|
|
75337
75354
|
confirm.current = on;
|
|
@@ -75348,8 +75365,22 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75348
75365
|
get() {
|
|
75349
75366
|
return ref.current;
|
|
75350
75367
|
},
|
|
75351
|
-
set(
|
|
75352
|
-
ref.current =
|
|
75368
|
+
set(fn) {
|
|
75369
|
+
ref.current = fn;
|
|
75370
|
+
},
|
|
75371
|
+
prepend(fn) {
|
|
75372
|
+
const oldFn = ref.current;
|
|
75373
|
+
ref.current = () => {
|
|
75374
|
+
fn();
|
|
75375
|
+
oldFn();
|
|
75376
|
+
};
|
|
75377
|
+
},
|
|
75378
|
+
append(fn) {
|
|
75379
|
+
const oldFn = ref.current;
|
|
75380
|
+
ref.current = () => {
|
|
75381
|
+
oldFn();
|
|
75382
|
+
fn();
|
|
75383
|
+
};
|
|
75353
75384
|
}
|
|
75354
75385
|
};
|
|
75355
75386
|
}
|
|
@@ -75359,30 +75390,83 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75359
75390
|
call(arg) {
|
|
75360
75391
|
ref == null ? void 0 : ref.current(arg);
|
|
75361
75392
|
},
|
|
75362
|
-
|
|
75363
|
-
ref.current
|
|
75393
|
+
get() {
|
|
75394
|
+
return ref.current;
|
|
75395
|
+
},
|
|
75396
|
+
set(fn) {
|
|
75397
|
+
ref.current = fn;
|
|
75398
|
+
},
|
|
75399
|
+
prepend(fn) {
|
|
75400
|
+
const oldFn = ref.current;
|
|
75401
|
+
ref.current = (arg) => {
|
|
75402
|
+
fn(arg);
|
|
75403
|
+
oldFn(arg);
|
|
75404
|
+
};
|
|
75405
|
+
},
|
|
75406
|
+
append(fn) {
|
|
75407
|
+
const oldFn = ref.current;
|
|
75408
|
+
ref.current = (arg) => {
|
|
75409
|
+
oldFn(arg);
|
|
75410
|
+
fn(arg);
|
|
75411
|
+
};
|
|
75364
75412
|
}
|
|
75365
75413
|
};
|
|
75366
75414
|
}
|
|
75367
|
-
function useFuncRef(
|
|
75368
|
-
const ref = React2.useRef(
|
|
75415
|
+
function useFuncRef(fn) {
|
|
75416
|
+
const ref = React2.useRef(fn);
|
|
75369
75417
|
return {
|
|
75370
75418
|
call() {
|
|
75371
75419
|
return ref == null ? void 0 : ref.current();
|
|
75372
75420
|
},
|
|
75373
|
-
|
|
75374
|
-
ref.current
|
|
75421
|
+
get() {
|
|
75422
|
+
return ref.current;
|
|
75423
|
+
},
|
|
75424
|
+
set(fn2) {
|
|
75425
|
+
ref.current = fn2;
|
|
75426
|
+
},
|
|
75427
|
+
prepend(fn2) {
|
|
75428
|
+
const oldFn = ref.current;
|
|
75429
|
+
ref.current = () => {
|
|
75430
|
+
fn2();
|
|
75431
|
+
return oldFn();
|
|
75432
|
+
};
|
|
75433
|
+
},
|
|
75434
|
+
append(fn2) {
|
|
75435
|
+
const oldFn = ref.current;
|
|
75436
|
+
ref.current = () => {
|
|
75437
|
+
const result = oldFn();
|
|
75438
|
+
fn2();
|
|
75439
|
+
return result;
|
|
75440
|
+
};
|
|
75375
75441
|
}
|
|
75376
75442
|
};
|
|
75377
75443
|
}
|
|
75378
|
-
function useAsyncFuncRef(
|
|
75379
|
-
const ref = React2.useRef(
|
|
75444
|
+
function useAsyncFuncRef(fn) {
|
|
75445
|
+
const ref = React2.useRef(fn);
|
|
75380
75446
|
return {
|
|
75381
75447
|
async call() {
|
|
75382
75448
|
return ref == null ? void 0 : ref.current();
|
|
75383
75449
|
},
|
|
75384
|
-
|
|
75385
|
-
ref.current
|
|
75450
|
+
get() {
|
|
75451
|
+
return ref.current;
|
|
75452
|
+
},
|
|
75453
|
+
set(fn2) {
|
|
75454
|
+
ref.current = fn2;
|
|
75455
|
+
},
|
|
75456
|
+
prepend(fn2) {
|
|
75457
|
+
const oldFn = ref.current;
|
|
75458
|
+
ref.current = async () => {
|
|
75459
|
+
await fn2();
|
|
75460
|
+
return await oldFn();
|
|
75461
|
+
};
|
|
75462
|
+
},
|
|
75463
|
+
append(fn2) {
|
|
75464
|
+
const oldFn = ref.current;
|
|
75465
|
+
ref.current = async () => {
|
|
75466
|
+
const result = await oldFn();
|
|
75467
|
+
await fn2();
|
|
75468
|
+
return result;
|
|
75469
|
+
};
|
|
75386
75470
|
}
|
|
75387
75471
|
};
|
|
75388
75472
|
}
|
|
@@ -75449,9 +75533,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75449
75533
|
sideOffset,
|
|
75450
75534
|
bottomOffset,
|
|
75451
75535
|
sectionSelection,
|
|
75452
|
-
|
|
75536
|
+
sectionScene,
|
|
75453
75537
|
sectionBox: sectionBox2,
|
|
75454
75538
|
getBox: () => adapter.getBox(),
|
|
75539
|
+
// TODO - Remove these from here, it should be overriden at the component level.
|
|
75455
75540
|
getSceneBox,
|
|
75456
75541
|
getSelectionBox
|
|
75457
75542
|
};
|
|
@@ -75493,7 +75578,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75493
75578
|
};
|
|
75494
75579
|
return useSectionBox(vimAdapter);
|
|
75495
75580
|
}
|
|
75496
|
-
function useCamera(adapter) {
|
|
75581
|
+
function useCamera(adapter, section) {
|
|
75497
75582
|
const autoCamera2 = useStateRef(false);
|
|
75498
75583
|
autoCamera2.useOnChange((v) => {
|
|
75499
75584
|
if (v) {
|
|
@@ -75501,22 +75586,25 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75501
75586
|
}
|
|
75502
75587
|
});
|
|
75503
75588
|
React2.useEffect(() => {
|
|
75504
|
-
|
|
75589
|
+
const refresh = () => {
|
|
75505
75590
|
if (autoCamera2.get()) {
|
|
75506
75591
|
frameSelection2.call();
|
|
75507
75592
|
}
|
|
75508
|
-
}
|
|
75593
|
+
};
|
|
75594
|
+
section.sectionSelection.append(refresh);
|
|
75595
|
+
section.sectionScene.append(refresh);
|
|
75596
|
+
adapter.onSelectionChanged.sub(refresh);
|
|
75509
75597
|
}, []);
|
|
75510
75598
|
const reset = useActionRef(() => adapter.resetCamera(1));
|
|
75511
75599
|
const getSelectionBox = useAsyncFuncRef(adapter.getSelectionBox);
|
|
75512
75600
|
const getSceneBox = useAsyncFuncRef(adapter.getSceneBox);
|
|
75513
75601
|
const frameSelection2 = useAsyncFuncRef(async () => {
|
|
75514
75602
|
const box = await getSelectionBox.call() ?? await getSceneBox.call();
|
|
75515
|
-
frame(adapter, box);
|
|
75603
|
+
frame(adapter, section, box);
|
|
75516
75604
|
});
|
|
75517
|
-
const
|
|
75605
|
+
const frameScene2 = useAsyncFuncRef(async () => {
|
|
75518
75606
|
const box = await getSceneBox.call();
|
|
75519
|
-
frame(adapter, box);
|
|
75607
|
+
frame(adapter, section, box);
|
|
75520
75608
|
});
|
|
75521
75609
|
return {
|
|
75522
75610
|
getSelectionBox,
|
|
@@ -75524,17 +75612,18 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75524
75612
|
autoCamera: autoCamera2,
|
|
75525
75613
|
reset,
|
|
75526
75614
|
frameSelection: frameSelection2,
|
|
75527
|
-
frameScene
|
|
75615
|
+
frameScene: frameScene2
|
|
75528
75616
|
};
|
|
75529
75617
|
}
|
|
75530
|
-
function frame(adapter, box) {
|
|
75531
|
-
if (
|
|
75532
|
-
|
|
75618
|
+
function frame(adapter, section, box) {
|
|
75619
|
+
if (!box) return;
|
|
75620
|
+
if (section.enable.get()) {
|
|
75621
|
+
const sectionBox2 = section.getBox();
|
|
75533
75622
|
if (section) {
|
|
75534
|
-
box.intersect(
|
|
75623
|
+
box.intersect(sectionBox2);
|
|
75535
75624
|
}
|
|
75536
75625
|
if (box.isEmpty()) {
|
|
75537
|
-
box.copy(
|
|
75626
|
+
box.copy(sectionBox2);
|
|
75538
75627
|
}
|
|
75539
75628
|
}
|
|
75540
75629
|
adapter.frameCamera(box, 1);
|
|
@@ -75545,10 +75634,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75545
75634
|
frameCamera: (box, duration) => viewer.camera.lerp(duration).frame(box),
|
|
75546
75635
|
resetCamera: (duration) => viewer.camera.lerp(duration).reset(),
|
|
75547
75636
|
getSelectionBox: () => Promise.resolve(viewer.selection.getBoundingBox()),
|
|
75548
|
-
|
|
75549
|
-
|
|
75550
|
-
isSectionBoxEnabled: () => section.enable.get()
|
|
75551
|
-
});
|
|
75637
|
+
getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox())
|
|
75638
|
+
}, section);
|
|
75552
75639
|
}
|
|
75553
75640
|
function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
|
|
75554
75641
|
const promise2 = new DeferredPromise();
|
|
@@ -76051,39 +76138,18 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
76051
76138
|
function useUltraControlBar(viewer, section, camera2, customization) {
|
|
76052
76139
|
const sectionSectionBox = controlBarSectionBox(section, viewer.selection.count > 0);
|
|
76053
76140
|
const sectionCamera = controlBarCamera(camera2);
|
|
76054
|
-
|
|
76055
|
-
let bar = [sectionCamera, frame2, sectionSectionBox];
|
|
76141
|
+
let bar = [sectionCamera, sectionSectionBox];
|
|
76056
76142
|
bar = (customization == null ? void 0 : customization(bar)) ?? bar;
|
|
76057
76143
|
return bar;
|
|
76058
76144
|
}
|
|
76059
|
-
function frameSection(camera2) {
|
|
76060
|
-
return {
|
|
76061
|
-
id: ids.sectionActions,
|
|
76062
|
-
enable: () => true,
|
|
76063
|
-
style: sectionDefaultStyle,
|
|
76064
|
-
buttons: [
|
|
76065
|
-
{
|
|
76066
|
-
id: ids.buttonZoomToFit,
|
|
76067
|
-
enabled: () => true,
|
|
76068
|
-
tip: "Frame Camera",
|
|
76069
|
-
action: () => camera2.frameSelection.call(),
|
|
76070
|
-
icon: frameSelection,
|
|
76071
|
-
isOn: () => false,
|
|
76072
|
-
style: buttonDefaultStyle
|
|
76073
|
-
}
|
|
76074
|
-
]
|
|
76075
|
-
};
|
|
76076
|
-
}
|
|
76077
76145
|
function useUltraCamera(viewer, section) {
|
|
76078
76146
|
return useCamera({
|
|
76079
76147
|
onSelectionChanged: viewer.selection.onValueChanged,
|
|
76080
76148
|
frameCamera: (box, duration) => void viewer.camera.frameBox(box, duration),
|
|
76081
76149
|
resetCamera: (duration) => viewer.camera.restoreSavedPosition(duration),
|
|
76082
76150
|
getSelectionBox: () => viewer.selection.getBoundingBox(),
|
|
76083
|
-
getSceneBox: () => viewer.renderer.getBoundingBox()
|
|
76084
|
-
|
|
76085
|
-
isSectionBoxEnabled: () => section.enable.get()
|
|
76086
|
-
});
|
|
76151
|
+
getSceneBox: () => viewer.renderer.getBoundingBox()
|
|
76152
|
+
}, section);
|
|
76087
76153
|
}
|
|
76088
76154
|
function createUltraComponent(container) {
|
|
76089
76155
|
const promise2 = new DeferredPromise();
|