proximiio-js-library 1.6.2 → 1.6.3

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 CHANGED
@@ -119,6 +119,7 @@ const map = new Proximiio.Map({
119
119
  initPolygons: false, // optional, default: false, if enabled and yours geojson includes required data the map will show defined features as polygons with hover/click effect
120
120
  considerVisibilityParam: false, // optional, default: true, if enabled all pois with visibility property defined as 'hidden' will not be visible as default, will be possible to toggle them with toggleHiddenPois() method
121
121
  fitBoundsPadding: 200, // optional, default 250, number | PaddingOptions, the amount of padding in pixels to add to the given bounds for found route, https://docs.mapbox.com/mapbox-gl-js/api/properties/#paddingoptions
122
+ minFitBoundsDistance: 50, // optional, default 15, number, the minimum route length in meters to zoom into it's bounds, if length is smaller regular center change will be used
122
123
  showLevelDirectionIcon: false // optional, default: false, if enabled arrow icon will be shown at the levelchanger indicating direction of level change along the found route,
123
124
  showRasterFloorplans: false // optional, default: false, if enabled raster floorplans will be visible,
124
125
  animatedRoute: false // optional, default: false, EXPERIMENTAL, if enabled animated dot will be displayed along the route,
@@ -43,6 +43,7 @@ interface Options {
43
43
  zoomLevel?: number;
44
44
  considerVisibilityParam?: boolean;
45
45
  fitBoundsPadding?: number | PaddingOptions;
46
+ minFitBoundsDistance?: number;
46
47
  showLevelDirectionIcon?: boolean;
47
48
  showRasterFloorplans?: boolean;
48
49
  animatedRoute?: boolean;
@@ -126,6 +126,7 @@ var Map = /** @class */ (function () {
126
126
  initPolygons: false,
127
127
  considerVisibilityParam: true,
128
128
  fitBoundsPadding: 250,
129
+ minFitBoundsDistance: 15,
129
130
  showLevelDirectionIcon: false,
130
131
  showRasterFloorplans: false,
131
132
  animatedRoute: false,
@@ -1225,10 +1226,10 @@ var Map = /** @class */ (function () {
1225
1226
  var routePoints = helpers_1.lineString(this.routingSource.levelPoints[floor.level].map(function (i) { return i.geometry.coordinates; }));
1226
1227
  var lengthInMeters = turf.length(routePoints, { units: 'kilometers' }) * 1000;
1227
1228
  var bbox = turf.bbox(routePoints);
1228
- if (lengthInMeters > 15) {
1229
+ if (lengthInMeters >= this.defaultOptions.minFitBoundsDistance) {
1229
1230
  // @ts-ignore;
1230
1231
  map.fitBounds(bbox, {
1231
- padding: lengthInMeters < 80 ? 400 : this.defaultOptions.fitBoundsPadding,
1232
+ padding: this.defaultOptions.fitBoundsPadding,
1232
1233
  bearing: this.map.getBearing(),
1233
1234
  pitch: this.map.getPitch(),
1234
1235
  });
@@ -1323,10 +1324,10 @@ var Map = /** @class */ (function () {
1323
1324
  var routePoints = helpers_1.lineString(this.routingSource.levelPoints[this.state.floor.level].map(function (i) { return i.geometry.coordinates; }));
1324
1325
  var lengthInMeters = turf.length(routePoints, { units: 'kilometers' }) * 1000;
1325
1326
  var bbox = turf.bbox(routePoints);
1326
- if (lengthInMeters > 15) {
1327
+ if (lengthInMeters >= this.defaultOptions.minFitBoundsDistance) {
1327
1328
  // @ts-ignore;
1328
1329
  this.map.fitBounds(bbox, {
1329
- padding: lengthInMeters < 80 ? 400 : this.defaultOptions.fitBoundsPadding,
1330
+ padding: this.defaultOptions.fitBoundsPadding,
1330
1331
  bearing: this.map.getBearing(),
1331
1332
  pitch: this.map.getPitch(),
1332
1333
  });