@idmwx/idmui-gl3 4.5.0 → 4.5.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.
package/dist/index.js CHANGED
@@ -580,47 +580,50 @@ const T = (a, e) => {
580
580
  },
581
581
  showWindFeather: {
582
582
  handler() {
583
- !this.showWindFeather && !this.showWindParticle && this.handleWeatherLayerPick({ weight: 1, name: "Wind", key: "wind", enabled: !0, type: "json", particle: !0 });
583
+ !this.showWindFeather && !this.showWindParticle && this.weatherLayers.some((a) => a.key === "wind") && (console.log(888999), this.handleWeatherLayerPick({ weight: 1, name: "Wind", key: "wind", enabled: !0, type: "json", particle: !0 }));
584
584
  }
585
585
  },
586
586
  showWindParticle: {
587
587
  handler() {
588
- !this.showWindFeather && !this.showWindParticle && this.handleWeatherLayerPick({ weight: 1, name: "Wind", key: "wind", enabled: !0, type: "json", particle: !0 });
588
+ !this.showWindFeather && !this.showWindParticle && this.weatherLayers.some((a) => a.key === "wind") && (console.log(777999), this.handleWeatherLayerPick({ weight: 1, name: "Wind", key: "wind", enabled: !0, type: "json", particle: !0 }));
589
589
  }
590
590
  },
591
591
  showCurrentIsoband: {
592
592
  handler() {
593
- !this.showCurrentIsoband && !this.showCurrentParticle && this.handleWeatherLayerPick({ weight: 96, name: "Current", key: "current", vendor: "cmems", merge: !0, h5: !0, enabled: !0 });
593
+ !this.showCurrentIsoband && !this.showCurrentParticle && this.weatherLayers.some((a) => a.key === "current") && (console.log(666999), this.handleWeatherLayerPick({ weight: 96, name: "Current", key: "current", vendor: "cmems", merge: !0, h5: !0, enabled: !0 }));
594
594
  }
595
595
  },
596
596
  showCurrentParticle: {
597
597
  handler() {
598
- !this.showCurrentIsoband && !this.showCurrentParticle && this.handleWeatherLayerPick({ weight: 96, name: "Current", key: "current", vendor: "cmems", merge: !0, h5: !0, enabled: !0 });
598
+ !this.showCurrentIsoband && !this.showCurrentParticle && this.weatherLayers.some((a) => a.key === "current") && (console.log(555999), this.handleWeatherLayerPick({ weight: 96, name: "Current", key: "current", vendor: "cmems", merge: !0, h5: !0, enabled: !0 }));
599
599
  }
600
600
  }
601
601
  },
602
602
  mounted() {
603
- const a = localStorage.getItem(this.version.k);
604
- this.version.v !== a && (localStorage.removeItem(this.weatherLayersCache), localStorage.removeItem(this.collectedLayerCache), localStorage.removeItem(this.otherLayersCache), localStorage.removeItem("windFeatherCache"), localStorage.removeItem("currentJsonCache"), localStorage.setItem(this.version.k, this.version.v));
605
- let e = localStorage.getItem(this.autoActiveCache);
606
- this.autoActive = e !== "false", e = localStorage.getItem(this.collectedLayerCache);
607
- let t = JSON.parse(
608
- e || '[{"weight": 16, "name": "Sig Waves", "key": "sig-wave-height", "collected": true},{"weight": 1, "name": "Wind", "key": "wind", "h5": true, "collected": true},{"weight": 96, "name": "Current", "key": "current", "collected": true},{"weight": 256, "name": "Tropicals", "key": "tropicals", "collected": true},{"weight": 4096, "name": "Pressure", "h5": true, "key": "prmsl", "collected": true},{"weight": 6, "name": "Swell", "key": "swell", "collected": true}]'
609
- );
610
- this.layers.weather.forEach((r) => {
611
- r.collected = !!t.some((i) => i.key === r.key && i.collected);
612
- }), e = localStorage.getItem(this.weatherLayersCache), t = JSON.parse(
613
- e || '[{"weight":1,"name":"Wind","key":"wind","enabled":true,"type":"json","particle":true},{"weight":4096,"name":"Pressure","key":"prmsl","enabled":true,"type":"json"},{"weight":256,"name":"Tropicals","key":"tropicals","enabled":true,"type":"json"}]'
614
- ), this.autoActive && (this.weatherLayers = [...t]), e = localStorage.getItem(this.otherLayersCache), t = JSON.parse(e || '[{"weight":4,"name":"ECA Zones","key":"eca-zones","enabled":true,"type":"json"}]'), this.otherLayers = t, e = localStorage.getItem(this.sourceCache), this.source = e || "GFS", this.handleConfirm();
603
+ this.fetchCache(), this.handleConfirm();
615
604
  },
