vim-web 0.3.44-dev.45 → 0.3.44-dev.47

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.
@@ -6,6 +6,8 @@ export declare const ids: {
6
6
  sectionSettings: string;
7
7
  sectionMeasure: string;
8
8
  sectionSectionBox: string;
9
+ buttonCameraFrameSelection: string;
10
+ buttonCameraFrameScene: string;
9
11
  buttonCameraAuto: string;
10
12
  buttonCameraOrbit: string;
11
13
  buttonCameraLook: string;
@@ -17,13 +19,12 @@ export declare const ids: {
17
19
  buttonHelp: string;
18
20
  buttonMaximize: string;
19
21
  buttonToggleIsolation: string;
20
- buttonZoomToFit: string;
21
22
  buttonSectionBox: string;
22
23
  buttonMeasure: string;
23
24
  buttonSectionBoxEnable: string;
24
25
  buttonSectionBoxVisible: string;
25
- buttonSectionBoxShrinkToSelection: string;
26
+ buttonSectionBoxToSelection: string;
27
+ buttonSectionBoxToScene: string;
26
28
  buttonSectionBoxAuto: string;
27
- buttonSectionBoxReset: string;
28
29
  buttonSectionBoxSettings: string;
29
30
  };
@@ -27,6 +27,7 @@ export declare function arrowLeft({ height, width, fill, className }: IconOption
27
27
  export declare function fullArrowLeft({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
28
28
  export declare function visible({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
29
29
  export declare function hidden({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
30
+ export declare function frameScene({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
30
31
  export declare function autoCamera({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
31
32
  export declare function orbit({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
32
33
  export declare function look({ height, width, fill, className }: IconOptions): import("react/jsx-runtime").JSX.Element;
@@ -61,7 +61,9 @@ export type ComponentSettings = {
61
61
  pan: UserBoolean;
62
62
  zoom: UserBoolean;
63
63
  zoomWindow: UserBoolean;
64
- zoomToFit: UserBoolean;
64
+ autoCamera: UserBoolean;
65
+ frameSelection: UserBoolean;
66
+ frameScene: UserBoolean;
65
67
  sectioningMode: UserBoolean;
66
68
  measuringMode: UserBoolean;
67
69
  toggleIsolation: UserBoolean;
@@ -35,19 +35,7 @@ export declare function controlBarActions(camera: CameraRef, settings: Component
35
35
  style: typeof ControlBar.buttonDefaultStyle;
36
36
  })[];
37
37
  };
38
- export declare function controlBarCamera(camera: CameraRef): {
39
- id: string;
40
- enable: () => boolean;
41
- style: string;
42
- buttons: {
43
- id: string;
44
- tip: string;
45
- isOn: () => boolean;
46
- action: () => void;
47
- icon: typeof Icons.autoCamera;
48
- style: typeof ControlBar.buttonDefaultStyle;
49
- }[];
50
- };
38
+ export declare function controlBarCamera(camera: CameraRef): ControlBar.IControlBarSection;
51
39
  /**
52
40
  * Combines all control bar sections into one control bar.
53
41
  */
@@ -72,16 +60,4 @@ export declare function useControlBar(viewer: VIM.Viewer, camera: CameraRef, mod
72
60
  icon: typeof Icons.measure;
73
61
  style: typeof ControlBar.buttonDefaultStyle;
74
62
  })[];
75
- } | {
76
- id: string;
77
- enable: () => boolean;
78
- style: string;
79
- buttons: {
80
- id: string;
81
- tip: string;
82
- isOn: () => boolean;
83
- action: () => void;
84
- icon: typeof Icons.autoCamera;
85
- style: typeof ControlBar.buttonDefaultStyle;
86
- }[];
87
63
  })[];
@@ -0,0 +1,3 @@
1
+ import { CoreInputHandler } from "../../core-viewers/webgl";
2
+ import { CameraRef } from "./cameraState";
3
+ export declare function useViewerInput(handler: CoreInputHandler, camera: CameraRef): void;
@@ -2,19 +2,7 @@ import { ControlBarCustomization } from '../controlbar/controlBar';
2
2
  import { SectionBoxRef } from '../state/sectionBoxState';
3
3
  import * as Ultra from '../../core-viewers/ultra/index';
4
4
  import { CameraRef } from '../state/cameraState';
5
- import { ControlBar, Icons } from '..';
5
+ import { ControlBar } from '..';
6
6
  export { buttonDefaultStyle, buttonBlueStyle } from '../controlbar/controlBarButton';
7
7
  export { sectionDefaultStyle, sectionBlueStyle } from '../controlbar/controlBarSection';
8
- export declare function useUltraControlBar(viewer: Ultra.UltraCoreViewer, section: SectionBoxRef, camera: CameraRef, customization: ControlBarCustomization | undefined): (ControlBar.IControlBarSection | {
9
- id: string;
10
- enable: () => boolean;
11
- style: string;
12
- buttons: {
13
- id: string;
14
- tip: string;
15
- isOn: () => boolean;
16
- action: () => void;
17
- icon: typeof Icons.autoCamera;
18
- style: typeof ControlBar.buttonDefaultStyle;
19
- }[];
20
- })[];
8
+ export declare function useUltraControlBar(viewer: Ultra.UltraCoreViewer, section: SectionBoxRef, camera: CameraRef, customization: ControlBarCustomization | undefined): ControlBar.IControlBarSection[];
@@ -56928,7 +56928,6 @@ void main() {
56928
56928
  this._adapter.init();
56929
56929
  }
56930
56930
  get moveSpeed() {
56931
- console.log("get moveSpeed", this._moveSpeed);
56932
56931
  return this._moveSpeed;
56933
56932
  }
56934
56933
  set moveSpeed(value) {
@@ -57050,7 +57049,6 @@ void main() {
57050
57049
  viewer.selection.clear();
57051
57050
  },
57052
57051
  frameCamera: () => {
57053
- console.log("frameCamera");
57054
57052
  if (viewer.selection.count > 0) {
57055
57053
  viewer.camera.lerp(0.75).frame(viewer.selection.getBoundingBox());
57056
57054
  } else {
@@ -61332,7 +61330,11 @@ Averrage Date/Second ${avgDataRatePS} kb
61332
61330
  viewer.selection.clear();
61333
61331
  },
61334
61332
  frameCamera: () => {
61335
- frameContext(viewer);
61333
+ if (viewer.selection.count > 0) {
61334
+ frameSelection$1(viewer);
61335
+ } else {
61336
+ viewer.camera.frameAll();
61337
+ }
61336
61338
  },
61337
61339
  selectAtPointer: async (pos, add) => {
61338
61340
  const hit = await viewer.selection.hitTest(pos);
@@ -61382,13 +61384,6 @@ Averrage Date/Second ${avgDataRatePS} kb
61382
61384
  }
61383
61385
  };
61384
61386
  }
61385
- async function frameContext(viewer) {
61386
- if (viewer.selection.count > 0) {
61387
- frameSelection$1(viewer);
61388
- } else {
61389
- viewer.camera.frameAll();
61390
- }
61391
- }
61392
61387
  async function frameSelection$1(viewer) {
61393
61388
  const box = await viewer.selection.getBoundingBox();
61394
61389
  if (!box) return;
@@ -66382,6 +66377,55 @@ Averrage Date/Second ${avgDataRatePS} kb
66382
66377
  }
66383
66378
  );
66384
66379
  }
66380
+ function frameScene({ height, width, fill: fill2, className }) {
66381
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
66382
+ "svg",
66383
+ {
66384
+ className,
66385
+ height,
66386
+ width,
66387
+ viewBox: "0 0 256 256",
66388
+ children: [
66389
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
66390
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66391
+ "path",
66392
+ {
66393
+ fill: fill2,
66394
+ 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"
66395
+ }
66396
+ ),
66397
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66398
+ "path",
66399
+ {
66400
+ fill: fill2,
66401
+ 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"
66402
+ }
66403
+ ),
66404
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66405
+ "path",
66406
+ {
66407
+ fill: fill2,
66408
+ 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"
66409
+ }
66410
+ ),
66411
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66412
+ "path",
66413
+ {
66414
+ fill: fill2,
66415
+ 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"
66416
+ }
66417
+ ),
66418
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66419
+ "path",
66420
+ {
66421
+ fill: fill2,
66422
+ 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"
66423
+ }
66424
+ )
66425
+ ]
66426
+ }
66427
+ );
66428
+ }
66385
66429
  function autoCamera({ height, width, fill: fill2 = "", className }) {
66386
66430
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
66387
66431
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
@@ -66930,6 +66974,7 @@ Averrage Date/Second ${avgDataRatePS} kb
66930
66974
  close,
66931
66975
  collapse,
66932
66976
  frameRect,
66977
+ frameScene,
66933
66978
  frameSelection,
66934
66979
  fullArrowLeft,
66935
66980
  fullsScreen,
@@ -66975,7 +67020,7 @@ Averrage Date/Second ${avgDataRatePS} kb
66975
67020
  return settings2.ui.orthographic || settings2.ui.resetCamera || settings2.ui.enableGhost;
66976
67021
  }
66977
67022
  function anyUiCursorButton(settings2) {
66978
- return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow) || isTrue(settings2.ui.zoomToFit);
67023
+ return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow);
66979
67024
  }
