proximiio-js-library 1.14.0 → 1.14.2

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.
@@ -203,10 +203,14 @@ export interface Options {
203
203
  poiIconSize?: (string | number | string[])[] | number | any;
204
204
  disableUnavailablePois?: boolean;
205
205
  apiPaginate?: boolean;
206
+ bundlePaginate?: boolean;
206
207
  customPositionOptions?: {
207
208
  arrivalThreshold?: number;
208
209
  minDistanceToChange?: number;
209
210
  aggregatePositionsLimit?: number;
211
+ animationMinDuration?: number;
212
+ animationMaxDuration?: number;
213
+ animationDurationPerMeter?: number;
210
214
  };
211
215
  }
212
216
  export interface PaddingOptions {
@@ -241,10 +241,14 @@ export class Map {
241
241
  autoRestartAnimationAfterFloorChange: false,
242
242
  disableUnavailablePois: false,
243
243
  apiPaginate: false,
244
+ bundlePaginate: false,
244
245
  customPositionOptions: {
245
246
  arrivalThreshold: 3,
246
247
  minDistanceToChange: 2,
247
248
  aggregatePositionsLimit: 1,
249
+ animationMinDuration: 300,
250
+ animationMaxDuration: 3000,
251
+ animationDurationPerMeter: 50,
248
252
  },
249
253
  // poiIconSize: ['interpolate', ['exponential', 0.5], ['zoom'], 17, 0.1, 22, 0.5],
250
254
  };
@@ -673,7 +677,7 @@ export class Map {
673
677
  useTimerangeData: this.defaultOptions.useTimerangeData,
674
678
  filter: this.defaultOptions.defaultFilter,
675
679
  bundleUrl: this.defaultOptions.bundleUrl,
676
- apiPaginate: this.defaultOptions.apiPaginate,
680
+ bundlePaginate: this.defaultOptions.bundlePaginate,
677
681
  }).catch((error) => this.handleControllerError(error))