616
605
  methods: {
606
+ fetchCache() {
607
+ const a = localStorage.getItem(this.version.k);
608
+ this.version.v !== a && (localStorage.removeItem(this.weatherLayersCache), localStorage.removeItem(this.collectedLayerCache), localStorage.removeItem(this.otherLayersCache), localStorage.removeItem("windFeatherCache"), localStorage.removeItem("currentJsonCache"), localStorage.setItem(this.version.k, this.version.v));
609
+ let e = localStorage.getItem(this.autoActiveCache);
610
+ this.autoActive = e !== "false", e = localStorage.getItem(this.collectedLayerCache);
611
+ let t = JSON.parse(
612
+ e || '[{"weight": 16, "name": "Sig Waves", "key": "sig-wave-height", "collected": true},{"weight": 1, "name": "Wind", "key": "wind", "h5": true, "collected": true},{"weight": 96, "name": "Current", "key": "current", "collected": true},{"weight": 256, "name": "Tropicals", "key": "tropicals", "collected": true},{"weight": 4096, "name": "Pressure", "h5": true, "key": "prmsl", "collected": true},{"weight": 6, "name": "Swell", "key": "swell", "collected": true}]'
613
+ );
614
+ this.layers.weather.forEach((r) => {
615
+ r.collected = !!t.some((i) => i.key === r.key && i.collected);
616
+ }), e = localStorage.getItem(this.weatherLayersCache), t = JSON.parse(
617
+ e || '[{"weight":1,"name":"Wind","key":"wind","enabled":true,"type":"json","particle":true},{"weight":4096,"name":"Pressure","key":"prmsl","enabled":true,"type":"json"},{"weight":256,"name":"Tropicals","key":"tropicals","enabled":true,"type":"json"}]'
618
+ ), this.autoActive && (this.weatherLayers = [...t]), e = localStorage.getItem(this.otherLayersCache), t = JSON.parse(e || '[{"weight":4,"name":"ECA Zones","key":"eca-zones","enabled":true,"type":"json"}]'), this.otherLayers = t, e = localStorage.getItem(this.sourceCache), this.source = e || "GFS";
619
+ },
617
620
  handleConfirm() {
618
621
  this.$emit("weather", this.weatherLayers, this.source), this.$emit("other", this.otherLayers), localStorage.setItem(this.autoActiveCache, this.autoActive), localStorage.setItem(this.sourceCache, this.source);
619
622
  },
620
623
  handleWeatherLayerPick(a) {
621
624
  if (this.rampColorLayers.includes(a.key) && this.mapProjection === "globe" || !this.autoActive)
622
625
  return !1;
623
- ["wind", "current"].includes(a.key) && !this.showWindFeather && !this.showCurrentIsoband && (a.particle = !0), this.weatherLayers.some((e) => e.key === a.key) ? this.weatherLayers = this.weatherLayers.filter((e) => e.key !== a.key) : this.weatherLayers.length < 12 && a.enabled && (["png", "jpg"].includes(a.type) && (this.weatherLayers = this.weatherLayers.filter((e) => e.type === "json")), this.weatherLayers.push(a)), this.$emit("weather", this.weatherLayers, this.source), localStorage.setItem(this.weatherLayersCache, JSON.stringify(this.weatherLayers)), localStorage.setItem(this.sourceCache, this.source);
626
+ console.log(999, a.key, a), (a.key === "wind" && !this.showWindFeather || a.key === "wind" && !this.showCurrentIsoband) && (a.particle = !0), this.weatherLayers.some((e) => e.key === a.key) ? this.weatherLayers = this.weatherLayers.filter((e) => e.key !== a.key) : this.weatherLayers.length < 12 && a.enabled && (["png", "jpg"].includes(a.type) && (this.weatherLayers = this.weatherLayers.filter((e) => e.type === "json")), this.weatherLayers.push(a)), this.$emit("weather", this.weatherLayers, this.source), localStorage.setItem(this.weatherLayersCache, JSON.stringify(this.weatherLayers)), localStorage.setItem(this.sourceCache, this.source);
624
627
  },
625
628
  handleWeatherLayerCollect(a) {
626
629
  var e;
@@ -3694,14 +3697,7 @@ const Rt = /* @__PURE__ */ T(Tt, [["render", It], ["__scopeId", "data-v-6d4fd206
3694
3697
  "sigWave.version": {
3695
3698
  handler() {
3696
3699
  var a;
3697
- (a = this.sigWave) != null && a.active ? this.handleRender() : this.handleClear();
3698
- },
3699
- deep: !0
3700
- },
3701
- activeWeatherLayers: {
3702
- handler() {
3703
- setTimeout(() => {
3704
- }, 200);
3700
+ (a = this.sigWave) != null && a.active ? (this.handleRender(), this.handleMove()) : this.handleClear();
3705
3701
  },
3706
3702
  deep: !0
3707
3703
  }
@@ -3782,8 +3778,13 @@ const Rt = /* @__PURE__ */ T(Tt, [["render", It], ["__scopeId", "data-v-6d4fd206
3782
3778
  ), i = (/* @__PURE__ */ new Date()).valueOf() - (t + r), console.log("[sig.wave] add elapsed: ", i, ", total: ", r += i));
3783
3779
  }
3784
3780
  },
3781
+ handleMove() {
3782
+ var a, e;
3783
+ (e = (a = this.map) == null ? void 0 : a.getLayer("country-boundaries")) == null || e.setLayoutProperty("visibility", "visible"), this.map.getLayer(this.heightLayer) && this.map.moveLayer(this.heightLayer, "country-boundaries"), this.map.getLayer(this.heightLabelLayer) && this.map.moveLayer(this.heightLabelLayer, "country-boundaries");
3784
+ },
3785
3785
  handleClear() {
3786
- this.map.getLayer(this.heightLayer) && this.map.removeLayer(this.heightLayer), this.map.getLayer(this.heightLabelLayer) && this.map.removeLayer(this.heightLabelLayer), this.map.getSource(this.source) && this.map.removeSource(this.source);
3786
+ var a, e, t;
3787
+ ((a = this.activeWeatherLayers) == null ? void 0 : a.length) === 0 && ((t = (e = this.map) == null ? void 0 : e.getLayer("country-boundaries")) == null || t.setLayoutProperty("visibility", "none")), this.map.getLayer(this.heightLayer) && this.map.removeLayer(this.heightLayer), this.map.getLayer(this.heightLabelLayer) && this.map.removeLayer(this.heightLabelLayer), this.map.getSource(this.source) && this.map.removeSource(this.source);
3787
3788
  }
3788
3789
  }
3789
3790
  };
@@ -3819,16 +3820,18 @@ const Mt = /* @__PURE__ */ T(At, [["render", Dt]]), Wt = {
3819
3820
  "swell.version": {
3820
3821
  handler() {
3821
3822
  var a;
3822
- (a = this.swell) != null && a.active ? this.handleRender() : this.handleClear();
3823
+ (a = this.swell) != null && a.active ? (this.handleRender(), this.handleMove()) : this.handleClear();
3823
3824
  },
3824
3825
  deep: !0
3825
3826
  },
3826
3827
  activeWeatherLayers: {
3827
3828
  handler() {
3828
3829
  setTimeout(() => {
3829
- }, 300);
3830
+ this.activeWeatherLayers.length > 0 ? this.handleMove() : this.handleClear();
3831
+ }, 500);
3830
3832
  },
3831
- deep: !0
3833
+ deep: !0,
3834
+ immediate: !0
3832
3835
  }
3833
3836
  },