66980
67025
  function anyUiSettingButton(settings2) {
66981
67026
  return isTrue(settings2.ui.projectInspector) || isTrue(settings2.ui.settings) || isTrue(settings2.ui.help) || isTrue(settings2.ui.maximise);
@@ -67013,7 +67058,10 @@ Averrage Date/Second ${avgDataRatePS} kb
67013
67058
  pan: true,
67014
67059
  zoom: true,
67015
67060
  zoomWindow: true,
67016
- zoomToFit: true,
67061
+ // Control bar - camera
67062
+ autoCamera: true,
67063
+ frameScene: true,
67064
+ frameSelection: true,
67017
67065
  // Control bar - tools
67018
67066
  sectioningMode: true,
67019
67067
  measuringMode: true,
@@ -67172,7 +67220,10 @@ Averrage Date/Second ${avgDataRatePS} kb
67172
67220
  sectionMeasure: "controlBar.sectionMeasure",
67173
67221
  sectionSectionBox: "controlBar.sectionSectionBox",
67174
67222
  // Camera buttons
67223
+ buttonCameraFrameSelection: "controlBar.camera.frameSelection",
67224
+ buttonCameraFrameScene: "controlBar.camera.frameScene",
67175
67225
  buttonCameraAuto: "controlBar.camera.auto",
67226
+ // Camera Control buttons
67176
67227
  buttonCameraOrbit: "controlBar.camera.orbit",
67177
67228
  buttonCameraLook: "controlBarcamera.look",
67178
67229
  buttonCameraPan: "controlBar.camera.pan",
@@ -67185,16 +67236,15 @@ Averrage Date/Second ${avgDataRatePS} kb
67185
67236
  buttonMaximize: "controlBar.maximize",
67186
67237
  // Action Buttons
67187
67238
  buttonToggleIsolation: "controlBar.action.toggleIsolation",
67188
- buttonZoomToFit: "controlBar.action.zoomToFit",
67189
67239
  // Tools buttons
67190
67240
  buttonSectionBox: "controlBar.sectionBox",
67191
67241
  buttonMeasure: "controlBar.measure",
67192
67242
  // Section box buttons
67193
67243
  buttonSectionBoxEnable: "controlBar.sectionBox.enable",
67194
67244
  buttonSectionBoxVisible: "controlBar.sectionBox.visible",
67195
- buttonSectionBoxShrinkToSelection: "controlBar.sectionBox.shrinkToSelection",
67245
+ buttonSectionBoxToSelection: "controlBar.sectionBox.sectionSelection",
67246
+ buttonSectionBoxToScene: "controlBar.sectionBox.sectionScene",
67196
67247
  buttonSectionBoxAuto: "controlBar.sectionBox.auto",
67197
- buttonSectionBoxReset: "controlBar.sectionBox.reset",
67198
67248
  buttonSectionBoxSettings: "controlBar.sectionBox.settings"
67199
67249
  };
