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.
package/dist/vim-web.js CHANGED
@@ -56912,7 +56912,6 @@ class CoreInputHandler extends InputHandler {
56912
56912
  this._adapter.init();
56913
56913
  }
56914
56914
  get moveSpeed() {
56915
- console.log("get moveSpeed", this._moveSpeed);
56916
56915
  return this._moveSpeed;
56917
56916
  }
56918
56917
  set moveSpeed(value) {
@@ -57034,7 +57033,6 @@ function createAdapter$1(viewer) {
57034
57033
  viewer.selection.clear();
57035
57034
  },
57036
57035
  frameCamera: () => {
57037
- console.log("frameCamera");
57038
57036
  if (viewer.selection.count > 0) {
57039
57037
  viewer.camera.lerp(0.75).frame(viewer.selection.getBoundingBox());
57040
57038
  } else {
@@ -61316,7 +61314,11 @@ function createAdapter(viewer) {
61316
61314
  viewer.selection.clear();
61317
61315
  },
61318
61316
  frameCamera: () => {
61319
- frameContext(viewer);
61317
+ if (viewer.selection.count > 0) {
61318
+ frameSelection$1(viewer);
61319
+ } else {
61320
+ viewer.camera.frameAll();
61321
+ }
61320
61322
  },
61321
61323
  selectAtPointer: async (pos, add) => {
61322
61324
  const hit = await viewer.selection.hitTest(pos);
@@ -61366,13 +61368,6 @@ function createAdapter(viewer) {
61366
61368
  }
61367
61369
  };
61368
61370
  }
61369
- async function frameContext(viewer) {
61370
- if (viewer.selection.count > 0) {
61371
- frameSelection$1(viewer);
61372
- } else {
61373
- viewer.camera.frameAll();
61374
- }
61375
- }
61376
61371
  async function frameSelection$1(viewer) {
61377
61372
  const box = await viewer.selection.getBoundingBox();
61378
61373
  if (!box) return;
@@ -66366,6 +66361,55 @@ function hidden({ height, width, fill: fill2, className = "" }) {
66366
66361
  }
66367
66362
  );
66368
66363
  }
66364
+ function frameScene({ height, width, fill: fill2, className }) {
66365
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
66366
+ "svg",
66367
+ {
66368
+ className,
66369
+ height,
66370
+ width,
66371
+ viewBox: "0 0 256 256",
66372
+ children: [
66373
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
66374
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66375
+ "path",
66376
+ {
66377
+ fill: fill2,
66378
+ 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"
66379
+ }
66380
+ ),
66381
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66382
+ "path",
66383
+ {
66384
+ fill: fill2,
66385
+ 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"
66386
+ }
66387
+ ),
66388
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66389
+ "path",
66390
+ {
66391
+ fill: fill2,
66392
+ 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"
66393
+ }
66394
+ ),
66395
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66396
+ "path",
66397
+ {
66398
+ fill: fill2,
66399
+ 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"
66400
+ }
66401
+ ),
66402
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
66403
+ "path",
66404
+ {
66405
+ fill: fill2,
66406
+ 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"
66407
+ }
66408
+ )
66409
+ ]
66410
+ }
66411
+ );
66412
+ }
66369
66413
  function autoCamera({ height, width, fill: fill2 = "", className }) {
66370
66414
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className, height, width, viewBox: "0 0 256 256", children: [
66371
66415
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
@@ -66914,6 +66958,7 @@ const icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
66914
66958
  close,
66915
66959
  collapse,
66916
66960
  frameRect,
66961
+ frameScene,
66917
66962
  frameSelection,
66918
66963
  fullArrowLeft,
66919
66964
  fullsScreen,
@@ -66959,7 +67004,7 @@ function anyUiAxesButton(settings2) {
66959
67004
  return settings2.ui.orthographic || settings2.ui.resetCamera || settings2.ui.enableGhost;
66960
67005
  }
66961
67006
  function anyUiCursorButton(settings2) {
66962
- 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);
67007
+ return isTrue(settings2.ui.orbit) || isTrue(settings2.ui.lookAround) || isTrue(settings2.ui.pan) || isTrue(settings2.ui.zoom) || isTrue(settings2.ui.zoomWindow);
66963
67008
  }
66964
67009
  function anyUiSettingButton(settings2) {
66965
67010
  return isTrue(settings2.ui.projectInspector) || isTrue(settings2.ui.settings) || isTrue(settings2.ui.help) || isTrue(settings2.ui.maximise);
@@ -66997,7 +67042,10 @@ const defaultSettings = {
66997
67042
  pan: true,
66998
67043
  zoom: true,
66999
67044
  zoomWindow: true,
67000
- zoomToFit: true,
67045
+ // Control bar - camera
67046
+ autoCamera: true,
67047
+ frameScene: true,
67048
+ frameSelection: true,
67001
67049
  // Control bar - tools
67002
67050
  sectioningMode: true,
67003
67051
  measuringMode: true,
@@ -67156,7 +67204,10 @@ const ids = {
67156
67204
  sectionMeasure: "controlBar.sectionMeasure",
67157
67205
  sectionSectionBox: "controlBar.sectionSectionBox",
67158
67206
  // Camera buttons
67207
+ buttonCameraFrameSelection: "controlBar.camera.frameSelection",
67208
+ buttonCameraFrameScene: "controlBar.camera.frameScene",
67159
67209
  buttonCameraAuto: "controlBar.camera.auto",
67210
+ // Camera Control buttons
67160
67211
  buttonCameraOrbit: "controlBar.camera.orbit",
67161
67212
  buttonCameraLook: "controlBarcamera.look",
67162
67213
  buttonCameraPan: "controlBar.camera.pan",
@@ -67169,16 +67220,15 @@ const ids = {
67169
67220
  buttonMaximize: "controlBar.maximize",
67170
67221
  // Action Buttons
67171
67222
  buttonToggleIsolation: "controlBar.action.toggleIsolation",
67172
- buttonZoomToFit: "controlBar.action.zoomToFit",
67173
67223
  // Tools buttons
67174
67224
  buttonSectionBox: "controlBar.sectionBox",
67175
67225
  buttonMeasure: "controlBar.measure",
67176
67226
  // Section box buttons
67177
67227
  buttonSectionBoxEnable: "controlBar.sectionBox.enable",
67178
67228
  buttonSectionBoxVisible: "controlBar.sectionBox.visible",
67179
- buttonSectionBoxShrinkToSelection: "controlBar.sectionBox.shrinkToSelection",
67229
+ buttonSectionBoxToSelection: "controlBar.sectionBox.sectionSelection",
67230
+ buttonSectionBoxToScene: "controlBar.sectionBox.sectionScene",
67180
67231
  buttonSectionBoxAuto: "controlBar.sectionBox.auto",
67181
- buttonSectionBoxReset: "controlBar.sectionBox.reset",
67182
67232
  buttonSectionBoxSettings: "controlBar.sectionBox.settings"
67183
67233
  };
67184
67234
  function ControlBar(props) {
@@ -67411,7 +67461,7 @@ function controlBarSectionBox(section, hasSelection) {
67411
67461
  icon: sectionBox
67412
67462
  },
67413
67463
  {
67414
- id: ids.buttonSectionBoxShrinkToSelection,
67464
+ id: ids.buttonSectionBoxToSelection,
67415
67465
  tip: "Fit Section",
67416
67466
  enabled: () => section.enable.get(),
67417
67467
  isOn: () => hasSelection,
@@ -67420,7 +67470,7 @@ function controlBarSectionBox(section, hasSelection) {
67420
67470
  icon: sectionBoxShrink
67421
67471
  },
67422
67472
  {
67423
- id: ids.buttonSectionBoxReset,
67473
+ id: ids.buttonSectionBoxToScene,
67424
67474
  tip: "Reset Section",
67425
67475
  enabled: () => section.enable.get(),
67426
67476
  style: (on) => buttonDefaultStyle(on),
@@ -67520,15 +67570,6 @@ function controlBarActions(camera2, settings2, isolation, measure$1) {
67520
67570
  enable: () => true,
67521
67571
  style: sectionDefaultStyle,
67522
67572
  buttons: [
67523
- {
67524
- id: ids.buttonZoomToFit,
67525
- enabled: () => isTrue(settings2.ui.zoomToFit),
67526
- tip: "Frame Camera",
67527
- action: () => camera2.frameSelection.call(),
67528
- icon: frameSelection,
67529
- isOn: () => false,
67530
- style: buttonDefaultStyle
67531
- },
67532
67573
  {
67533
67574
  id: ids.buttonToggleIsolation,
67534
67575
  enabled: () => isTrue(settings2.ui.toggleIsolation),
@@ -67604,6 +67645,24 @@ function controlBarCamera(camera2) {
67604
67645
  action: () => camera2.autoCamera.set(!camera2.autoCamera.get()),
67605
67646
  icon: autoCamera,
67606
67647
  style: buttonDefaultStyle
67648
+ },
67649
+ {
67650
+ id: ids.buttonCameraFrameSelection,
67651
+ // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67652
+ tip: "Frame Selection",
67653
+ action: () => camera2.frameSelection.call(),
67654
+ icon: frameSelection,
67655
+ isOn: () => false,
67656
+ style: buttonDefaultStyle
67657
+ },
67658
+ {
67659
+ id: ids.buttonCameraFrameScene,
67660
+ // enabled: () => isTrue(settings.ui.zoomToFit), TODO: Implement ui toggles in Ultra
67661
+ tip: "Frame All",
67662
+ action: () => camera2.frameScene.call(),
67663
+ icon: frameScene,
67664
+ isOn: () => false,
67665
+ style: buttonDefaultStyle
67607
67666
  }
67608
67667
  ]
67609
67668
  };
@@ -74023,9 +74082,9 @@ function MenuSettings(props) {
74023
74082
  (settings2, value) => settings2.ui.zoomWindow = value
74024
74083
  ),
74025
74084
  settingsToggle(
74026
- "Show Zoom To Fit Button",
74027
- (settings2) => settings2.ui.zoomToFit,
74028
- (settings2, value) => settings2.ui.zoomToFit = value
74085
+ "Show Zoom Frame Selection Button",
74086
+ (settings2) => settings2.ui.frameSelection,
74087
+ (settings2, value) => settings2.ui.frameSelection = value
74029
74088
  ),
74030
74089
  settingsSubtitle("Control Bar - Tools"),
74031
74090
  settingsToggle(
@@ -75522,7 +75581,7 @@ function useCamera(adapter, section) {
75522
75581
  const box = await getSelectionBox.call() ?? await getSceneBox.call();
75523
75582
  frame(adapter, section, box);
75524
75583
  });
75525
- const frameScene = useAsyncFuncRef(async () => {
75584
+ const frameScene2 = useAsyncFuncRef(async () => {
75526
75585
  const box = await getSceneBox.call();
75527
75586
  frame(adapter, section, box);
75528
75587
  });
@@ -75532,7 +75591,7 @@ function useCamera(adapter, section) {
75532
75591
  autoCamera: autoCamera2,
75533
75592
  reset,
75534
75593
  frameSelection: frameSelection2,
75535
- frameScene
75594
+ frameScene: frameScene2
75536
75595
  };
75537
75596
  }
75538
75597
  function frame(adapter, section, box) {
@@ -75557,6 +75616,11 @@ function useWebglCamera(viewer, section) {
75557
75616
  getSceneBox: () => Promise.resolve(viewer.renderer.getBoundingBox())
75558
75617
  }, section);
75559
75618
  }
75619
+ function useViewerInput(handler, camera2) {
75620
+ useEffect(() => {
75621
+ handler.keyboard.registerKeyUp("KeyF", "replace", () => camera2.frameSelection.call());
75622
+ }, []);
75623
+ }
75560
75624
  function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
75561
75625
  const promise2 = new DeferredPromise();
75562
75626
  const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
@@ -75592,6 +75656,7 @@ function VimComponent(props) {
75592
75656
  const camera2 = useWebglCamera(props.viewer, sectionBox2);
75593
75657
  const cursor = useMemo(() => new CursorManager(props.viewer), []);
75594
75658
  const loader = useRef(new ComponentLoader(props.viewer, modal));
75659
+ useViewerInput(props.viewer.inputs, camera2);
75595
75660
  const [isolation] = useState(() => new Isolation(props.viewer, camera2, settings2.value));
75596
75661
  useEffect(() => isolation.applySettings(settings2.value), [settings2]);
75597
75662
  const side = useSideState(
@@ -76058,29 +76123,10 @@ function useUltraSectionBox(viewer) {
76058
76123
  function useUltraControlBar(viewer, section, camera2, customization) {
76059
76124
  const sectionSectionBox = controlBarSectionBox(section, viewer.selection.count > 0);
76060
76125
  const sectionCamera = controlBarCamera(camera2);
76061
- const frame2 = frameSection(camera2);
76062
- let bar = [sectionCamera, frame2, sectionSectionBox];
76126
+ let bar = [sectionCamera, sectionSectionBox];
76063
76127
  bar = (customization == null ? void 0 : customization(bar)) ?? bar;
76064
76128
  return bar;
76065
76129
  }
76066
- function frameSection(camera2) {
76067
- return {
76068
- id: ids.sectionActions,
76069
- enable: () => true,
76070
- style: sectionDefaultStyle,
76071
- buttons: [
76072
- {
76073
- id: ids.buttonZoomToFit,
76074
- enabled: () => true,
76075
- tip: "Frame Camera",
76076
- action: () => camera2.frameSelection.call(),
76077
- icon: frameSelection,
76078
- isOn: () => false,
76079
- style: buttonDefaultStyle
76080
- }
76081
- ]
76082
- };
76083
- }
76084
76130
  function useUltraCamera(viewer, section) {
76085
76131
  return useCamera({
76086
76132
  onSelectionChanged: viewer.selection.onValueChanged,
@@ -76123,6 +76169,7 @@ function UltraComponent(props) {
76123
76169
  const [_, setSelectState] = useState(0);
76124
76170
  const [controlBarCustom, setControlBarCustom] = useState(() => (c) => c);
76125
76171
  const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, camera2, (_2) => _2);
76172
+ useViewerInput(props.viewer.inputs, camera2);
76126
76173
  useEffect(() => {
76127
76174
  props.viewer.onStateChanged.subscribe((state) => updateModal(modal, state));
76128
76175
  props.viewer.selection.onValueChanged.subscribe(() => {