proximiio-js-library 1.11.13 → 1.11.15
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/README.md +10 -1
- package/lib/components/map/i18n.d.ts +4 -0
- package/lib/components/map/i18n.js +4 -0
- package/lib/components/map/main.d.ts +4 -0
- package/lib/components/map/main.js +55 -13
- package/lib/proximiio.js +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -164,7 +164,10 @@ const map = new Proximiio.Map({
|
|
|
164
164
|
coordinates: [number, number],
|
|
165
165
|
|
|
166
166
|
// Floor level of a kiosk starting point
|
|
167
|
-
level: number
|
|
167
|
+
level: number,
|
|
168
|
+
|
|
169
|
+
// Show/hide 'You are here' label under the kiosk point, default: false
|
|
170
|
+
showLabel: false
|
|
168
171
|
},
|
|
169
172
|
|
|
170
173
|
// Optional, default: false, if enabled and yours GeoJSON includes required data
|
|
@@ -296,6 +299,12 @@ const map = new Proximiio.Map({
|
|
|
296
299
|
// Optional, default: 120, higher fps = smoother animation
|
|
297
300
|
fps: 60,
|
|
298
301
|
|
|
302
|
+
// Optional, you can define icon via url to be displayed on the route instead of circular point
|
|
303
|
+
pointIconUrl: 'https://upload.wikimedia.org/wikipedia/commons/7/7c/201408_cat.png',
|
|
304
|
+
|
|
305
|
+
// Optional, default: '1', scales the original size of the icon by the provided factor
|
|
306
|
+
pointIconSize: '1',
|
|
307
|
+
|
|
299
308
|
// Optional, default: '#1d8a9f', color of the point animated along the route
|
|
300
309
|
pointColor: '#1d8a9f',
|
|
301
310
|
|
|
@@ -7,6 +7,7 @@ export declare const translations: {
|
|
|
7
7
|
UP: string;
|
|
8
8
|
DOWN: string;
|
|
9
9
|
TO_FLOOR: string;
|
|
10
|
+
YOU_ARE_HERE: string;
|
|
10
11
|
};
|
|
11
12
|
fi: {
|
|
12
13
|
ELEVATOR: string;
|
|
@@ -16,6 +17,7 @@ export declare const translations: {
|
|
|
16
17
|
UP: string;
|
|
17
18
|
DOWN: string;
|
|
18
19
|
TO_FLOOR: string;
|
|
20
|
+
YOU_ARE_HERE: string;
|
|
19
21
|
};
|
|
20
22
|
ar: {
|
|
21
23
|
ELEVATOR: string;
|
|
@@ -25,6 +27,7 @@ export declare const translations: {
|
|
|
25
27
|
UP: string;
|
|
26
28
|
DOWN: string;
|
|
27
29
|
TO_FLOOR: string;
|
|
30
|
+
YOU_ARE_HERE: string;
|
|
28
31
|
};
|
|
29
32
|
it: {
|
|
30
33
|
ELEVATOR: string;
|
|
@@ -34,5 +37,6 @@ export declare const translations: {
|
|
|
34
37
|
UP: string;
|
|
35
38
|
DOWN: string;
|
|
36
39
|
TO_FLOOR: string;
|
|
40
|
+
YOU_ARE_HERE: string;
|
|
37
41
|
};
|
|
38
42
|
};
|
|
@@ -7,6 +7,7 @@ export const translations = {
|
|
|
7
7
|
UP: 'up',
|
|
8
8
|
DOWN: 'down',
|
|
9
9
|
TO_FLOOR: 'to floor',
|
|
10
|
+
YOU_ARE_HERE: 'You are here',
|
|
10
11
|
},
|
|
11
12
|
fi: {
|
|
12
13
|
ELEVATOR: 'Hissi',
|
|
@@ -16,6 +17,7 @@ export const translations = {
|
|
|
16
17
|
UP: 'ylös',
|
|
17
18
|
DOWN: 'alas',
|
|
18
19
|
TO_FLOOR: 'kerrokseen',
|
|
20
|
+
YOU_ARE_HERE: 'Olet täällä',
|
|
19
21
|
},
|
|
20
22
|
ar: {
|
|
21
23
|
ELEVATOR: 'المصعد',
|
|
@@ -25,6 +27,7 @@ export const translations = {
|
|
|
25
27
|
UP: 'صعوداً',
|
|
26
28
|
DOWN: 'هبوطاً',
|
|
27
29
|
TO_FLOOR: 'إلى الطابق',
|
|
30
|
+
YOU_ARE_HERE: 'أنت هنا',
|
|
28
31
|
},
|
|
29
32
|
it: {
|
|
30
33
|
ELEVATOR: 'Ascensore',
|
|
@@ -34,5 +37,6 @@ export const translations = {
|
|
|
34
37
|
UP: 'su',
|
|
35
38
|
DOWN: 'giù',
|
|
36
39
|
TO_FLOOR: 'al piano',
|
|
40
|
+
YOU_ARE_HERE: 'Tu sei qui',
|
|
37
41
|
},
|
|
38
42
|
};
|
|
@@ -67,6 +67,7 @@ export interface Options {
|
|
|
67
67
|
kioskSettings?: {
|
|
68
68
|
coordinates: [number, number];
|
|
69
69
|
level: number;
|
|
70
|
+
showLabel?: boolean;
|
|
70
71
|
};
|
|
71
72
|
initPolygons?: boolean;
|
|
72
73
|
polygonsOptions?: PolygonOptions;
|
|
@@ -87,6 +88,8 @@ export interface Options {
|
|
|
87
88
|
duration?: number;
|
|
88
89
|
durationMultiplier?: number;
|
|
89
90
|
fps?: number;
|
|
91
|
+
pointIconUrl?: string;
|
|
92
|
+
pointIconSize?: number;
|
|
90
93
|
pointColor?: string;
|
|
91
94
|
pointRadius?: number;
|
|
92
95
|
lineColor?: string;
|
|
@@ -237,6 +240,7 @@ export declare class Map {
|
|
|
237
240
|
private step;
|
|
238
241
|
private animateRoute;
|
|
239
242
|
private updateData;
|
|
243
|
+
private translateLayers;
|
|
240
244
|
getClosestFeature(amenityId: string, fromFeature?: Feature): false | Feature;
|
|
241
245
|
getFloorName(floor: FloorModel): string;
|
|
242
246
|
/**
|
|
@@ -157,6 +157,7 @@ export class Map {
|
|
|
157
157
|
followRoute: true,
|
|
158
158
|
durationMultiplier: 30,
|
|
159
159
|
fps: 120,
|
|
160
|
+
pointIconSize: 1,
|
|
160
161
|
pointColor: '#1d8a9f',
|
|
161
162
|
pointRadius: 8,
|
|
162
163
|
lineColor: '#6945ed',
|
|
@@ -563,6 +564,16 @@ export class Map {
|
|
|
563
564
|
if (this.defaultOptions.animatedRoute) {
|
|
564
565
|
console.log(`animatedRoute property is deprecated, please use routeAnimation.enabled instead!`);
|
|
565
566
|
}
|
|
567
|
+
if (this.defaultOptions.routeAnimation.pointIconUrl) {
|
|
568
|
+
map.loadImage(this.defaultOptions.routeAnimation.pointIconUrl, (error, image) => {
|
|
569
|
+
if (error) {
|
|
570
|
+
console.error(error);
|
|
571
|
+
}
|
|
572
|
+
if (image) {
|
|
573
|
+
map.addImage('pointIcon', image);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
566
577
|
this.initAnimatedRoute();
|
|
567
578
|
}
|
|
568
579
|
if (this.defaultOptions.hiddenAmenities) {
|
|
@@ -642,7 +653,7 @@ export class Map {
|
|
|
642
653
|
features: [this.startPoint],
|
|
643
654
|
},
|
|
644
655
|
});
|
|
645
|
-
|
|
656
|
+
let kioskLayer = {
|
|
646
657
|
id: 'my-location-layer',
|
|
647
658
|
type: 'symbol',
|
|
648
659
|
source: 'my-location',
|
|
@@ -650,7 +661,14 @@ export class Map {
|
|
|
650
661
|
'icon-image': 'pulsing-dot',
|
|
651
662
|
},
|
|
652
663
|
filter: ['all', ['==', ['to-number', ['get', 'level']], this.state.floor.level]],
|
|
653
|
-
}
|
|
664
|
+
};
|
|
665
|
+
if (this.defaultOptions.kioskSettings.showLabel) {
|
|
666
|
+
kioskLayer = Object.assign(Object.assign({}, kioskLayer), { layout: Object.assign(Object.assign({}, kioskLayer.layout), { 'text-field': translations[this.defaultOptions.language].YOU_ARE_HERE, 'text-font': ['Amiri Bold'], 'text-offset': [0, 0.6], 'text-anchor': 'top', 'text-allow-overlap': true, 'text-size': 18 }), paint: {
|
|
667
|
+
'text-halo-width': 1,
|
|
668
|
+
'text-halo-color': '#ffffff',
|
|
669
|
+
} });
|
|
670
|
+
}
|
|
671
|
+
this.state.style.addLayer(kioskLayer);
|
|
654
672
|
this.centerOnPoi(this.startPoint);
|
|
655
673
|
}
|
|
656
674
|
}
|
|
@@ -914,17 +932,33 @@ export class Map {
|
|
|
914
932
|
features: [],
|
|
915
933
|
},
|
|
916
934
|
});
|
|
917
|
-
this.
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
935
|
+
if (this.defaultOptions.routeAnimation.pointIconUrl) {
|
|
936
|
+
this.state.style.addLayer({
|
|
937
|
+
id: 'pointAlong',
|
|
938
|
+
type: 'symbol',
|
|
939
|
+
source: 'pointAlong',
|
|
940
|
+
minzoom: 17,
|
|
941
|
+
maxzoom: 24,
|
|
942
|
+
layout: {
|
|
943
|
+
'icon-image': 'pointIcon',
|
|
944
|
+
'icon-size': this.defaultOptions.routeAnimation.pointIconSize,
|
|
945
|
+
'icon-allow-overlap': true,
|
|
946
|
+
},
|
|
947
|
+
}, 'lineAlong');
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
this.state.style.addLayer({
|
|
951
|
+
id: 'pointAlong',
|
|
952
|
+
type: 'circle',
|
|
953
|
+
source: 'pointAlong',
|
|
954
|
+
minzoom: 17,
|
|
955
|
+
maxzoom: 24,
|
|
956
|
+
paint: {
|
|
957
|
+
'circle-color': this.defaultOptions.routeAnimation.pointColor,
|
|
958
|
+
'circle-radius': this.defaultOptions.routeAnimation.pointRadius,
|
|
959
|
+
},
|
|
960
|
+
}, 'lineAlong');
|
|
961
|
+
}
|
|
928
962
|
}
|
|
929
963
|
if (this.defaultOptions.routeAnimation.type === 'dash') {
|
|
930
964
|
if (this.state.style.getLayer('proximiio-routing-line-remaining')) {
|
|
@@ -2173,6 +2207,13 @@ export class Map {
|
|
|
2173
2207
|
: this.state.floor.level;
|
|
2174
2208
|
}
|
|
2175
2209
|
}
|
|
2210
|
+
translateLayers() {
|
|
2211
|
+
if (this.defaultOptions.isKiosk &&
|
|
2212
|
+
this.defaultOptions.kioskSettings.showLabel &&
|
|
2213
|
+
this.map.getLayer('my-location-layer')) {
|
|
2214
|
+
this.map.setLayoutProperty('my-location-layer', 'text-field', translations[this.defaultOptions.language].YOU_ARE_HERE);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2176
2217
|
getClosestFeature(amenityId, fromFeature) {
|
|
2177
2218
|
let sameLevelfeatures = this.state.allFeatures.features.filter((i) => i.properties.amenity === amenityId &&
|
|
2178
2219
|
i.geometry.type === 'Point' &&
|
|
@@ -2248,6 +2289,7 @@ export class Map {
|
|
|
2248
2289
|
setLanguage(language) {
|
|
2249
2290
|
this.defaultOptions.language = language;
|
|
2250
2291
|
this.onFeaturesChange();
|
|
2292
|
+
this.translateLayers();
|
|
2251
2293
|
}
|
|
2252
2294
|
/**
|
|
2253
2295
|
* This method will set an active place, load floors etc. Have to be called after map is ready, see getMapReadyListener.
|