67200
67250
  function ControlBar(props) {
@@ -67427,7 +67477,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67427
67477
  icon: sectionBox
67428
67478
  },
67429
67479
  {
67430
- id: ids.buttonSectionBoxShrinkToSelection,
67480
+ id: ids.buttonSectionBoxToSelection,
67431
67481
  tip: "Fit Section",
67432
67482
  enabled: () => section.enable.get(),
67433
67483
  isOn: () => hasSelection,
@@ -67436,7 +67486,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67436
67486
  icon: sectionBoxShrink
67437
67487
  },
67438
67488
  {
67439
- id: ids.buttonSectionBoxReset,
67489
+ id: ids.buttonSectionBoxToScene,
67440
67490
  tip: "Reset Section",
67441
67491
  enabled: () => section.enable.get(),
67442
67492
  style: (on) => buttonDefaultStyle(on),
@@ -67536,15 +67586,6 @@ Averrage Date/Second ${avgDataRatePS} kb
67536
67586
  enable: () => true,
67537
67587
  style: sectionDefaultStyle,
67538
67588
  buttons: [
67539
- {
67540
- id: ids.buttonZoomToFit,
67541
- enabled: () => isTrue(settings2.ui.zoomToFit),
67542
- tip: "Frame Camera",
67543
- action: () => camera2.frameSelection.call(),
67544
- icon: frameSelection,
67545
- isOn: () => false,
67546
- style: buttonDefaultStyle
67547
- },
67548
67589
  {
67549
67590
  id: ids.buttonToggleIsolation,
67550
67591
  enabled: () => isTrue(settings2.ui.toggleIsolation),
@@ -67620,6 +67661,24 @@ Averrage Date/Second ${avgDataRatePS} kb
67620
67661
  action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
67621
67662
  icon: autoCamera,
67622
67663
  style: buttonDefaultStyle
67664
+ },
67665
+ {
67666
+ id: ids.buttonCameraFrameSelection,
67667
+ // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67668
+ tip: "Frame Selection",
67669
+ action: () => camera2.frameSelection.call(),
67670
+ icon: frameSelection,
67671
+ isOn: () => false,
67672
+ style: buttonDefaultStyle
67673
+ },
67674
+ {
67675
+ id: ids.buttonCameraFrameScene,
67676
+ // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67677
+ tip: "Frame All",
67678
+ action: () => camera2.frameScene.call(),
67679
+ icon: frameScene,
67680
+ isOn: () => false,
67681
+ style: buttonDefaultStyle
67623
67682
  }
67624
67683
  ]
67625
67684
  };
