proximiio-js-library 1.12.2 → 1.12.4

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.
@@ -111,6 +111,8 @@ export interface Options {
111
111
  lineColor?: string;
112
112
  lineOpacity?: number;
113
113
  lineWidth?: number;
114
+ minzoom?: number;
115
+ maxzoom?: number;
114
116
  };
115
117
  useRasterTiles?: boolean;
116
118
  rasterTilesOptions?: {
@@ -270,6 +272,7 @@ export declare class Map {
270
272
  private animateRoute;
271
273
  private updateData;
272
274
  private onRestartRouteAnimation;
275
+ private onStopRouteAnimation;
273
276
  private translateLayers;
274
277
  getClosestFeature(amenityId: string, fromFeature?: Feature): false | Feature;
275
278
  getFloorName(floor: FloorModel): string;
@@ -1065,5 +1068,20 @@ export declare class Map {
1065
1068
  * map.restartRouteAnimation();
1066
1069
  * });
1067
1070
  */
1068
- restartRouteAnimation(delay: number): void;
1071
+ restartRouteAnimation({ delay, recenter }: {
1072
+ delay: number;
1073
+ recenter?: boolean;
1074
+ }): void;
1075
+ /**
1076
+ * Method for stopping route animation
1077
+ * @memberof Map
1078
+ * @name stopRouteAnimation
1079
+ * @example
1080
+ * const map = new Proximiio.Map();
1081
+ * map.getMapReadyListener().subscribe(ready => {
1082
+ * console.log('map ready', ready);
1083
+ * map.stopRouteAnimation();
1084
+ * });
1085
+ */
1086
+ stopRouteAnimation(): void;
1069
1087
  }
@@ -175,6 +175,8 @@ export class Map {
175
175
  lineColor: '#6945ed',
176
176
  lineWidth: 5,
177
177
  lineOpacity: 0.6,
178
+ minzoom: 17,
179
+ maxzoom: 24,
178
180
  },
179
181
  useRasterTiles: false,
180
182
  handleUrlParams: false,
@@ -1093,8 +1095,8 @@ export class Map {
1093
1095
  id: 'lineAlong',
1094
1096
  type: 'line',
1095
1097
  source: 'lineAlong',
1096
- minzoom: 17,
1097
- maxzoom: 24,
1098
+ minzoom: this.defaultOptions.routeAnimation.minzoom,
1099
+ maxzoom: this.defaultOptions.routeAnimation.maxzoom,
1098
1100
  paint: {
1099
1101
  'line-width': this.defaultOptions.routeAnimation.lineWidth,
1100
1102
  'line-color': this.defaultOptions.routeAnimation.lineColor,
@@ -1113,27 +1115,27 @@ export class Map {
1113
1115
  id: 'pointAlong',
1114
1116
  type: 'symbol',
1115
1117
  source: 'pointAlong',
1116
- minzoom: 17,
1117
- maxzoom: 24,
1118
+ minzoom: this.defaultOptions.routeAnimation.minzoom,
1119
+ maxzoom: this.defaultOptions.routeAnimation.maxzoom,
1118
1120
  layout: {
1119
1121
  'icon-image': 'pointIcon',
1120
1122
  'icon-size': this.defaultOptions.routeAnimation.pointIconSize,
1121
1123
  'icon-allow-overlap': true,
1122
1124
  },
1123
- }, 'lineAlong');
1125
+ }, 'proximiio-polygons-above-paths');
1124
1126
  }
1125
1127
  else {
1126
1128
  this.state.style.addLayer({
1127
1129
  id: 'pointAlong',
1128
1130
  type: 'circle',
1129
1131
  source: 'pointAlong',
1130
- minzoom: 17,
1131
- maxzoom: 24,
1132
+ minzoom: this.defaultOptions.routeAnimation.minzoom,
1133
+ maxzoom: this.defaultOptions.routeAnimation.maxzoom,
1132
1134
  paint: {
1133
1135
  'circle-color': this.defaultOptions.routeAnimation.pointColor,
1134
1136
  'circle-radius': this.defaultOptions.routeAnimation.pointRadius,
1135
1137
  },
1136
- }, 'lineAlong');
1138
+ }, 'proximiio-polygons-above-paths');
1137
1139
  }
