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

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
@@ -48092,29 +48092,12 @@ uniform ${i3} ${o3} u_${a3};
48092
48092
  var Layer3 = class extends UserInteractionsLayerMixin_default(Layer2) {
48093
48093
  constructor(options) {
48094
48094
  super(options);
48095
- if (this.olLayer) {
48096
- this.olLayer.setVisible(this.visible);
48097
- }
48095
+ this.olLayer?.setVisible(this.visible);
48098
48096
  }
48099
48097
  defineProperties(options) {
48100
48098
  super.defineProperties(options);
48101
- let currOlLayer = options.olLayer;
48102
48099
  Object.defineProperties(this, {
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
- },
48100
+ olLayer: { value: options.olLayer, writable: true },
48118
48101
  olListenersKeys: {
48119
48102
  value: []
48120
48103
  }
@@ -48129,12 +48112,18 @@ uniform ${i3} ${o3} u_${a3};
48129
48112
  if (this.olLayer && !this.map?.getLayers()?.getArray()?.includes(this.olLayer)) {
48130
48113
  this.map.addLayer(this.olLayer);
48131
48114
  }
48115
+ this.olListenersKeys.push(this.on("change:visible", () => {
48116
+ if (this.olLayer) {
48117
+ this.olLayer.setVisible(this.visible);
48118
+ }
48119
+ }));
48132
48120
  this.olListenersKeys.push(this.map.getLayers().on("remove", (evt) => {
48133
48121
  if (evt.element === this.olLayer) {
48134
48122
  this.detachFromMap();
48135
48123
  }
48136
48124
  }));
48137
48125
  this.toggleVisibleListeners();
48126
+ this.olListenersKeys.push(this.on("change:visible", this.toggleVisibleListeners));
48138
48127
  if (this.copyrights && this.olLayer) {
48139
48128
  const attributions = this.copyrights || [];
48140
48129
  if (this.olLayer.getLayers) {