mobility-toolbox-js 3.1.0-beta.2 → 3.1.1-beta.0
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 +18 -4
- package/mbt.js.map +2 -2
- package/mbt.min.js +11 -11
- package/mbt.min.js.map +3 -3
- package/ol/layers/Layer.d.ts +1 -3
- package/ol/layers/MaplibreStyleLayer.d.ts +2 -1
- package/ol/layers/MaplibreStyleLayer.js +21 -5
- package/ol/layers/RealtimeLayer.d.ts +2 -1
- package/package.json +5 -5
package/ol/layers/Layer.d.ts
CHANGED
|
@@ -11,9 +11,7 @@ export type MobilityLayerOptions = {
|
|
|
11
11
|
key?: string;
|
|
12
12
|
map?: Map;
|
|
13
13
|
name?: string;
|
|
14
|
-
|
|
15
|
-
visible?: boolean;
|
|
16
|
-
} & Options & Record<string, any>;
|
|
14
|
+
} & Options & Record<string, unknown>;
|
|
17
15
|
/**
|
|
18
16
|
* An OpenLayers layer here only for backward compatibility v2.
|
|
19
17
|
* @deprecated Use an OpenLayers Layer instead.
|
|
@@ -7,6 +7,7 @@ import { ObjectEvent } from 'ol/Object';
|
|
|
7
7
|
import { FilterFunction } from '../../common/typedefs';
|
|
8
8
|
import { LayerGetFeatureInfoResponse } from '../../types';
|
|
9
9
|
import MaplibreStyleLayerRenderer from '../renderers/MaplibreStyleLayerRenderer';
|
|
10
|
+
import { MobilityLayerOptions } from './Layer';
|
|
10
11
|
import MaplibreLayer, { MaplibreLayerOptions } from './MaplibreLayer';
|
|
11
12
|
export type MaplibreStyleLayerOptions = {
|
|
12
13
|
beforeId?: string;
|
|
@@ -14,7 +15,7 @@ export type MaplibreStyleLayerOptions = {
|
|
|
14
15
|
layersFilter?: FilterFunction;
|
|
15
16
|
maplibreLayer?: MaplibreLayer;
|
|
16
17
|
queryRenderedLayersFilter?: FilterFunction;
|
|
17
|
-
} & MaplibreLayerOptions;
|
|
18
|
+
} & MaplibreLayerOptions & MobilityLayerOptions;
|
|
18
19
|
/**
|
|
19
20
|
* Layer that helps show/hide a specific subset of style layers of a [MaplibreLayer](./MaplibreLayer.js~MaplibreLayer.html).
|
|
20
21
|
*
|
|
@@ -128,7 +128,7 @@ class MaplibreStyleLayer extends Layer {
|
|
|
128
128
|
/** Manage renamed property for backward compatibility with v2 */
|
|
129
129
|
if (options.mapboxLayer) {
|
|
130
130
|
deprecated('options.mapboxLayer is deprecated. Use options.maplibreLayer instead.');
|
|
131
|
-
//
|
|
131
|
+
// @ts-expect-error - mapboxLayer is deprecated
|
|
132
132
|
options.maplibreLayer = options.mapboxLayer;
|
|
133
133
|
// eslint-disable-next-line no-param-reassign
|
|
134
134
|
delete options.mapboxLayer;
|
|
@@ -209,12 +209,28 @@ class MaplibreStyleLayer extends Layer {
|
|
|
209
209
|
for (let i = 0; i < layers.length; i += 1) {
|
|
210
210
|
const layer = layers[i];
|
|
211
211
|
if (this.layersFilter(layer)) {
|
|
212
|
-
const { id } = layer;
|
|
212
|
+
const { id, maxzoom, minzoom } = layer;
|
|
213
213
|
if (mapLibreMap.getLayer(id)) {
|
|
214
214
|
mapLibreMap.setLayoutProperty(id, 'visibility', visibilityValue);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
this.getMaxZoom()
|
|
215
|
+
// If minZoom and maxZoom are not set, their values are -Infinity and Infinity
|
|
216
|
+
if (this.getMinZoom() !== -Infinity ||
|
|
217
|
+
this.getMaxZoom() !== Infinity) {
|
|
218
|
+
let minZoom = this.getMinZoom() || 0;
|
|
219
|
+
if (minZoom === -Infinity) {
|
|
220
|
+
minZoom = (minzoom || 0) + 1;
|
|
221
|
+
}
|
|
222
|
+
if (minZoom === 0) {
|
|
223
|
+
minZoom = 1;
|
|
224
|
+
}
|
|
225
|
+
let maxZoom = this.getMaxZoom() || 0;
|
|
226
|
+
if (maxZoom === Infinity) {
|
|
227
|
+
maxZoom = (maxzoom || 24) + 1;
|
|
228
|
+
}
|
|
229
|
+
if (maxZoom === 0) {
|
|
230
|
+
maxZoom = 1;
|
|
231
|
+
}
|
|
232
|
+
mapLibreMap.setLayerZoomRange(id, minZoom - 1, // Maplibre zoom = ol zoom - 1
|
|
233
|
+
maxZoom - 1);
|
|
218
234
|
}
|
|
219
235
|
}
|
|
220
236
|
}
|
|
@@ -12,11 +12,12 @@ import RealtimeEngine, { RealtimeEngineOptions } from '../../common/utils/Realti
|
|
|
12
12
|
import { RealtimeAPI } from '../../maplibre';
|
|
13
13
|
import { RealtimeMode, RealtimeRenderState, RealtimeStopSequence, RealtimeTrainId, ViewState } from '../../types';
|
|
14
14
|
import RealtimeLayerRenderer from '../renderers/RealtimeLayerRenderer';
|
|
15
|
+
import { MobilityLayerOptions } from './Layer';
|
|
15
16
|
export type RealtimeLayerOptions = {
|
|
16
17
|
allowRenderWhenAnimating?: boolean;
|
|
17
18
|
fullTrajectoryStyle?: (feature: FeatureLike, resolution: number, options: any) => void;
|
|
18
19
|
maxNbFeaturesRequested?: number;
|
|
19
|
-
} & RealtimeEngineOptions;
|
|
20
|
+
} & MobilityLayerOptions & RealtimeEngineOptions;
|
|
20
21
|
/**
|
|
21
22
|
* An OpenLayers layer able to display data from the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
22
23
|
*
|
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.1.
|
|
5
|
+
"version": "3.1.1-beta.0",
|
|
6
6
|
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@babel/preset-env": "^7.26.0",
|
|
28
28
|
"@babel/preset-typescript": "^7.26.0",
|
|
29
|
-
"@commitlint/cli": "19.6.
|
|
29
|
+
"@commitlint/cli": "19.6.1",
|
|
30
30
|
"@commitlint/config-conventional": "19.6.0",
|
|
31
31
|
"@geops/eslint-config-react": "^1.3.2",
|
|
32
32
|
"@types/geojson": "7946.0.15",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@types/offscreencanvas": "2019.7.3",
|
|
38
38
|
"@types/topojson": "3.2.6",
|
|
39
39
|
"@types/uuid": "10.0.0",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "8.18.
|
|
41
|
-
"@typescript-eslint/parser": "8.18.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "8.18.1",
|
|
41
|
+
"@typescript-eslint/parser": "8.18.1",
|
|
42
42
|
"cypress": "13.16.1",
|
|
43
43
|
"esbuild": "0.24.0",
|
|
44
44
|
"esdoc": "1.1.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"sort-json": "2.0.1",
|
|
78
78
|
"standard-version": "9.5.0",
|
|
79
79
|
"start-server-and-test": "2.0.9",
|
|
80
|
-
"stylelint": "16.
|
|
80
|
+
"stylelint": "16.12.0",
|
|
81
81
|
"stylelint-config-recommended-scss": "14.1.0",
|
|
82
82
|
"stylelint-config-standard": "36.0.1",
|
|
83
83
|
"stylelint-scss": "6.10.0",
|