1138
1140
  }
1139
1141
  if (this.defaultOptions.routeAnimation.type === 'dash') {
@@ -2581,7 +2583,7 @@ export class Map {
2581
2583
  : this.state.floor.level;
2582
2584
  }
2583
2585
  }
2584
- onRestartRouteAnimation(delay) {
2586
+ onRestartRouteAnimation({ delay, recenter }) {
2585
2587
  var _a;
2586
2588
  if (this.defaultOptions.routeAnimation.type === 'point' || this.defaultOptions.routeAnimation.type === 'puck') {
2587
2589
  const route = this.routingSource.route[`path-part-${this.currentStep}`] &&
@@ -2599,17 +2601,35 @@ export class Map {
2599
2601
  type: 'FeatureCollection',
2600
2602
  features: [],
2601
2603
  });
2602
- setTimeout(() => {
2603
- this.map.jumpTo({
2604
- center: route.geometry.coordinates[0],
2605
- });
2606
- }, 100);
2604
+ if (recenter) {
2605
+ setTimeout(() => {
2606
+ this.map.jumpTo({
2607
+ center: route.geometry.coordinates[0],
2608
+ });
2609
+ }, 100);
2610
+ }
2607
2611
  this.map.setStyle(this.state.style);
2608
2612
  }
2609
2613
  setTimeout(() => {
2610
2614
  this.animateRoute();
2611
2615
  }, delay ? delay : 0);
2612
2616
  }
2617
+ onStopRouteAnimation() {
2618
+ if (this.defaultOptions.routeAnimation.type === 'point' || this.defaultOptions.routeAnimation.type === 'puck') {
2619
+ clearInterval(this.animationInterval);
2620
+ // @ts-ignore
2621
+ this.map.getSource('pointAlong').setData({
2622
+ type: 'FeatureCollection',
2623
+ features: [],
2624
+ });
2625
+ // @ts-ignore
2626
+ this.map.getSource('lineAlong').setData({
2627
+ type: 'FeatureCollection',
2628
+ features: [],
2629
+ });
2630
+ this.map.setStyle(this.state.style);
2631
+ }
2632
+ }
2613
2633
  translateLayers() {
2614
2634
  if (this.defaultOptions.isKiosk && this.defaultOptions.kioskSettings.showLabel && this.kioskPopup) {
2615
2635
  this.kioskPopup.setHTML(translations[this.defaultOptions.language].YOU_ARE_HERE);
@@ -3705,8 +3725,22 @@ export class Map {
3705
3725
  * map.restartRouteAnimation();
3706
3726
  * });
3707
3727
  */
3708
- restartRouteAnimation(delay) {
3709
- this.onRestartRouteAnimation(delay);
3728
+ restartRouteAnimation({ delay, recenter }) {
3729
+ this.onRestartRouteAnimation({ delay, recenter });
3730
+ }
3731
+ /**
3732
+ * Method for stopping route animation
3733
+ * @memberof Map
3734
+ * @name stopRouteAnimation
3735
+ * @example
3736
+ * const map = new Proximiio.Map();
3737
+ * map.getMapReadyListener().subscribe(ready => {
3738
+ * console.log('map ready', ready);
3739
+ * map.stopRouteAnimation();
3740
+ * });
3741
+ */
3742
+ stopRouteAnimation() {
3743
+ this.onStopRouteAnimation();
3710
3744
  }
3711
3745
  }
3712
3746
  /* TODO
@@ -5,11 +5,11 @@ export interface SortedPoiItemModel {
5
5
  id: string;
6
6
  geometry: Geometry;
7
7
  properties: Record<string, any>;
8
- icon: string;
9
- category: string;
8
+ icon?: string;
9
+ category?: string;
10
10
  search_query: string;
11
11
  coordinates: number[];
12
- isInside: boolean;
12
+ isInside?: boolean;
13
13
  score: number;
14
14
  foundInDescription: boolean;
15
15
  floor: FloorModel | undefined;