proximiio-js-library 1.14.2 → 1.14.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.
|
@@ -208,6 +208,7 @@ export interface Options {
|
|
|
208
208
|
arrivalThreshold?: number;
|
|
209
209
|
minDistanceToChange?: number;
|
|
210
210
|
aggregatePositionsLimit?: number;
|
|
211
|
+
aggregationResult?: 'center' | 'nearest';
|
|
211
212
|
animationMinDuration?: number;
|
|
212
213
|
animationMaxDuration?: number;
|
|
213
214
|
animationDurationPerMeter?: number;
|
|
@@ -246,6 +246,7 @@ export class Map {
|
|
|
246
246
|
arrivalThreshold: 3,
|
|
247
247
|
minDistanceToChange: 2,
|
|
248
248
|
aggregatePositionsLimit: 1,
|
|
249
|
+
aggregationResult: 'center',
|
|
249
250
|
animationMinDuration: 300,
|
|
250
251
|
animationMaxDuration: 3000,
|
|
251
252
|
animationDurationPerMeter: 50,
|
|
@@ -642,6 +643,9 @@ export class Map {
|
|
|
642
643
|
protocol.add(this.pmTilesInstance);
|
|
643
644
|
}
|
|
644
645
|
this.map = new maplibregl.Map(Object.assign(Object.assign({}, this.defaultOptions.mapboxOptions), { container: this.defaultOptions.selector ? this.defaultOptions.selector : 'map', style: this.state.style }));
|
|
646
|
+
if (this.defaultOptions.useRasterTiles) {
|
|
647
|
+
this.initRasterTiles();
|
|
648
|
+
}
|
|
645
649
|
this.map.on('load', (e) => __awaiter(this, void 0, void 0, function* () {
|
|
646
650
|
this.onMapLoadListener.next(true);
|
|
647
651
|
this.map.setCenter(centerVar);
|
|
@@ -794,9 +798,6 @@ export class Map {
|
|
|
794
798
|
this.filteredAmenities = this.amenityIds;
|
|
795
799
|
this.imageSourceManager.setLevel(map, (_b = this.state.floor) === null || _b === void 0 ? void 0 : _b.level, this.state);
|
|
796
800
|
yield this.onPlaceSelect(this.state.place, this.defaultOptions.zoomIntoPlace, this.defaultOptions.defaultFloorLevel);
|
|
797
|
-
if (this.defaultOptions.useRasterTiles) {
|
|
798
|
-
this.initRasterTiles();
|
|
799
|
-
}
|
|
800
801
|
if (this.defaultOptions.initPolygons) {
|
|
801
802
|
this.initPolygons();
|
|
802
803
|
}
|
|
@@ -5558,9 +5559,17 @@ export class Map {
|
|
|
5558
5559
|
this.positionsList.push(coordinates);
|
|
5559
5560
|
if (this.positionsList.length >= this.defaultOptions.customPositionOptions.aggregatePositionsLimit) {
|
|
5560
5561
|
const positionPoints = points(this.positionsList);
|
|
5561
|
-
|
|
5562
|
+
let resultPoint = point(this.positionsList[this.positionsList.length - 1]);
|
|
5563
|
+
if (this.defaultOptions.customPositionOptions.aggregationResult === 'center' ||
|
|
5564
|
+
(this.defaultOptions.customPositionOptions.aggregationResult === 'nearest' && !this.customPosition)) {
|
|
5565
|
+
resultPoint = center(positionPoints);
|
|
5566
|
+
}
|
|
5567
|
+
if (this.defaultOptions.customPositionOptions.aggregationResult === 'nearest' && this.customPosition) {
|
|
5568
|
+
resultPoint = nearestPoint(this.customPosition.coordinates, positionPoints);
|
|
5569
|
+
console.log('pick the nearest');
|
|
5570
|
+
}
|
|
5562
5571
|
this.onSetCustomPosition({
|
|
5563
|
-
coordinates:
|
|
5572
|
+
coordinates: resultPoint.geometry.coordinates,
|
|
5564
5573
|
level,
|
|
5565
5574
|
bearing,
|
|
5566
5575
|
recenter,
|