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.
package/dist/vim-web.js CHANGED
@@ -61373,7 +61373,7 @@ class ViewerSelection {
61373
61373
  * @param node - A single node index or array of node indices to select.
61374
61374
  */
61375
61375
  select(vim, node) {
61376
- this.clear();
61376
+ this._clear();
61377
61377
  this.add(vim, node);
61378
61378
  }
61379
61379
  /**
@@ -61448,6 +61448,12 @@ class ViewerSelection {
61448
61448
  * @param vim - Optional. If provided, only clears selections for the specified VIM.
61449
61449
  */
61450
61450
  clear(vim) {
61451
+ const changed = this._clear(vim);
61452
+ if (changed) {
61453
+ this._onValueChanged.dispatch();
61454
+ }
61455
+ }
61456
+ _clear(vim) {
61451
61457
  let changed = false;
61452
61458
  this._selectedNodes.forEach((nodes, v) => {
61453
61459
  if (vim === void 0 || v === vim) {
@@ -61456,9 +61462,7 @@ class ViewerSelection {
61456
61462
  }
61457
61463
  });
61458
61464
  this._selectedNodes.clear();
61459
- if (changed) {
61460
- this._onValueChanged.dispatch();
61461
- }
61465
+ return changed;
61462
61466
  }
61463
61467
  /**
61464
61468
  * Calculates the bounding box encompassing all selected nodes.
@@ -61480,8 +61484,7 @@ class ViewerSelection {
61480
61484
  * Should be called when the selection manager is no longer needed.
61481
61485
  */
61482
61486
  dispose() {
61483
- this.clear();
61484
- this._selectedNodes = /* @__PURE__ */ new Map();
61487
+ this._clear();
61485
61488
  }
61486
61489
  }
61487
61490
  class VimCollection {
@@ -72099,31 +72102,10 @@ function VimContextMenu(props) {
72099
72102
  };
72100
72103
  const viewer = props.viewer;
72101
72104
  const camera2 = props.camera;
72102
- const [section, setSection] = useState({
72103
- visible: viewer.gizmos.sectionBox.visible,
72104
- clip: viewer.gizmos.sectionBox.clip
72105
- });
72106
- const isClipping = () => {
72107
- return !viewer.gizmos.sectionBox.box.containsBox(viewer.renderer.getBoundingBox());
72108
- };
72109
- const [clipping, setClipping] = useState(isClipping());
72110
72105
  const [, setVersion] = useState(0);
72111
72106
  const hidden2 = props.isolation.isActive();
72112
72107
  useEffect(() => {
72113
- const subState = viewer.gizmos.sectionBox.onStateChanged.subscribe(() => {
72114
- setSection({
72115
- visible: viewer.gizmos.sectionBox.visible,
72116
- clip: viewer.gizmos.sectionBox.clip
72117
- });
72118
- });
72119
- const subConfirm = viewer.gizmos.sectionBox.onBoxConfirm.subscribe(
72120
- () => setClipping(isClipping())
72121
- );
72122
72108
  props.isolation.onChanged.subscribe(() => setVersion((v) => v + 1));
72123
- return () => {
72124
- subState();
72125
- subConfirm();
72126
- };
72127
72109
  }, []);
72128
72110
  const onShowControlsBtn = (e) => {
72129
72111
  props.modal.help(true);
@@ -72159,30 +72141,13 @@ function VimContextMenu(props) {
72159
72141
  props.isolation.show(getSelection(), "contextMenu");
72160
72142
  e.stopPropagation();
72161
72143
  };
72162
- const onSelectionClearBtn = (e) => {
72163
- viewer.selection.clear();
72164
- e.stopPropagation();
72165
- };
72166
72144
  const onShowAllBtn = (e) => {
72167
72145
  props.isolation.clear("contextMenu");
72168
72146
  e.stopPropagation();
72169
72147
  };
72170
- const onSectionToggleBtn = (e) => {
72171
- viewer.gizmos.sectionBox.clip = !viewer.gizmos.sectionBox.clip;
72172
- };
72173
- const onSectionResetBtn = (e) => {
72174
- viewer.gizmos.sectionBox.fitBox(viewer.renderer.getBoundingBox());
72175
- e.stopPropagation();
72176
- };
72177
72148
  const onMeasureDeleteBtn = (e) => {
72178
72149
  viewer.gizmos.measure.abort();
72179
72150
  };
72180
- const onFitSectionToSelectionBtn = (e) => {
72181
- const box = viewer.selection.getBoundingBox();
72182
- if (box) {
72183
- viewer.gizmos.sectionBox.fitBox(box);
72184
- }
72185
- };
72186
72151
  const createButton2 = (button) => {
72187
72152
  if (!button.enabled) return null;
72188
72153
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -72229,10 +72194,10 @@ function VimContextMenu(props) {
72229
72194
  },
72230
72195
  {
72231
72196
  id: contextMenuElementIds.zoomToFit,
72232
- label: "Zoom to Fit",
72197
+ label: "Focus Camera",
72233
72198
  keyboard: "F",
72234
72199
  action: onCameraFrameBtn,
72235
- enabled: true
72200
+ enabled: hasSelection
72236
72201
  },
72237
72202
  {
72238
72203
  id: contextMenuElementIds.dividerSelection,
@@ -72266,13 +72231,6 @@ function VimContextMenu(props) {
72266
72231
  action: onSelectionShowBtn,
72267
72232
  enabled: hasSelection && !hasVisibleSelection
72268
72233
  },
72269
- {
72270
- id: contextMenuElementIds.clearSelection,
72271
- label: "Clear Selection",
72272
- keyboard: "Esc",
72273
- action: onSelectionClearBtn,
72274
- enabled: hasSelection
72275
- },
72276
72234
  {
72277
72235
  id: contextMenuElementIds.showAll,
72278
72236
  label: "Show All",
@@ -72287,31 +72245,6 @@ function VimContextMenu(props) {
72287
72245
  keyboard: "",
72288
72246
  action: onMeasureDeleteBtn,
72289
72247
  enabled: measuring
72290
- },
72291
- {
72292
- id: contextMenuElementIds.dividerSection,
72293
- enabled: clipping || section.visible
72294
- },
72295
- {
72296
- id: contextMenuElementIds.ignoreSection,
72297
- label: section.clip ? "Ignore Section Box" : "Apply Section Box",
72298
- keyboard: "",
72299
- action: onSectionToggleBtn,
72300
- enabled: clipping
72301
- },
72302
- {
72303
- id: contextMenuElementIds.resetSection,
72304
- label: "Reset Section Box",
72305
- keyboard: "",
72306
- action: onSectionResetBtn,
72307
- enabled: clipping
72308
- },
72309
- {
72310
- id: contextMenuElementIds.fitSectionToSelection,
72311
- label: "Fit Section Box to Selection",
72312
- keyboard: "",
72313
- action: onFitSectionToSelectionBtn,
72314
- enabled: section.visible && hasSelection
72315
72248
  }
72316
72249
  ];
72317
72250
  elements = ((_c = props.customization) == null ? void 0 : _c.call(props, elements)) ?? elements;
@@ -75997,6 +75930,7 @@ function useWebglSectionBox(viewer) {
75997
75930
  setVisible: (b) => {
75998
75931
  viewer.gizmos.sectionBox.visible = b;
75999
75932
  viewer.gizmos.sectionBox.interactive = b;
75933
+ viewer.gizmos.sectionBox.clip = b;
76000
75934
  },
76001
75935
  getBox: () => viewer.gizmos.sectionBox.box.clone(),
76002
75936
  fitBox: (box) => viewer.gizmos.sectionBox.fitBox(box),
@@ -76004,7 +75938,6 @@ function useWebglSectionBox(viewer) {
76004
75938
  getRendererBox: () => Promise.resolve(viewer.renderer.getBoundingBox()),
76005
75939
  onSelectionChanged: viewer.selection.onValueChanged
76006
75940
  };
76007
- viewer.gizmos.sectionBox.clip = true;
76008
75941
  return useSectionBox(vimAdapter);
76009
75942
  }
76010
75943
  function useCamera(adapter) {
@@ -76547,6 +76480,7 @@ function useUltraSectionBox(viewer) {
76547
76480
  console.log("SetVisible!", b);
76548
76481
  viewer.sectionBox.visible = b;
76549
76482
  viewer.sectionBox.interactive = b;
76483
+ viewer.sectionBox.clip = b;
76550
76484
  },
76551
76485
  getBox: () => viewer.sectionBox.getBox().clone(),
76552
76486
  fitBox: (box) => viewer.sectionBox.fitBox(box),