mobility-toolbox-js 2.0.0-beta.62 → 2.0.0-beta.64

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/mbt.js CHANGED
@@ -48098,8 +48098,23 @@ uniform ${i3} ${o3} u_${a3};
48098
48098
  }
48099
48099
  defineProperties(options) {
48100
48100
  super.defineProperties(options);
48101
+ let currOlLayer = options.olLayer;
48101
48102
  Object.defineProperties(this, {
48102
- olLayer: { value: options.olLayer, writable: true },
48103
+ olLayer: {
48104
+ get: () => {
48105
+ return currOlLayer;
48106
+ },
48107
+ set: (newOlLayer) => {
48108
+ if (currOlLayer === newOlLayer) {
48109
+ return;
48110
+ }
48111
+ currOlLayer = newOlLayer;
48112
+ if (currOlLayer) {
48113
+ currOlLayer.setVisible(this.visible);
48114
+ }
48115
+ this.toggleVisibleListeners();
48116
+ }
48117
+ },
48103
48118
  olListenersKeys: {
48104
48119
  value: []
48105
48120
  }
@@ -48110,21 +48125,16 @@ uniform ${i3} ${o3} u_${a3};
48110
48125
  if (!this.map) {
48111
48126
  return;
48112
48127
  }
48128
+ this.olLayer?.setVisible(this.visible);
48113
48129
  if (this.olLayer && !this.map?.getLayers()?.getArray()?.includes(this.olLayer)) {
48114
48130
  this.map.addLayer(this.olLayer);
48115
48131
  }
48116
- this.olListenersKeys.push(this.on("change:visible", () => {
48117
- if (this.olLayer) {
48118
- this.olLayer.setVisible(this.visible);
48119
- }
48120
- }));
48121
48132
  this.olListenersKeys.push(this.map.getLayers().on("remove", (evt) => {
48122
48133
  if (evt.element === this.olLayer) {
48123
48134
  this.detachFromMap();
48124
48135
  }
48125
48136
  }));
48126
48137
  this.toggleVisibleListeners();
48127
- this.olListenersKeys.push(this.on("change:visible", this.toggleVisibleListeners));
48128
48138
  if (this.copyrights && this.olLayer) {
48129
48139
  const attributions = this.copyrights || [];
48130
48140
  if (this.olLayer.getLayers) {