vim-web 0.3.44-dev.21 → 0.3.44-dev.23

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.
@@ -82,6 +82,7 @@ export declare class ViewerSelection implements IViewerSelection {
82
82
  * @param vim - Optional. If provided, only clears selections for the specified VIM.
83
83
  */
84
84
  clear(vim?: Vim): void;
85
+ private _clear;
85
86
  /**
86
87
  * Calculates the bounding box encompassing all selected nodes.
87
88
  * @returns Promise resolving to a Box3 representing the bounds of all selected nodes,
@@ -61389,7 +61389,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61389
61389
  * @param node - A single node index or array of node indices to select.
61390
61390
  */
61391
61391
  select(vim, node) {
61392
- this.clear();
61392
+ this._clear();
61393
61393
  this.add(vim, node);
61394
61394
  }
61395
61395
  /**
@@ -61464,6 +61464,12 @@ Averrage Date/Second ${avgDataRatePS} kb
61464
61464
  * @param vim - Optional. If provided, only clears selections for the specified VIM.
61465
61465
  */
61466
61466
  clear(vim) {
61467
+ const changed = this._clear(vim);
61468
+ if (changed) {
61469
+ this._onValueChanged.dispatch();
61470
+ }
61471
+ }
61472
+ _clear(vim) {
61467
61473
  let changed = false;
61468
61474
  this._selectedNodes.forEach((nodes, v) => {
61469
61475
  if (vim === void 0 || v === vim) {
@@ -61472,9 +61478,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61472
61478
  }
61473
61479
  });
61474
61480
  this._selectedNodes.clear();
61475
- if (changed) {
61476
- this._onValueChanged.dispatch();
61477
- }
61481
+ return changed;
61478
61482
  }
61479
61483
  /**
61480
61484
  * Calculates the bounding box encompassing all selected nodes.
@@ -61496,8 +61500,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61496
61500
  * Should be called when the selection manager is no longer needed.
61497
61501
  */
61498
61502
  dispose() {
61499
- this.clear();
61500
- this._selectedNodes = /* @__PURE__ */ new Map();
61503
+ this._clear();
61501
61504
  }
61502
61505
  }
61503
61506
  class VimCollection {
@@ -72115,31 +72118,10 @@ Averrage Date/Second ${avgDataRatePS} kb
72115
72118
  };
72116
72119
  const viewer = props.viewer;
72117
72120
  const camera2 = props.camera;
72118
- const [section, setSection] = React2.useState({
72119
- visible: viewer.gizmos.sectionBox.visible,
72120
- clip: viewer.gizmos.sectionBox.clip
72121
- });
72122
- const isClipping = () => {
72123
- return !viewer.gizmos.sectionBox.box.containsBox(viewer.renderer.getBoundingBox());
72124
- };
72125
- const [clipping, setClipping] = React2.useState(isClipping());
72126
72121
  const [, setVersion] = React2.useState(0);
72127
72122
  const hidden2 = props.isolation.isActive();
72128
72123
  React2.useEffect(() => {
72129
- const subState = viewer.gizmos.sectionBox.onStateChanged.subscribe(() => {
72130
- setSection({
72131
- visible: viewer.gizmos.sectionBox.visible,
72132
- clip: viewer.gizmos.sectionBox.clip
72133
- });
72134
- });
72135
- const subConfirm = viewer.gizmos.sectionBox.onBoxConfirm.subscribe(
72136
- () => setClipping(isClipping())
72137
- );
72138
72124
  props.isolation.onChanged.subscribe(() => setVersion((v) => v + 1));
72139
- return () => {
72140
- subState();
72141
- subConfirm();
72142
- };
72143
72125
  }, []);
72144
72126
  const onShowControlsBtn = (e) => {
72145
72127
  props.modal.help(true);
@@ -72175,30 +72157,13 @@ Averrage Date/Second ${avgDataRatePS} kb
72175
72157
  props.isolation.show(getSelection(), "contextMenu");
72176
72158
  e.stopPropagation();
72177
72159
  };
72178
- const onSelectionClearBtn = (e) => {
72179
- viewer.selection.clear();
72180
- e.stopPropagation();
72181
- };
72182
72160
  const onShowAllBtn = (e) => {
72183
72161
  props.isolation.clear("contextMenu");
72184
72162
  e.stopPropagation();
72185
72163
  };
72186
- const onSectionToggleBtn = (e) => {
72187
- viewer.gizmos.sectionBox.clip = !viewer.gizmos.sectionBox.clip;
72188
- };
72189
- const onSectionResetBtn = (e) => {
72190
- viewer.gizmos.sectionBox.fitBox(viewer.renderer.getBoundingBox());
72191
- e.stopPropagation();
72192
- };
72193
72164
  const onMeasureDeleteBtn = (e) => {
72194
72165
  viewer.gizmos.measure.abort();
72195
72166
  };
