mobility-toolbox-js 2.0.0-beta.69 → 2.0.0-beta.71
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/api/RealtimeAPI.d.ts +1 -1
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +5 -3
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -1
- package/common/styles/realtimeDefaultStyle.js +9 -3
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -1
- package/common/styles/realtimeSimpleStyle.js +3 -4
- package/common/utils/createCanvas.js +1 -1
- package/common/utils/getVehiclePosition.d.ts.map +1 -1
- package/common/utils/getVehiclePosition.js +10 -5
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.d.ts.map +1 -1
- package/common/utils/realtimeConfig.js +3 -3
- package/mapbox/layers/RealtimeLayer.d.ts +4 -8
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +6541 -5901
- package/mbt.js.map +4 -4
- package/mbt.min.js +20 -20
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts.map +1 -1
- package/ol/controls/RoutingControl.js +4 -9
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +12 -1
- package/package.json +49 -87
- package/setupTests.js +3 -0
- package/types/common.d.ts +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoutingControl.d.ts","sourceRoot":"","sources":["../../../src/ol/controls/RoutingControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,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YV,MAAM;CACP;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -6,7 +6,6 @@ import { click } from 'ol/events/condition';
|
|
|
6
6
|
import { GeoJSON } from 'ol/format';
|
|
7
7
|
import { buffer } from 'ol/extent';
|
|
8
8
|
import { fromLonLat, toLonLat } from 'ol/proj';
|
|
9
|
-
import GeomType from 'ol/geom/GeometryType';
|
|
10
9
|
import BaseEvent from 'ol/events/Event';
|
|
11
10
|
import { RoutingAPI } from '../../api';
|
|
12
11
|
import ControlCommon from '../../common/controls/ControlCommon';
|
|
@@ -450,7 +449,7 @@ class RoutingControl extends ControlCommon {
|
|
|
450
449
|
const feats = evt.target.getFeaturesAtPixel(evt.pixel);
|
|
451
450
|
const viaPoint = feats.find((feat) => {
|
|
452
451
|
var _a;
|
|
453
|
-
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) ===
|
|
452
|
+
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point' &&
|
|
454
453
|
feat.get('viaPointIdx') !== undefined;
|
|
455
454
|
});
|
|
456
455
|
if (viaPoint) {
|
|
@@ -471,7 +470,7 @@ class RoutingControl extends ControlCommon {
|
|
|
471
470
|
let segmentIndex = -1;
|
|
472
471
|
const route = evt.features
|
|
473
472
|
.getArray()
|
|
474
|
-
.find((feat) => { var _a; return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) ===
|
|
473
|
+
.find((feat) => { var _a; return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'LineString'; });
|
|
475
474
|
// Find the segment index that is being modified
|
|
476
475
|
if (route && route.getGeometry() && evt.mapBrowserEvent.coordinate) {
|
|
477
476
|
// We use a buff extent to fix floating issues , see https://github.com/openlayers/openlayers/issues/7130#issuecomment-535856422
|
|
@@ -483,7 +482,7 @@ class RoutingControl extends ControlCommon {
|
|
|
483
482
|
// Find the viaPoint that is being modified
|
|
484
483
|
const viaPoint = (evt.features
|
|
485
484
|
.getArray()
|
|
486
|
-
.filter((feat) => { var _a; return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) ===
|
|
485
|
+
.filter((feat) => { var _a; return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point'; }) ||
|
|
487
486
|
[])[0];
|
|
488
487
|
// Write object with modify info
|
|
489
488
|
/** @ignore */
|
|
@@ -553,11 +552,7 @@ class RoutingControl extends ControlCommon {
|
|
|
553
552
|
const feats = e.target.getFeaturesAtPixel(e.pixel, {
|
|
554
553
|
hitTolerance: 5,
|
|
555
554
|
});
|
|
556
|
-
const viaPoint = feats.find((feat) => {
|
|
557
|
-
var _a;
|
|
558
|
-
return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === GeomType.POINT &&
|
|
559
|
-
feat.get('index');
|
|
560
|
-
});
|
|
555
|
+
const viaPoint = feats.find((feat) => { var _a; return ((_a = feat.getGeometry()) === null || _a === void 0 ? void 0 : _a.getType()) === 'Point' && feat.get('index'); });
|
|
561
556
|
if (click(e) && viaPoint) {
|
|
562
557
|
// Remove node & viaPoint if an existing viaPoint was clicked
|
|
563
558
|
this.removeViaPoint(viaPoint.get('index'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeLayer.d.ts","sourceRoot":"","sources":["../../../src/ol/layers/RealtimeLayer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAKxC,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAc,EACZ,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,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;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU;IAWxB;;;;OAIG;IACH,eAAe,CACb,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACxC,IAAI,EAAE,MAAM;IAed;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM;IAUhE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,EAAE,eAAe;IAmBvC;;;;OAIG;IACH,KAAK,CAAC,UAAU,EAAE,sBAAsB;CAGzC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -156,9 +156,14 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
const view = this.map.getView();
|
|
159
|
+
// it could happen that the view is set but without center yet,
|
|
160
|
+
// so the calcualteExtent will trigger an error.
|
|
161
|
+
if (!view.getCenter()) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
159
164
|
super.renderTrajectories({
|
|
160
165
|
size: this.map.getSize(),
|
|
161
|
-
center:
|
|
166
|
+
center: view.getCenter(),
|
|
162
167
|
extent: view.calculateExtent(),
|
|
163
168
|
resolution: view.getResolution(),
|
|
164
169
|
rotation: view.getRotation(),
|
|
@@ -281,6 +286,12 @@ class RealtimeLayer extends mixin(Layer) {
|
|
|
281
286
|
* @private
|
|
282
287
|
*/
|
|
283
288
|
purgeTrajectory(trajectory, extent, zoom) {
|
|
289
|
+
const center = this.map.getView().getCenter();
|
|
290
|
+
if (!extent && !center) {
|
|
291
|
+
// In that case the view is not zoomed yet so we can't calculate the extent of the map,
|
|
292
|
+
// it will trigger a js error on calculateExtent function.
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
284
295
|
return super.purgeTrajectory(trajectory, extent || this.map.getView().calculateExtent(), zoom || this.map.getView().getZoom());
|
|
285
296
|
}
|
|
286
297
|
/**
|
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
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": "2.0.0-beta.
|
|
5
|
+
"version": "2.0.0-beta.71",
|
|
6
|
+
"homepage": "https://mobility-toolbox-js.geops.io/",
|
|
6
7
|
"module": "index.js",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./index.js",
|
|
@@ -12,14 +13,11 @@
|
|
|
12
13
|
"./types": "./types/index.d.ts"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@turf/helpers": "
|
|
16
|
-
"@turf/transform-rotate": "
|
|
17
|
-
"@types/lodash": "^4.14.185",
|
|
16
|
+
"@turf/helpers": "6.5.0",
|
|
17
|
+
"@turf/transform-rotate": "6.5.0",
|
|
18
18
|
"lodash.debounce": "4.0.8",
|
|
19
19
|
"lodash.throttle": "4.1.1",
|
|
20
|
-
"
|
|
21
|
-
"turf": "^3.0.14",
|
|
22
|
-
"uuid": "8.3.2"
|
|
20
|
+
"uuid": "9.0.0"
|
|
23
21
|
},
|
|
24
22
|
"peerDependencies": {
|
|
25
23
|
"mapbox-gl": "1.13.2",
|
|
@@ -27,73 +25,63 @@
|
|
|
27
25
|
"ol": "6.14.1"
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@types/
|
|
38
|
-
"@types/
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"@types/mapbox-gl": "^2.7.5",
|
|
43
|
-
"@types/offscreencanvas": "^2019.7.0",
|
|
44
|
-
"@types/topojson": "^3.2.3",
|
|
45
|
-
"@types/uuid": "^8.3.4",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
47
|
-
"@typescript-eslint/parser": "^5.30.5",
|
|
48
|
-
"autoprefixer": "9.7.6",
|
|
49
|
-
"cypress": "9.4.1",
|
|
28
|
+
"@commitlint/cli": "17.2.0",
|
|
29
|
+
"@commitlint/config-conventional": "17.2.0",
|
|
30
|
+
"@types/geojson": "7946.0.10",
|
|
31
|
+
"@types/lodash.debounce": "4.0.7",
|
|
32
|
+
"@types/lodash.throttle": "4.1.7",
|
|
33
|
+
"@types/mapbox-gl": "2.7.8",
|
|
34
|
+
"@types/offscreencanvas": "2019.7.0",
|
|
35
|
+
"@types/topojson": "3.2.3",
|
|
36
|
+
"@types/uuid": "8.3.4",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "5.43.0",
|
|
38
|
+
"@typescript-eslint/parser": "5.43.0",
|
|
39
|
+
"cypress": "11.1.0",
|
|
50
40
|
"deepmerge": "4.2.2",
|
|
51
|
-
"esbuild": "
|
|
52
|
-
"esbuild-jest": "
|
|
41
|
+
"esbuild": "0.15.14",
|
|
42
|
+
"esbuild-jest": "0.5.0",
|
|
53
43
|
"esdoc": "1.1.0",
|
|
54
44
|
"esdoc-ecmascript-proposal-plugin": "1.0.0",
|
|
55
45
|
"esdoc-publish-html-plugin": "1.1.2",
|
|
56
46
|
"esdoc-standard-plugin": "1.0.0",
|
|
57
|
-
"esdoc-typescript-plugin": "
|
|
58
|
-
"eslint": "8.
|
|
47
|
+
"esdoc-typescript-plugin": "1.0.1",
|
|
48
|
+
"eslint": "8.27.0",
|
|
59
49
|
"eslint-config-airbnb": "19.0.4",
|
|
60
|
-
"eslint-config-airbnb-typescript": "
|
|
61
|
-
"eslint-config-prettier": "8.
|
|
50
|
+
"eslint-config-airbnb-typescript": "17.0.0",
|
|
51
|
+
"eslint-config-prettier": "8.5.0",
|
|
62
52
|
"eslint-plugin-cypress": "2.12.1",
|
|
63
|
-
"eslint-plugin-import": "2.
|
|
53
|
+
"eslint-plugin-import": "2.26.0",
|
|
64
54
|
"eslint-plugin-jsx-a11y": "6.6.1",
|
|
65
|
-
"eslint-plugin-prettier": "4.
|
|
66
|
-
"eslint-plugin-react": "
|
|
67
|
-
"fixpack": "
|
|
68
|
-
"husky": "8.0.
|
|
69
|
-
"
|
|
70
|
-
"jest
|
|
55
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
56
|
+
"eslint-plugin-react": "7.31.10",
|
|
57
|
+
"fixpack": "4.0.0",
|
|
58
|
+
"husky": "8.0.2",
|
|
59
|
+
"is-ci": "3.0.1",
|
|
60
|
+
"jest": "29.3.1",
|
|
61
|
+
"jest-canvas-mock": "2.4.0",
|
|
62
|
+
"jest-environment-jsdom": "29.3.1",
|
|
71
63
|
"jest-fetch-mock": "3.0.3",
|
|
72
64
|
"jest-serializer-html": "7.1.0",
|
|
73
|
-
"jest-transformer-svg": "
|
|
74
|
-
"jest-websocket-mock": "2.
|
|
75
|
-
"lint-staged": "
|
|
65
|
+
"jest-transformer-svg": "2.0.0",
|
|
66
|
+
"jest-websocket-mock": "2.4.0",
|
|
67
|
+
"lint-staged": "13.0.3",
|
|
76
68
|
"mapbox-gl": "1.13.2",
|
|
77
69
|
"maplibre-gl": "2.4.0",
|
|
78
70
|
"mock-socket": "9.1.5",
|
|
79
71
|
"next": "12.1.6",
|
|
80
|
-
"next-transpile-modules": "
|
|
72
|
+
"next-transpile-modules": "10.0.0",
|
|
81
73
|
"ol": "6.14.1",
|
|
82
|
-
"openapi-typescript": "
|
|
83
|
-
"
|
|
84
|
-
"postcss-loader": "3.0.0",
|
|
85
|
-
"prettier": "2.5.1",
|
|
74
|
+
"openapi-typescript": "6.0.3",
|
|
75
|
+
"prettier": "2.7.1",
|
|
86
76
|
"raw-loader": "4.0.2",
|
|
87
|
-
"sass": "1.52.2",
|
|
88
|
-
"sass-loader": "8.0.2",
|
|
89
77
|
"sort-json": "2.0.1",
|
|
90
78
|
"standard-version": "9.5.0",
|
|
91
79
|
"start-server-and-test": "1.14.0",
|
|
92
|
-
"stylelint": "14.
|
|
93
|
-
"stylelint-config-recommended-scss": "
|
|
94
|
-
"stylelint-config-standard": "
|
|
95
|
-
"stylelint-scss": "4.
|
|
96
|
-
"typescript": "
|
|
80
|
+
"stylelint": "14.15.0",
|
|
81
|
+
"stylelint-config-recommended-scss": "8.0.0",
|
|
82
|
+
"stylelint-config-standard": "29.0.0",
|
|
83
|
+
"stylelint-scss": "4.3.0",
|
|
84
|
+
"typescript": "4.7.4"
|
|
97
85
|
},
|
|
98
86
|
"scripts": {
|
|
99
87
|
"apidoc": "esdoc && cp apidoc/index.json doc/src/components/Esdoc",
|
|
@@ -105,8 +93,8 @@
|
|
|
105
93
|
"cy:test:chrome": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser chrome'",
|
|
106
94
|
"cy:test:edge": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser edge'",
|
|
107
95
|
"cy:test:firefox": "yarn build && start-server-and-test start http://localhost:3000 'cypress run --browser firefox'",
|
|
108
|
-
"dev": "rm -rf .next && yarn doc && yarn dev:examples",
|
|
109
|
-
"dev:examples": "rm -rf .next && cd doc && yarn dev",
|
|
96
|
+
"dev": "rm -rf .next && rm -rf doc/.next && yarn doc && yarn dev:examples",
|
|
97
|
+
"dev:examples": "rm -rf .next && rm -rf doc/.next && yarn build && cd build && yarn link && cd ../doc && yarn link mobility-toolbox-js && yarn dev",
|
|
110
98
|
"doc": "yarn build && yarn apidoc && cd doc && rm -rf .next && rm -rf node_modules/mobility-toolbox-js && yarn install --force && yarn build",
|
|
111
99
|
"esbuild": "yarn esbuild:all && yarn esbuild:iife",
|
|
112
100
|
"esbuild:all": "esbuild src/index.js src/**/*.js src/**/*.ts src/**/**/*.js src/**/**/*.ts --target=chrome100 --outdir=build/ --loader:.js=jsx",
|
|
@@ -114,18 +102,19 @@
|
|
|
114
102
|
"esbuild:iife:base": "esbuild src/iife.js --bundle --sourcemap --target=chrome100",
|
|
115
103
|
"esbuild:iife:minify": "yarn esbuild:iife:base --minify --outfile=build/mbt.min.js",
|
|
116
104
|
"esbuild:iife:unminify": "yarn esbuild:iife:base --outfile=build/mbt.js",
|
|
117
|
-
"format": "prettier --write 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix",
|
|
105
|
+
"format": "prettier --write 'src/**/*.js' && eslint 'src/**/*.js' --fix && stylelint 'src/**/*.css' 'src/**/*.scss' --fix --allow-empty-input",
|
|
118
106
|
"lib": "REACT_APP_LIB_MODE=1 webpack --mode production",
|
|
119
107
|
"lib:dev": "REACT_APP_LIB_MODE=1 webpack --mode development",
|
|
120
108
|
"link2": "cmdToAdd=$(node ./scripts/read-pkg-json.js add) && $cmdToAdd && yarn build && cmdToRemove=$(node ./scripts/read-pkg-json.js remove) && $cmdToRemove && cd build && yarn link",
|
|
121
109
|
"lint": "eslint src/**/*.js src/**/*.ts && stylelint src/**/*.css src/**/*.scss --allow-empty-input",
|
|
110
|
+
"prepare": "is-ci || husky install",
|
|
122
111
|
"publish:beta": "HUSKY=0 yarn release -- --prerelease beta --skip.changelog && git push origin HEAD && yarn run build && cd build && HUSKY=0 yarn publish --tag beta && git push --tags ",
|
|
123
112
|
"publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
|
|
124
113
|
"publish:public:dryrun": "yarn release --dry-run",
|
|
125
114
|
"release": "standard-version",
|
|
126
115
|
"start": "yarn doc && cd doc && yarn start",
|
|
127
116
|
"start:examples": "cd doc && yarn build && yarn start",
|
|
128
|
-
"test": "TZ='UTC' jest",
|
|
117
|
+
"test": "TZ='UTC' jest ",
|
|
129
118
|
"test:watch": "yarn test --watchAll",
|
|
130
119
|
"tsc": "tsc",
|
|
131
120
|
"types:backend": "openapi-typescript https://developer.geops.io/swagger/routing.json --output src/types/routing.d.ts && openapi-typescript https://developer.geops.io/swagger/stops.json --output src/types/stops.d.ts"
|
|
@@ -141,36 +130,9 @@
|
|
|
141
130
|
"mobility",
|
|
142
131
|
"toolbox"
|
|
143
132
|
],
|
|
144
|
-
"lint-staged": {
|
|
145
|
-
"(src|__mocks__)/**/*.js": [
|
|
146
|
-
"eslint --fix",
|
|
147
|
-
"prettier --write",
|
|
148
|
-
"git add",
|
|
149
|
-
"yarn test --bail --findRelatedTests"
|
|
150
|
-
],
|
|
151
|
-
"package.json": [
|
|
152
|
-
"fixpack --sortToTop name --sortToTop license --sortToTop description --sortToTop version --sortToTop author --sortToTop main --sortToTop module --sortToTop files --sortToTop exports --sortToTop proxy --sortToTop dependencies --sortToTop peerDependencies --sortToTop devDependencies --sortToTop resolutions --sortToTop scripts"
|
|
153
|
-
],
|
|
154
|
-
"src/**/*.{css,scss}": [
|
|
155
|
-
"stylelint --fix --allow-empty-input"
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
"prettier": {
|
|
159
|
-
"trailingComma": "all",
|
|
160
|
-
"singleQuote": true
|
|
161
|
-
},
|
|
162
133
|
"repository": {
|
|
163
134
|
"type": "git",
|
|
164
135
|
"url": "https://github.com/geops/mobility-toolbox-js"
|
|
165
136
|
},
|
|
166
|
-
"sideEffects": false
|
|
167
|
-
"stylelint": {
|
|
168
|
-
"plugins": [
|
|
169
|
-
"stylelint-scss"
|
|
170
|
-
],
|
|
171
|
-
"extends": [
|
|
172
|
-
"stylelint-config-standard",
|
|
173
|
-
"stylelint-config-recommended-scss"
|
|
174
|
-
]
|
|
175
|
-
}
|
|
137
|
+
"sideEffects": false
|
|
176
138
|
}
|
package/setupTests.js
CHANGED
|
@@ -11,3 +11,6 @@ global.fetchTrajectoryStationsResponse = fetchTrajectoryStationsResponse;
|
|
|
11
11
|
global.stopsSearchResponse = stopsSearchResponse;
|
|
12
12
|
global.fetchRouteResponse = fetchRouteResponse;
|
|
13
13
|
global.URL.createObjectURL = jest.fn(() => 'fooblob');
|
|
14
|
+
window.OffscreenCanvas = () => {
|
|
15
|
+
return document.createElement('canvas');
|
|
16
|
+
};
|
package/types/common.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Feature } from 'ol';
|
|
|
2
2
|
import { Coordinate } from 'ol/coordinate';
|
|
3
3
|
import { ObjectEvent } from 'ol/Object';
|
|
4
4
|
import { Pixel } from 'ol/pixel';
|
|
5
|
-
import type { RealtimeTrainId } from './realtime';
|
|
5
|
+
import type { RealtimeMot, RealtimeTrainId } from './realtime';
|
|
6
6
|
import type {
|
|
7
7
|
CopyrightControl as MbCopyrightControl,
|
|
8
8
|
RealtimeLayer as MbRealtimeLayer,
|
|
@@ -40,17 +40,17 @@ export type RealtimeStyleOptions = {
|
|
|
40
40
|
delayDisplay?: number;
|
|
41
41
|
noInterpolate?: boolean;
|
|
42
42
|
filter?: FilterFunction;
|
|
43
|
-
getRadius?: (type:
|
|
44
|
-
getBgColor?: (type:
|
|
43
|
+
getRadius?: (type: RealtimeMot, z: number) => number;
|
|
44
|
+
getBgColor?: (type: RealtimeMot) => string;
|
|
45
45
|
getDelayColor?: (
|
|
46
46
|
delay: number | null,
|
|
47
47
|
cancelled?: boolean,
|
|
48
48
|
isDelayText?: boolean,
|
|
49
49
|
) => string;
|
|
50
50
|
getDelayText?: (delay: number | null, cancelled?: boolean) => string;
|
|
51
|
-
getTextColor?: (type:
|
|
51
|
+
getTextColor?: (type: RealtimeMot) => string;
|
|
52
52
|
getTextSize?: (
|
|
53
|
-
ctx: AnyCanvasContext
|
|
53
|
+
ctx: AnyCanvasContext,
|
|
54
54
|
markerSize: number,
|
|
55
55
|
name: string,
|
|
56
56
|
fontSize: number,
|