3834
3837
  methods: {
@@ -3933,8 +3936,13 @@ const Mt = /* @__PURE__ */ T(At, [["render", Dt]]), Wt = {
3933
3936
  ), i = (/* @__PURE__ */ new Date()).valueOf() - (t + r), console.log("[swell] add elapsed: ", i, ", total: ", r += i));
3934
3937
  }
3935
3938
  },
3939
+ handleMove() {
3940
+ var a, e;
3941
+ (e = (a = this.map) == null ? void 0 : a.getLayer("country-boundaries")) == null || e.setLayoutProperty("visibility", "visible"), this.map.getLayer(this.heightLayer) && this.map.moveLayer(this.heightLayer, "country-boundaries"), this.map.getLayer(this.directionLayer) && this.map.moveLayer(this.directionLayer, "country-boundaries"), this.map.getLayer(this.heightLabelLayer) && this.map.moveLayer(this.heightLabelLayer, "country-boundaries");
3942
+ },
3936
3943
  handleClear() {
3937
- this.map.getLayer(this.heightLayer) && this.map.removeLayer(this.heightLayer), this.map.getLayer(this.heightLabelLayer) && this.map.removeLayer(this.heightLabelLayer), this.map.getLayer(this.directionLayer) && this.map.removeLayer(this.directionLayer), this.map.getSource(this.source) && this.map.removeSource(this.source);
3944
+ var a, e;
3945
+ this.activeWeatherLayers.length === 0 && ((e = (a = this.map) == null ? void 0 : a.getLayer("country-boundaries")) == null || e.setLayoutProperty("visibility", "none")), this.map.getLayer(this.heightLayer) && this.map.removeLayer(this.heightLayer), this.map.getLayer(this.heightLabelLayer) && this.map.removeLayer(this.heightLabelLayer), this.map.getLayer(this.directionLayer) && this.map.removeLayer(this.directionLayer), this.map.getSource(this.source) && this.map.removeSource(this.source);
3938
3946
  }
