mobility-toolbox-js 2.0.0-beta.18 → 2.0.0-beta.19

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.
@@ -8,9 +8,7 @@ export default class Layer extends BaseObject {
8
8
  this.visible = options.visible === void 0 ? true : !!options.visible;
9
9
  this.group = options.group;
10
10
  this.copyrights = options.copyrights;
11
- this.children.forEach((child) => {
12
- child.parent = this;
13
- });
11
+ this.children = options.children;
14
12
  this.on(`change:visible:group`, (evt) => {
15
13
  if (this.group === evt.target.group && this !== evt.target && this.visible) {
16
14
  this.visible = false;
@@ -20,7 +18,7 @@ export default class Layer extends BaseObject {
20
18
  });
21
19
  }
22
20
  defineProperties(options) {
23
- const { name, key, children, properties, hitTolerance } = {
21
+ const { name, key, properties, hitTolerance } = {
24
22
  ...options
25
23
  };
26
24
  const uid = uuid();
@@ -93,8 +91,18 @@ export default class Layer extends BaseObject {
93
91
  writable: true
94
92
  },
95
93
  children: {
96
- value: children || [],
97
- writable: true
94
+ get: () => this.get("children"),
95
+ set: (newValue) => {
96
+ (this.children || []).forEach((child) => {
97
+ child.parent = null;
98
+ });
99
+ if (Array.isArray(newValue)) {
100
+ newValue.forEach((child) => {
101
+ child.parent = this;
102
+ });
103
+ }
104
+ this.set("children", newValue);
105
+ }
98
106
  },
99
107
  hitTolerance: {
100
108
  value: hitTolerance || 5,
package/mbt.js CHANGED
@@ -33377,16 +33377,18 @@ uniform ${i3} ${o3} u_${a3};
33377
33377
  };
33378
33378
  var HttpAPI_default = HttpAPI;
33379
33379
 
33380
- // src/api/RoutingAPI.ts
33380
+ // src/api/RoutingAPI.js
33381
33381
  var RoutingAPI = class extends HttpAPI_default {
33382
- constructor(options) {
33382
+ constructor(options = {}) {
33383
33383
  super({
33384
33384
  url: "https://api.geops.io/routing/v1/",
33385
- ...options || {}
33385
+ ...options
33386
33386
  });
33387
33387
  }
33388
- route(params, config) {
33389
- return this.fetch("", params, config);
33388
+ route(params, abortController = new AbortController()) {
33389
+ return this.fetch("", params, {
33390
+ signal: abortController.signal
33391
+ });
33390
33392
  }
33391
33393
  };
33392
33394
  var RoutingAPI_default = RoutingAPI;
@@ -47156,9 +47158,7 @@ uniform ${i3} ${o3} u_${a3};
47156
47158
  this.visible = options.visible === void 0 ? true : !!options.visible;
47157
47159
  this.group = options.group;
47158
47160
  this.copyrights = options.copyrights;
47159
- this.children.forEach((child) => {
47160
- child.parent = this;
47161
- });
47161
+ this.children = options.children;
47162
47162
  this.on(`change:visible:group`, (evt) => {
47163
47163
  if (this.group === evt.target.group && this !== evt.target && this.visible) {
47164
47164
  this.visible = false;
@@ -47168,7 +47168,7 @@ uniform ${i3} ${o3} u_${a3};
47168
47168
  });
47169
47169
  }
47170
47170
  defineProperties(options) {
47171
- const { name, key, children, properties, hitTolerance } = {
47171
+ const { name, key, properties, hitTolerance } = {
47172
47172
  ...options
47173
47173
  };
47174
47174
  const uid = v4_default();
@@ -47241,8 +47241,18 @@ uniform ${i3} ${o3} u_${a3};
47241
47241
  writable: true
47242
47242
  },
47243
47243
  children: {
47244
- value: children || [],
47245
- writable: true
47244
+ get: () => this.get("children"),
47245
+ set: (newValue) => {
47246
+ (this.children || []).forEach((child) => {
47247
+ child.parent = null;
47248
+ });
47249
+ if (Array.isArray(newValue)) {
47250
+ newValue.forEach((child) => {
47251
+ child.parent = this;
47252
+ });
47253
+ }
47254
+ this.set("children", newValue);
47255
+ }
47246
47256
  },
47247
47257
  hitTolerance: {
47248
47258
  value: hitTolerance || 5,