vim-web 0.5.0-dev.11 → 0.5.0-dev.13
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/vim-web.js
CHANGED
|
@@ -52740,13 +52740,20 @@ class DoubleClickHandler {
|
|
|
52740
52740
|
constructor() {
|
|
52741
52741
|
__publicField(this, "_lastClickTime", 0);
|
|
52742
52742
|
__publicField(this, "_clickDelay", 300);
|
|
52743
|
+
// Max time between clicks for double-click
|
|
52744
|
+
__publicField(this, "_lastClickPosition", null);
|
|
52745
|
+
__publicField(this, "_positionThreshold", 5);
|
|
52743
52746
|
}
|
|
52744
|
-
//
|
|
52747
|
+
// Max pixel distance between clicks
|
|
52745
52748
|
checkForDoubleClick(event) {
|
|
52746
52749
|
const currentTime = Date.now();
|
|
52750
|
+
const currentPosition = new Vector2(event.clientX, event.clientY);
|
|
52747
52751
|
const timeDiff = currentTime - this._lastClickTime;
|
|
52752
|
+
const isClose = this._lastClickPosition !== null && this._lastClickPosition.distanceTo(currentPosition) < this._positionThreshold;
|
|
52753
|
+
const isWithinTime = timeDiff < this._clickDelay;
|
|
52748
52754
|
this._lastClickTime = currentTime;
|
|
52749
|
-
|
|
52755
|
+
this._lastClickPosition = currentPosition;
|
|
52756
|
+
return isClose && isWithinTime;
|
|
52750
52757
|
}
|
|
52751
52758
|
}
|
|
52752
52759
|
class DragHandler {
|
|
@@ -52998,11 +53005,7 @@ class InputHandler extends BaseInputHandler {
|
|
|
52998
53005
|
this.keyboard.registerKeyUp("KeyP", "replace", () => adapter.toggleOrthographic());
|
|
52999
53006
|
this.keyboard.registerKeyUp("Equal", "replace", () => this.moveSpeed++);
|
|
53000
53007
|
this.keyboard.registerKeyUp("Minus", "replace", () => this.moveSpeed--);
|
|
53001
|
-
this.keyboard.registerKeyUp("Space", "replace", () =>
|
|
53002
|
-
this._pointerActive = this._pointerActive === "orbit" ? "look" : "orbit";
|
|
53003
|
-
this._pointerFallback = this._pointerActive;
|
|
53004
|
-
this._onPointerModeChanged.dispatch();
|
|
53005
|
-
});
|
|
53008
|
+
this.keyboard.registerKeyUp("Space", "replace", () => adapter.toggleCameraOrbitMode());
|
|
53006
53009
|
this.keyboard.registerKeyUp("Home", "replace", () => adapter.resetCamera());
|
|
53007
53010
|
this.keyboard.registerKeyUp("Escape", "replace", () => adapter.clearSelection());
|
|
53008
53011
|
this.keyboard.registerKeyUp("KeyF", "replace", () => {
|
|
@@ -55900,6 +55903,11 @@ function createAdapter$2(viewer) {
|
|
|
55900
55903
|
toggleOrthographic: () => {
|
|
55901
55904
|
viewer.camera.orthographic = !viewer.camera.orthographic;
|
|
55902
55905
|
},
|
|
55906
|
+
toggleCameraOrbitMode: () => {
|
|
55907
|
+
this._pointerActive = this._pointerActive === PointerMode$1.ORBIT ? PointerMode$1.LOOK : PointerMode$1.ORBIT;
|
|
55908
|
+
this._pointerFallback = this._pointerActive;
|
|
55909
|
+
this._onPointerModeChanged.dispatch();
|
|
55910
|
+
},
|
|
55903
55911
|
resetCamera: () => {
|
|
55904
55912
|
viewer.camera.lerp(0.75).reset();
|
|
55905
55913
|
},
|
|
@@ -55924,7 +55932,7 @@ function createAdapter$2(viewer) {
|
|
|
55924
55932
|
},
|
|
55925
55933
|
frameAtPointer: async (pos) => {
|
|
55926
55934
|
const result = await viewer.raycaster.raycastFromScreen(pos);
|
|
55927
|
-
viewer.camera.lerp(0.75).frame(result.object);
|
|
55935
|
+
viewer.camera.lerp(0.75).frame(result.object ?? "all");
|
|
55928
55936
|
},
|
|
55929
55937
|
zoom: (value) => {
|
|
55930
55938
|
viewer.camera.lerp(0.75).zoom(value);
|
|
@@ -58828,6 +58836,7 @@ class Decoder {
|
|
|
58828
58836
|
}
|
|
58829
58837
|
}
|
|
58830
58838
|
const CODE_TO_KEYCODE = {
|
|
58839
|
+
"Space": 32,
|
|
58831
58840
|
"ArrowUp": 38,
|
|
58832
58841
|
"ArrowDown": 40,
|
|
58833
58842
|
"ArrowLeft": 37,
|
|
@@ -58861,6 +58870,9 @@ function createAdapter$1(viewer) {
|
|
|
58861
58870
|
toggleOrthographic: () => {
|
|
58862
58871
|
console.log("toggleOrthographic. Not supported yet");
|
|
58863
58872
|
},
|
|
58873
|
+
toggleCameraOrbitMode: () => {
|
|
58874
|
+
viewer.rpc.RPCKeyEvent(CODE_TO_KEYCODE["Space"], true);
|
|
58875
|
+
},
|
|
58864
58876
|
resetCamera: () => {
|
|
58865
58877
|
viewer.camera.restoreSavedPosition();
|
|
58866
58878
|
},
|
|
@@ -75314,16 +75326,19 @@ class ComponentLoader {
|
|
|
75314
75326
|
}
|
|
75315
75327
|
}
|
|
75316
75328
|
function MessageBox(props) {
|
|
75329
|
+
const [minimized, setMinimized] = React__default.useState(true);
|
|
75317
75330
|
const p = props.value;
|
|
75318
75331
|
if (!p.title || !p.body) return null;
|
|
75319
75332
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vim-message-box vc-p-6 vc-max-h-[80%] vc-max-w-[80%] vc-w-[424px] vc-bg-white vc-rounded-md vc-shadow-message vc-shadow-[0px_4px_16px_rgba(33,39,51,0.5)] vc-font-roboto", children: [
|
|
75320
75333
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vc-flex vc-justify-between vc-items-center", children: [
|
|
75334
|
+
props.value.icon,
|
|
75321
75335
|
title(p.title),
|
|
75322
|
-
closeBtn(p.onClose)
|
|
75336
|
+
props.value.canClose && closeBtn(p.onClose),
|
|
75337
|
+
props.value.minimize && minimizeButton(minimized, setMinimized)
|
|
75323
75338
|
] }),
|
|
75324
|
-
divider(),
|
|
75325
|
-
body(p.body),
|
|
75326
|
-
footer(p.footer)
|
|
75339
|
+
!minimized && divider(),
|
|
75340
|
+
!minimized && body(p.body),
|
|
75341
|
+
!minimized && footer(p.footer)
|
|
75327
75342
|
] });
|
|
75328
75343
|
}
|
|
75329
75344
|
function title(title2) {
|
|
@@ -75333,6 +75348,9 @@ function closeBtn(onClose) {
|
|
|
75333
75348
|
if (!onClose) return null;
|
|
75334
75349
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: onClose, className: "vc-text-[#212733] vc-text-xl", children: "×" });
|
|
75335
75350
|
}
|
|
75351
|
+
function minimizeButton(minimized, setMinimized) {
|
|
75352
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: () => setMinimized(!minimized), className: "vc-text-[#212733] vc-text-xl", children: minimized ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "▼" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "▲" }) });
|
|
75353
|
+
}
|
|
75336
75354
|
function body(content2) {
|
|
75337
75355
|
if (content2 === void 0) return null;
|
|
75338
75356
|
if (typeof content2 === "string") {
|
|
@@ -76061,6 +76079,16 @@ function Viewer$1(props) {
|
|
|
76061
76079
|
side.setHasBim(((_a3 = viewerState.vim.get()) == null ? void 0 : _a3.bim) !== void 0);
|
|
76062
76080
|
});
|
|
76063
76081
|
useEffect(() => {
|
|
76082
|
+
sectionBoxRef.showOffsetPanel.onChange.subscribe((show) => {
|
|
76083
|
+
if (show) {
|
|
76084
|
+
isolationRef.showPanel.set(false);
|
|
76085
|
+
}
|
|
76086
|
+
});
|
|
76087
|
+
isolationRef.showPanel.onChange.subscribe((show) => {
|
|
76088
|
+
if (show) {
|
|
76089
|
+
sectionBoxRef.showOffsetPanel.set(false);
|
|
76090
|
+
}
|
|
76091
|
+
});
|
|
76064
76092
|
if (performanceRef.current) {
|
|
76065
76093
|
addPerformanceCounter(performanceRef.current);
|
|
76066
76094
|
}
|
|
@@ -76429,18 +76457,28 @@ function createViewer(container) {
|
|
|
76429
76457
|
return controllablePromise.promise;
|
|
76430
76458
|
}
|
|
76431
76459
|
function Viewer3(props) {
|
|
76432
|
-
const
|
|
76433
|
-
const camera2 = useUltraCamera(props.core,
|
|
76460
|
+
const sectionBoxRef = useUltraSectionBox(props.core);
|
|
76461
|
+
const camera2 = useUltraCamera(props.core, sectionBoxRef);
|
|
76434
76462
|
const isolationPanelHandle = useRef(null);
|
|
76435
76463
|
const sectionBoxPanelHandle = useRef(null);
|
|
76436
76464
|
const modalHandle = useRef(null);
|
|
76437
76465
|
const side = useSideState(true, 400);
|
|
76438
76466
|
const [_, setSelectState] = useState(0);
|
|
76439
76467
|
const [controlBarCustom, setControlBarCustom] = useState(() => (c) => c);
|
|
76440
|
-
const
|
|
76441
|
-
const controlBar = useUltraControlBar(props.core,
|
|
76468
|
+
const isolationRef = useUltraIsolation(props.core);
|
|
76469
|
+
const controlBar = useUltraControlBar(props.core, sectionBoxRef, isolationRef, camera2, (_2) => _2);
|
|
76442
76470
|
useViewerInput(props.core.inputs, camera2);
|
|
76443
76471
|
useEffect(() => {
|
|
76472
|
+
sectionBoxRef.showOffsetPanel.onChange.subscribe((show) => {
|
|
76473
|
+
if (show) {
|
|
76474
|
+
isolationRef.showPanel.set(false);
|
|
76475
|
+
}
|
|
76476
|
+
});
|
|
76477
|
+
isolationRef.showPanel.onChange.subscribe((show) => {
|
|
76478
|
+
if (show) {
|
|
76479
|
+
sectionBoxRef.showOffsetPanel.set(false);
|
|
76480
|
+
}
|
|
76481
|
+
});
|
|
76444
76482
|
props.core.onStateChanged.subscribe((state) => updateModal(modalHandle, state));
|
|
76445
76483
|
props.core.selection.onSelectionChanged.subscribe(() => {
|
|
76446
76484
|
setSelectState((i) => (i + 1) % 2);
|
|
@@ -76450,8 +76488,8 @@ function Viewer3(props) {
|
|
|
76450
76488
|
get modal() {
|
|
76451
76489
|
return modalHandle.current;
|
|
76452
76490
|
},
|
|
76453
|
-
isolation,
|
|
76454
|
-
sectionBox:
|
|
76491
|
+
isolation: isolationRef,
|
|
76492
|
+
sectionBox: sectionBoxRef,
|
|
76455
76493
|
camera: camera2,
|
|
76456
76494
|
get isolationPanel() {
|
|
76457
76495
|
return isolationPanelHandle.current;
|
|
@@ -76479,8 +76517,8 @@ function Viewer3(props) {
|
|
|
76479
76517
|
show: true
|
|
76480
76518
|
}
|
|
76481
76519
|
),
|
|
76482
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state:
|
|
76483
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state:
|
|
76520
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel$1, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
|
|
76521
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel$1, { ref: isolationPanelHandle, state: isolationRef })
|
|
76484
76522
|
] });
|
|
76485
76523
|
} }),
|
|
76486
76524
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modalHandle, canFollowLinks: true }),
|