@@ -74039,9 +74098,9 @@ Averrage Date/Second ${avgDataRatePS} kb
74039
74098
  (settings2, value) => settings2.ui.zoomWindow = value
74040
74099
  ),
74041
74100
  settingsToggle(
74042
- "Show Zoom To Fit Button",
74043
- (settings2) => settings2.ui.zoomToFit,
74044
- (settings2, value) => settings2.ui.zoomToFit = value
74101
+ "Show Zoom Frame Selection Button",
74102
+ (settings2) => settings2.ui.frameSelection,
74103
+ (settings2, value) => settings2.ui.frameSelection = value
74045
74104
  ),
74046
74105
  settingsSubtitle("Control Bar - Tools"),
74047
74106
  settingsToggle(
@@ -75538,7 +75597,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75538
75597
  const box = await getSelectionBox.call() ?? await getSceneBox.call();
75539
75598
  frame(adapter, section, box);
75540
75599
  });
75541
- const frameScene = useAsyncFuncRef(async () => {
75600
+ const frameScene2 = useAsyncFuncRef(async () => {
75542
75601
  const box = await getSceneBox.call();
75543
75602
  frame(adapter, section, box);
75544
75603
  });
@@ -75548,7 +75607,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75548
75607
  autoCamera: autoCamera2,
75549
75608
  reset,
75550
75609
  frameSelection: frameSelection2,
75551
- frameScene
75610
+ frameScene: frameScene2
75552
75611
  };
75553
75612
  }