72196
- const onFitSectionToSelectionBtn = (e) => {
72197
- const box = viewer.selection.getBoundingBox();
72198
- if (box) {
72199
- viewer.gizmos.sectionBox.fitBox(box);
72200
- }
72201
- };
72202
72167
  const createButton2 = (button) => {
72203
72168
  if (!button.enabled) return null;
72204
72169
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -72245,10 +72210,10 @@ Averrage Date/Second ${avgDataRatePS} kb
72245
72210
  },
72246
72211
  {
72247
72212
  id: contextMenuElementIds.zoomToFit,
72248
- label: "Zoom to Fit",
72213
+ label: "Focus Camera",
72249
72214
  keyboard: "F",
72250
72215
  action: onCameraFrameBtn,
72251
- enabled: true
72216
+ enabled: hasSelection
72252
72217
  },
72253
72218
  {
72254
72219
  id: contextMenuElementIds.dividerSelection,
@@ -72282,13 +72247,6 @@ Averrage Date/Second ${avgDataRatePS} kb
72282
72247
  action: onSelectionShowBtn,
72283
72248
  enabled: hasSelection && !hasVisibleSelection
72284
72249
  },
72285
- {
72286
- id: contextMenuElementIds.clearSelection,
72287
- label: "Clear Selection",
72288
- keyboard: "Esc",
72289
- action: onSelectionClearBtn,
72290
- enabled: hasSelection
72291
- },
72292
72250
  {
72293
72251
  id: contextMenuElementIds.showAll,
72294
72252
  label: "Show All",
@@ -72303,31 +72261,6 @@ Averrage Date/Second ${avgDataRatePS} kb
72303
72261
  keyboard: "",
72304
72262
  action: onMeasureDeleteBtn,
72305
72263
  enabled: measuring
72306
- },
72307
- {
72308
- id: contextMenuElementIds.dividerSection,
72309
- enabled: clipping || section.visible
72310
- },
72311
- {
72312
- id: contextMenuElementIds.ignoreSection,
72313
- label: section.clip ? "Ignore Section Box" : "Apply Section Box",
72314
- keyboard: "",
72315
- action: onSectionToggleBtn,
72316
- enabled: clipping
72317
- },
72318
- {
72319
- id: contextMenuElementIds.resetSection,
72320
- label: "Reset Section Box",
72321
- keyboard: "",
72322
- action: onSectionResetBtn,
72323
- enabled: clipping
72324
- },
72325
- {
72326
- id: contextMenuElementIds.fitSectionToSelection,
72327
- label: "Fit Section Box to Selection",
72328
- keyboard: "",
72329
- action: onFitSectionToSelectionBtn,
72330
- enabled: section.visible && hasSelection
72331
72264
  }
72332
72265
  ];
72333
72266
  elements = ((_c = props.customization) == null ? void 0 : _c.call(props, elements)) ?? elements;
@@ -76013,6 +75946,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76013
75946
  setVisible: (b) => {
76014
75947
  viewer.gizmos.sectionBox.visible = b;
76015
75948
  viewer.gizmos.sectionBox.interactive = b;
75949
+ viewer.gizmos.sectionBox.clip = b;
76016
75950
  },
76017
75951
  getBox: () => viewer.gizmos.sectionBox.box.clone(),
76018
75952
  fitBox: (box) => viewer.gizmos.sectionBox.fitBox(box),
@@ -76020,7 +75954,6 @@ Averrage Date/Second ${avgDataRatePS} kb
76020
75954
  getRendererBox: () => Promise.resolve(viewer.renderer.getBoundingBox()),
76021
75955
  onSelectionChanged: viewer.selection.onValueChanged
76022
75956
  };
76023
- viewer.gizmos.sectionBox.clip = true;
76024
75957
  return useSectionBox(vimAdapter);
76025
75958
  }
76026
75959
  function useCamera(adapter) {
@@ -76563,6 +76496,7 @@ Averrage Date/Second ${avgDataRatePS} kb
76563
76496
  console.log("SetVisible!", b);
76564
76497
  viewer.sectionBox.visible = b;
76565
76498
  viewer.sectionBox.interactive = b;
76499
+ viewer.sectionBox.clip = b;
76566
76500
  },
76567
76501
  getBox: () => viewer.sectionBox.getBox().clone(),
76568
76502
  fitBox: (box) => viewer.sectionBox.fitBox(box),