sctj-components 1.1.0 → 1.1.1

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.
@@ -11227,6 +11227,8 @@ function useBimfaceGIS(options = {}) {
11227
11227
  const isLoaded = ref$1(false);
11228
11228
  const isLoading = ref$1(true);
11229
11229
  const error = ref$1(null);
11230
+ const swipe = ref$1(null);
11231
+ const isSwipeAdded = ref$1(false);
11230
11232
  let registeredEvents = [];
11231
11233
  const initViewer = async (domElement, viewToken, config = {}) => {
11232
11234
  return new Promise(async (resolve, reject) => {
@@ -11634,7 +11636,7 @@ function useBimfaceGIS(options = {}) {
11634
11636
  console.warn("\u56FE\u5C42\u7BA1\u7406\u5668\u672A\u521D\u59CB\u5316");
11635
11637
  return;
11636
11638
  }
11637
- console.log("layerId", layerId);
11639
+ console.log("layerId--------------", layerId);
11638
11640
  layerManager.value.zoomToLayer(layerId, callback);
11639
11641
  };
11640
11642
  const getComponentManager = (layerId) => {
@@ -12006,6 +12008,73 @@ function useBimfaceGIS(options = {}) {
12006
12008
  return;
12007
12009
  effectManager.removeObject(effect);
12008
12010
  };
12011
+ const openSwipe = (layerContents, config = {}) => {
12012
+ if (!viewer.value) {
12013
+ console.warn("Viewer\u672A\u521D\u59CB\u5316");
12014
+ return null;
12015
+ }
12016
+ if (!layerContents || (layerContents == null ? void 0 : layerContents.length) < 2) {
12017
+ console.error("layerContents\u53C2\u6570\u9519\u8BEF,\u8BF7\u4F20\u5165\u81F3\u5C11\u4E24\u4E2A\u56FE\u5C42\u5185\u5BB9");
12018
+ return null;
12019
+ }
12020
+ if (swipe.value) {
12021
+ console.warn("\u5377\u5E18\u5DF2\u5B58\u5728");
12022
+ return swipe.value;
12023
+ }
12024
+ try {
12025
+ const defaultConfig = {
12026
+ viewer: viewer.value,
12027
+ direction: "Horizontal"
12028
+ };
12029
+ const swipeConfig = new window.Glodon.Bimface.Earth.Plugins.ViewComparator.SwipeConfig();
12030
+ swipeConfig.viewer = viewer.value;
12031
+ swipeConfig.direction = config.direction || defaultConfig.direction;
12032
+ swipeConfig.layerContents = layerContents;
12033
+ swipe.value = new window.Glodon.Bimface.Earth.Plugins.ViewComparator.Swipe(swipeConfig);
12034
+ isSwipeAdded.value = true;
12035
+ if (config.cameraStatus) {
12036
+ viewer.value.getCamera().setStatus(config.cameraStatus);
12037
+ }
12038
+ swipe.value.show();
12039
+ viewer.value.render();
12040
+ return swipe.value;
12041
+ } catch (err) {
12042
+ console.error("\u521B\u5EFA\u5377\u5E18\u5931\u8D25:", err);
12043
+ swipe.value = null;
12044
+ isSwipeAdded.value = false;
12045
+ return null;
12046
+ }
12047
+ };
12048
+ const hideSwipe = () => {
12049
+ var _a;
12050
+ if (swipe.value) {
12051
+ swipe.value.hide();
12052
+ isSwipeAdded.value = false;
12053
+ (_a = viewer.value) == null ? void 0 : _a.render();
12054
+ }
12055
+ };
12056
+ const showSwipe = () => {
12057
+ var _a;
12058
+ if (swipe.value) {
12059
+ swipe.value.show();
12060
+ isSwipeAdded.value = true;
12061
+ (_a = viewer.value) == null ? void 0 : _a.render();
12062
+ }
12063
+ };
12064
+ const toggleSwipe = () => {
12065
+ if (isSwipeAdded.value) {
12066
+ hideSwipe();
12067
+ } else {
12068
+ showSwipe();
12069
+ }
12070
+ };
12071
+ const destroySwipe = () => {
12072
+ if (swipe.value) {
12073
+ swipe.value.destroy();
12074
+ swipe.value = null;
12075
+ isSwipeAdded.value = false;
12076
+ }
12077
+ };
12009
12078
  const dispose = () => {
12010
12079
  if (resizeHandler.value) {
12011
12080
  window.removeEventListener("resize", resizeHandler.value);
@@ -12015,6 +12084,9 @@ function useBimfaceGIS(options = {}) {
12015
12084
  removeEventListener(eventType, callback, inctance);
12016
12085
  });
12017
12086
  registeredEvents.length = 0;
12087
+ if (swipe.value) {
12088
+ destroySwipe();
12089
+ }
12018
12090
  if (editor.value) {
12019
12091
  editor.value.exit();
12020
12092
  editor.value = null;
@@ -12123,8 +12195,9 @@ function useBimfaceGIS(options = {}) {
12123
12195
  clearSelection(layerId);
12124
12196
  selectComponents(layerId, condition);
12125
12197
  const layer = getLayer(layerId);
12126
- const viewer2 = layer.getViewer();
12127
- const model = viewer2.getModels()[0];
12198
+ if (layer.typeName !== "BIMLayer")
12199
+ return;
12200
+ const model = layer.model;
12128
12201
  model.zoomToSelectedComponents();
12129
12202
  if (clear) {
12130
12203
  clearSelection(layerId);
@@ -12194,11 +12267,18 @@ function useBimfaceGIS(options = {}) {
12194
12267
  openModelEditor,
12195
12268
  closeModelEditor,
12196
12269
  clearAllEffects,
12270
+ swipe,
12271
+ isSwipeAdded,
12272
+ openSwipe,
12273
+ hideSwipe,
12274
+ showSwipe,
12275
+ toggleSwipe,
12276
+ destroySwipe,
12197
12277
  dispose
12198
12278
  };
12199
12279
  }
12200
- const index_vue_vue_type_style_index_0_scoped_f0818b3a_lang = "";
12201
- const _withScopeId = (n) => (pushScopeId("data-v-f0818b3a"), n = n(), popScopeId(), n);
12280
+ const index_vue_vue_type_style_index_0_scoped_a0549f20_lang = "";
12281
+ const _withScopeId = (n) => (pushScopeId("data-v-a0549f20"), n = n(), popScopeId(), n);
12202
12282
  const _hoisted_1 = {
12203
12283
  key: 0,
12204
12284
  class: "loading-mask"
@@ -12261,8 +12341,8 @@ const _sfc_main = {
12261
12341
  setup(__props, { expose, emit }) {
12262
12342
  const props = __props;
12263
12343
  useCssVars((_ctx) => ({
12264
- "decc1896": __props.width,
12265
- "68d58918": __props.height
12344
+ "9d0301d2": __props.width,
12345
+ "648269f6": __props.height
12266
12346
  }));
12267
12347
  const containerRef = ref$1(null);
12268
12348
  const {
@@ -12272,6 +12352,8 @@ const _sfc_main = {
12272
12352
  isLoaded,
12273
12353
  isLoading,
12274
12354
  error,
12355
+ swipe,
12356
+ isSwipeAdded,
12275
12357
  initViewer,
12276
12358
  getLayer,
12277
12359
  getAllLayers,
@@ -12329,6 +12411,11 @@ const _sfc_main = {
12329
12411
  getLayerLocation,
12330
12412
  openModelEditor,
12331
12413
  closeModelEditor,
12414
+ openSwipe,
12415
+ hideSwipe,
12416
+ showSwipe,
12417
+ toggleSwipe,
12418
+ destroySwipe,
12332
12419
  dispose
12333
12420
  } = useBimfaceGIS({
12334
12421
  onModelTransformEnd: (data) => emit("model-transform-end", data)
@@ -12426,7 +12513,7 @@ const _sfc_main = {
12426
12513
  if (bimLayers.length > 0) {
12427
12514
  zoomToLayer(bimLayers[bimLayers.length - 1].getId());
12428
12515
  }
12429
- }, 500);
12516
+ }, 1e3);
12430
12517
  }
12431
12518
  });
12432
12519
  } finally {
@@ -12572,6 +12659,8 @@ const _sfc_main = {
12572
12659
  isLoaded,
12573
12660
  isLoading,
12574
12661
  error,
12662
+ swipe,
12663
+ isSwipeAdded,
12575
12664
  loadScene,
12576
12665
  getLayer,
12577
12666
  getAllLayers,
@@ -12629,6 +12718,11 @@ const _sfc_main = {
12629
12718
  openModelEditor,
12630
12719
  closeModelEditor,
12631
12720
  clearAllEffects,
12721
+ openSwipe,
12722
+ hideSwipe,
12723
+ showSwipe,
12724
+ toggleSwipe,
12725
+ destroySwipe,
12632
12726
  dispose
12633
12727
  });
12634
12728
  return (_ctx, _cache) => {
@@ -12660,7 +12754,7 @@ const _sfc_main = {
12660
12754
  };
12661
12755
  }
12662
12756
  };
12663
- const SCTJGISViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f0818b3a"]]);
12757
+ const SCTJGISViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a0549f20"]]);
12664
12758
  const components = [
12665
12759
  { component: SCTJDictTag, name: "SCTJDictTag" },
12666
12760
  { component: SCTJTreeSelect, name: "SCTJTreeSelect" },