75554
75613
  function frame(adapter, section, box) {
@@ -75573,6 +75632,11 @@ Averrage Date/Second ${avgDataRatePS} kb
75573
75632
  getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox())
75574
75633
  }, section);
75575
75634
  }
75635
+ function useViewerInput(handler, camera2) {
75636
+ React2.useEffect(() => {
75637
+ handler.keyboard.registerKeyUp("KeyF", "replace", () => camera2.frameSelection.call());
75638
+ }, []);
75639
+ }
75576
75640
  function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
75577
75641
  const promise2 = new DeferredPromise();
75578
75642
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
@@ -75608,6 +75672,7 @@ Averrage Date/Second ${avgDataRatePS} kb
75608
75672
  const camera2 = useWebglCamera(props.viewer, sectionBox2);
75609
75673
  const cursor = React2.useMemo(() => new CursorManager(props.viewer), []);
75610
75674
  const loader = React2.useRef(new ComponentLoader(props.viewer, modal));
75675
+ useViewerInput(props.viewer.inputs, camera2);
75611
75676
  const [isolation] = React2.useState(() => new Isolation(props.viewer, camera2, settings2.value));
75612
75677
  React2.useEffect(() => isolation.applySettings(settings2.value), [settings2]);
75613
75678
  const side = useSideState(
@@ -76074,29 +76139,10 @@ Averrage Date/Second ${avgDataRatePS} kb
76074
76139
  function useUltraControlBar(viewer, section, camera2, customization) {
76075
76140
  const sectionSectionBox = controlBarSectionBox(section, viewer.selection.count > 0);
76076
76141
  const sectionCamera = controlBarCamera(camera2);
76077
- const frame2 = frameSection(camera2);
76078
- let bar = [sectionCamera, frame2, sectionSectionBox];
76142
+ let bar = [sectionCamera, sectionSectionBox];
76079
76143
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76080
76144
  return bar;
76081
76145
  }
76082
- function frameSection(camera2) {
76083
- return {
76084
- id: ids.sectionActions,
76085
- enable: () => true,
76086
- style: sectionDefaultStyle,
76087
- buttons: [
76088
- {
76089
- id: ids.buttonZoomToFit,
76090
- enabled: () => true,
76091
- tip: "Frame Camera",
76092
- action: () => camera2.frameSelection.call(),
76093
- icon: frameSelection,
76094
- isOn: () => false,
76095
- style: buttonDefaultStyle
76096
- }
76097
- ]
76098
- };
76099
- }
76100
76146
  function useUltraCamera(viewer, section) {
76101
76147
  return useCamera({
76102
76148
  onSelectionChanged: viewer.selection.onValueChanged,
@@ -76139,6 +76185,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76139
76185
  const [_, setSelectState] = React2.useState(0);
76140
76186
  const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);
76141
76187
  const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, camera2, (_2) => _2);
76188
+ useViewerInput(props.viewer.inputs, camera2);
76142
76189
  React2.useEffect(() => {
76143
76190
  props.viewer.onStateChanged.subscribe((state) => updateModal(modal, state));
76144
76191
  props.viewer.selection.onValueChanged.subscribe(() => {