3939
3947
  }
3940
3948
  };
@@ -3973,14 +3981,15 @@ const Bt = /* @__PURE__ */ T(Wt, [["render", jt]]), Nt = {
3973
3981
  "prmsl.version": {
3974
3982
  handler() {
3975
3983
  var a;
3976
- (a = this.prmsl) != null && a.active ? this.handleRender() : this.handleClear();
3984
+ (a = this.prmsl) != null && a.active ? (this.handleRender(), this.handleMove()) : this.handleClear();
3977
3985
  },
3978
3986
  deep: !0
3979
3987
  },
3980
3988
  activeWeatherLayers: {
3981
3989
  handler() {
3982
3990
  setTimeout(() => {
3983
- }, 300);
3991
+ this.activeWeatherLayers.length > 0 ? this.handleMove() : this.handleClear();
3992
+ }, 500);
3984
3993
  },
3985
3994
  deep: !0,
3986
3995
  immediate: !0
@@ -4064,7 +4073,7 @@ const Bt = /* @__PURE__ */ T(Wt, [["render", jt]]), Nt = {
4064
4073
  },
4065
4074
  this.beforeLayer
4066
4075
  );
4067
- }, 100), o = (/* @__PURE__ */ new Date()).valueOf() - (r + i), console.log("[prmsl] add elapsed: ", o, ", total: ", i += o));
4076
+ }, 0), o = (/* @__PURE__ */ new Date()).valueOf() - (r + i), console.log("[prmsl] add elapsed: ", o, ", total: ", i += o));
4068
4077
  }
4069
4078
  },
4070
4079
  handleMove() {