mobility-toolbox-js 2.0.0-beta.40 → 2.0.0-beta.43

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Layer.d.ts","sourceRoot":"","sources":["../../../src/common/layers/Layer.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;;;;;;;;;;;OAYG;IACH;QAT4B,GAAG;QACH,IAAI;QACF,UAAU;QACN,QAAQ;QACb,OAAO;QACP,QAAQ;QACT,YAAY;QACZ,UAAU;OA+BrC;IAvBC,iBAAuE;IAEvE,WAA0B;IAE1B,iCAAoC;IAEpC,8BAAgC;IAmBlC;;;;OAIG;IACH,qCA0HC;IAED;;;;OAIG;IACH,4BAUC;IARC,cAAc;IACd,SAAc;IAShB;;OAEG;IAEH,sBAGC;IAED;;;;;;;OAOG;IAEH,qDAJW,MAAM,GACL,QAAQ,WAAW,CAAC,CAiB/B;IAED;;OAEG;IACH,cAEC;CACF"}
1
+ {"version":3,"file":"Layer.d.ts","sourceRoot":"","sources":["../../../src/common/layers/Layer.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;;;;;;;;;;;OAYG;IACH;QAT4B,GAAG;QACH,IAAI;QACF,UAAU;QACN,QAAQ;QACb,OAAO;QACP,QAAQ;QACT,YAAY;QACZ,UAAU;OA+BrC;IAvBC,iBAAuE;IAEvE,WAA0B;IAE1B,iCAAoC;IAEpC,8BAAgC;IAmBlC;;;;OAIG;IACH,qCAiJC;IAED;;;;OAIG;IACH,4BAUC;IARC,cAAc;IACd,SAAc;IAShB;;OAEG;IAEH,sBAGC;IAED;;;;;;;OAOG;IAEH,qDAJW,MAAM,GACL,QAAQ,WAAW,CAAC,CAiB/B;IAED;;OAEG;IACH,cAEC;CACF"}
@@ -103,14 +103,25 @@ export default class Layer extends BaseObject {
103
103
  }
104
104
  this.set('visible', newVisible);
105
105
  if (this.visible) {
106
- if (this.parent && !this.parent.visible) {
106
+ // We make the parent visible
107
+ if (this.parent) {
107
108
  this.parent.visible = true;
108
109
  }
109
- if (this.children && this.children.find((child) => child.group)) {
110
- const child = this.children.find((childd) => !!childd.group);
111
- // Make visible only radioGroup layers
110
+ // If children contains layers with group, we display one of them (the last added).
111
+ if (this.children && this.children.some((child) => !!child.group)) {
112
+ const child = [...this.children]
113
+ .reverse()
114
+ .find((childd) => !!childd.group);
112
115
  child.visible = true;
113
116
  }
117
+ // If children doesn't contain any visible layers (not using group), we display all children (not using group).
118
+ if (this.children &&
119
+ !this.children.some((child) => !child.group && child.visible)) {
120
+ this.children.forEach((child) => {
121
+ // eslint-disable-next-line no-param-reassign
122
+ child.visible = true;
123
+ });
124
+ }
114
125
  // Warn the same group that a new layer is visible
115
126
  if (this.parent && this.group) {
116
127
  // We search for the higher parent then it will dispatch to all the tree.
@@ -125,6 +136,14 @@ export default class Layer extends BaseObject {
125
136
  }
126
137
  }
127
138
  else if (!this.visible) {
139
+ // We hide all the children
140
+ if (this.children) {
141
+ this.children.forEach((child) => {
142
+ // eslint-disable-next-line no-param-reassign
143
+ child.visible = false;
144
+ });
145
+ }
146
+ // If the parent has no more visible child we also hide it.
128
147
  if (this.parent &&
129
148
  this.parent.visible &&
130
149
  !this.parent.children.find((child) => child.visible)) {
package/mbt.js CHANGED
@@ -47845,13 +47845,18 @@ uniform ${i3} ${o3} u_${a3};
47845
47845
  }
47846
47846
  this.set("visible", newVisible);
47847
47847
  if (this.visible) {
47848
- if (this.parent && !this.parent.visible) {
47848
+ if (this.parent) {
47849
47849
  this.parent.visible = true;
47850
47850
  }
47851
- if (this.children && this.children.find((child) => child.group)) {
47852
- const child = this.children.find((childd) => !!childd.group);
47851
+ if (this.children && this.children.some((child) => !!child.group)) {
47852
+ const child = [...this.children].reverse().find((childd) => !!childd.group);
47853
47853
  child.visible = true;
47854
47854
  }
47855
+ if (this.children && !this.children.some((child) => !child.group && child.visible)) {
47856
+ this.children.forEach((child) => {
47857
+ child.visible = true;
47858
+ });
47859
+ }
47855
47860
  if (this.parent && this.group) {
47856
47861
  let higherParent = this.parent;
47857
47862
  while (higherParent.parent) {
@@ -47863,6 +47868,11 @@ uniform ${i3} ${o3} u_${a3};
47863
47868
  });
47864
47869
  }
47865
47870
  } else if (!this.visible) {
47871
+ if (this.children) {
47872
+ this.children.forEach((child) => {
47873
+ child.visible = false;
47874
+ });
47875
+ }
47866
47876
  if (this.parent && this.parent.visible && !this.parent.children.find((child) => child.visible)) {
47867
47877
  this.parent.visible = false;
47868
47878
  }
@@ -49621,8 +49631,8 @@ uniform ${i3} ${o3} u_${a3};
49621
49631
  attachToMap(map) {
49622
49632
  super.attachToMap(map);
49623
49633
  if (this.map) {
49624
- this.olListenersKeys.push(this.map.on(["moveend", "change:target"], (evt) => {
49625
- const view = this.map.getView();
49634
+ this.olListenersKeys.push(...this.map.on(["moveend", "change:target"], (evt) => {
49635
+ const view = evt.map.getView();
49626
49636
  if (view.getAnimating() || view.getInteracting()) {
49627
49637
  return;
49628
49638
  }