mobility-toolbox-js 3.0.0-beta.21 → 3.0.0-beta.23

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,9 +1,9 @@
1
1
  import { Feature } from 'geojson';
2
2
  import Control, { Options } from 'ol/control/Control';
3
3
  import StopFinderControlCommon from '../../common/controls/StopFinderControlCommon';
4
- export type StopFinderControlOptions = Options & StopFinderControlCommon & {
4
+ export type StopFinderControlOptions = {
5
5
  className?: string;
6
- };
6
+ } & Options & StopFinderControlCommon;
7
7
  /**
8
8
  * This OpenLayers control allows to search stations from the [geOps Stops API](https://developer.geops.io/apis/stops/).
9
9
  *
@@ -1,5 +1,5 @@
1
- import { fromLonLat } from 'ol/proj';
2
1
  import Control from 'ol/control/Control';
2
+ import { fromLonLat } from 'ol/proj';
3
3
  import StopFinderControlCommon from '../../common/controls/StopFinderControlCommon';
4
4
  import createDefaultStopFinderElement from '../../common/utils/createDefaultStopFinderElt';
5
5
  /**
@@ -150,6 +150,10 @@ declare class MaplibreLayer extends MaplibreLayer_base {
150
150
  clone(newOptions: MaplibreLayerOptions): MaplibreLayer;
151
151
  getStyle(): string;
152
152
  updateMaplibreMap(): void;
153
+ set apiKey(newValue: string);
154
+ get apiKey(): string;
155
+ set apiKeyName(newValue: string);
156
+ get apiKeyName(): string;
153
157
  get maplibreMap(): maplibregl.Map | undefined;
154
158
  get mbMap(): maplibregl.Map | undefined;
155
159
  get style(): string;
@@ -69,8 +69,9 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
69
69
  attachToMap(map) {
70
70
  super.attachToMap(map);
71
71
  const updateMaplibreMapDebounced = debounce(this.updateMaplibreMap.bind(this), 150);
72
+ updateMaplibreMapDebounced();
72
73
  this.olEventsKeys.push(this.on('propertychange', (evt) => {
73
- if (/(url|style)/.test(evt.key)) {
74
+ if (/(url|style|apiKey|apiKeyName)/.test(evt.key)) {
74
75
  updateMaplibreMapDebounced();
75
76
  }
76
77
  }));
@@ -116,6 +117,18 @@ class MaplibreLayer extends MobilityLayerMixin(MapLibreLayer) {
116
117
  console.error('Error while updating MaplibreMap', e);
117
118
  }
118
119
  }
120
+ set apiKey(newValue) {
121
+ this.set('apiKey', newValue);
122
+ }
123
+ get apiKey() {
124
+ return this.get('apiKey');
125
+ }
126
+ set apiKeyName(newValue) {
127
+ this.set('apiKeyName', newValue);
128
+ }
129
+ get apiKeyName() {
130
+ return this.get('apiKeyName');
131
+ }
119
132
  get maplibreMap() {
120
133
  deprecated('MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap.');
121
134
  return this.mapLibreMap;
@@ -16,10 +16,11 @@ class VectorLayer extends Layer {
16
16
  let features = [];
17
17
  if (this.map) {
18
18
  const pixel = this.map.getPixelFromCoordinate(coordinate);
19
- features = this.map.getFeaturesAtPixel(pixel, {
20
- hitTolerance: this.hitTolerance || 5,
21
- layerFilter: (l) => l === this.olLayer,
22
- });
19
+ features =
20
+ this.map.getFeaturesAtPixel(pixel, {
21
+ hitTolerance: this.hitTolerance || 5,
22
+ layerFilter: (l) => l === this.olLayer,
23
+ }) || [];
23
24
  }
24
25
  return Promise.resolve({
25
26
  coordinate,
@@ -60,6 +60,7 @@ declare function PropertiesLayerMixin<TBase extends Layerable>(Base: TBase): {
60
60
  /** @deprecated */
61
61
  olLayer: Layer;
62
62
  /** @deprecated */
63
+ /** @deprecated */
63
64
  parent: Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>>;
64
65
  /** @deprecated */
65
66
  visible: boolean;
@@ -150,6 +150,10 @@ function PropertiesLayerMixin(Base) {
150
150
  deprecated('Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. This setter has no effect.');
151
151
  }
152
152
  /** @deprecated */
153
+ // get olListenersKeys(): EventsKey[] {
154
+ // return this.olEventsKeys;
155
+ // }
156
+ /** @deprecated */
153
157
  get parent() {
154
158
  deprecated("Layer.parent is deprecated. Use the Layer.get('parent') method instead.");
155
159
  return this.get('parent');
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mobility-toolbox-js",
3
3
  "license": "MIT",
4
4
  "description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
5
- "version": "3.0.0-beta.21",
5
+ "version": "3.0.0-beta.23",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",