678
682
  : yield getFeatures({
679
683
  initPolygons: this.defaultOptions.initPolygons,
@@ -919,7 +923,7 @@ export class Map {
919
923
  useTimerangeData: this.defaultOptions.useTimerangeData,
920
924
  filter: this.defaultOptions.defaultFilter,
921
925
  bundleUrl: this.defaultOptions.bundleUrl,
922
- apiPaginate: this.defaultOptions.apiPaginate,
926
+ bundlePaginate: this.defaultOptions.bundlePaginate,
923
927
  })
924
928
  : yield getFeatures({
925
929
  initPolygons: this.defaultOptions.initPolygons,
@@ -3972,9 +3976,9 @@ export class Map {
3972
3976
  }
3973
3977
  // Distance-based duration
3974
3978
  const distMeters = distance(from, to) * 1000;
3975
- const minDuration = 300; // ms
3976
- const durationPerMeter = 50; // ms per meter
3977
- const maxDuration = 3000; // ms
3979
+ const minDuration = this.defaultOptions.customPositionOptions.animationMinDuration;
3980
+ const durationPerMeter = this.defaultOptions.customPositionOptions.animationDurationPerMeter;
3981
+ const maxDuration = this.defaultOptions.customPositionOptions.animationMaxDuration;
3978
3982
  this.customPostionAnimationDuration = Math.min(maxDuration, Math.max(minDuration, minDuration + distMeters * durationPerMeter));
3979
3983
  const startTime = performance.now();
3980
3984
  this.customPostionAnimationStartTime = startTime;
@@ -20,7 +20,7 @@ export declare const getFeatures: ({ initPolygons, polygonLayers, autoLabelLines
20
20
  };
21
21
  apiPaginate?: boolean;
22
22
  }) => Promise<FeatureCollection>;
23
- export declare const getFeaturesBundle: ({ initPolygons, polygonLayers, autoLabelLines, hiddenAmenities, useTimerangeData, filter, bundleUrl, apiPaginate, }: {
23
+ export declare const getFeaturesBundle: ({ initPolygons, polygonLayers, autoLabelLines, hiddenAmenities, useTimerangeData, filter, bundleUrl, bundlePaginate, }: {
24
24
  initPolygons?: boolean;
25
25
  polygonLayers: PolygonLayer[];
26
26
  autoLabelLines?: boolean;
@@ -32,7 +32,7 @@ export declare const getFeaturesBundle: ({ initPolygons, polygonLayers, autoLabe
32
32
  hideIconOnly?: boolean;
33
33
  };
34
34
  bundleUrl: string;
35
- apiPaginate?: boolean;
35
+ bundlePaginate?: boolean;
36
36
  }) => Promise<FeatureCollection>;
37
37
  export declare const getAmenities: ({ amenityIdProperty, localSources, }: {
38
38
  amenityIdProperty?: string;
@@ -349,9 +349,57 @@ export const getFeatures = ({ initPolygons, polygonLayers, autoLabelLines, hidde
349
349
  }
350
350
  return new FeatureCollection(res.data);
351
351
  });
352
- export const getFeaturesBundle = ({ initPolygons, polygonLayers, autoLabelLines, hiddenAmenities, useTimerangeData, filter, bundleUrl, apiPaginate, }) => __awaiter(void 0, void 0, void 0, function* () {
353
- const res = yield fetch(`${bundleUrl}/features.json`);
354
- const data = yield res.json();
352
+ export const getFeaturesBundle = ({ initPolygons, polygonLayers, autoLabelLines, hiddenAmenities, useTimerangeData, filter, bundleUrl, bundlePaginate, }) => __awaiter(void 0, void 0, void 0, function* () {
353
+ let data = {
354
+ features: [],
355
+ count: 0,
356
+ type: 'FeatureCollection',
357
+ };
358
+ if (!bundlePaginate) {
359
+ const res = yield fetch(`${bundleUrl}/features.json`);
360
+ data = yield res.json();
361
+ }
362
+ else {
363
+ // --- Paginated version ---
364
+ const items = [];
365
+ const pageSize = 250;
366
+ // 1. Fetch first page (contains total count)
367
+ const firstRes = yield fetch(`${bundleUrl}/features-1.json`);
368
+ const firstData = yield firstRes.json();
369
+ const totalRecords = firstData.count;
370
+ items.push(...firstData.features);
371
+ // 2. Calculate total pages
372
+ const numPages = Math.ceil(totalRecords / pageSize);
373
+ // 3. Decide concurrency level
374
+ const numQueues = 8; // number of parallel queues
375
+ const requestsPerQueue = Math.ceil((numPages - 1) / numQueues);
376
+ // 4. Build request queues
377
+ const queues = [];
378
+ for (let i = 0; i < numQueues; i++) {
379
+ const queueRequests = [];
380
+ for (let j = 0; j < requestsPerQueue; j++) {
381
+ const pageIndex = i * requestsPerQueue + j + 2; // start at 2 because page 1 is already fetched
382
+ if (pageIndex <= numPages) {
383
+ queueRequests.push(fetch(`${bundleUrl}/features-${pageIndex}.json`).then((res) => res.json()));
384
+ }
385
+ }
386
+ if (queueRequests.length > 0) {
387
+ queues.push(queueRequests);
388
+ }
389
+ }
390
+ // 5. Execute queues sequentially (but each queue runs in parallel)
391
+ for (const queue of queues) {
392
+ const results = yield Promise.all(queue);
393
+ results.forEach((page) => {
394
+ items.push(...page.features);
395
+ });
396
+ }
397
+ data = {
398
+ count: totalRecords,
399
+ features: items,
400
+ type: 'FeatureCollection',
401
+ };
402
+ }
355
403
  if (initPolygons) {
356
404
  const featuresToAdd = [];
357
405
  if (useTimerangeData) {