@dereekb/dbx-web 9.19.3 → 9.19.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.
@@ -4,8 +4,8 @@ import * as i2 from '@dereekb/dbx-core';
4
4
  import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, DbxInjectionComponentModule } from '@dereekb/dbx-core';
5
5
  import { switchMap as switchMap$1 } from 'rxjs/operators';
6
6
  import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, asObservable } from '@dereekb/rxjs';
7
- import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, merge, throttleTime, BehaviorSubject, combineLatestWith } from 'rxjs';
8
- import { latLngPointFunction, latLngBoundFunction, filterUndefinedValues, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter, LAT_LONG_10M_PRECISION, roundNumberToStepFunction } from '@dereekb/util';
7
+ import { switchMap, NEVER, defaultIfEmpty, map, tap, EMPTY, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, merge, throttleTime, BehaviorSubject, combineLatestWith } from 'rxjs';
8
+ import { latLngPointFunction, latLngBoundFunction, latLngBoundFromInput, filterUndefinedValues, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter, LAT_LONG_10M_PRECISION, roundNumberToStepFunction } from '@dereekb/util';
9
9
  import { ComponentStore } from '@ngrx/component-store';
10
10
  import * as MapboxGl from 'mapbox-gl';
11
11
  import { bounds } from '@mapbox/geo-viewport';
@@ -305,6 +305,18 @@ class DbxMapboxMapStore extends ComponentStore {
305
305
  return this.mapInstance$.pipe(tap((map) => map.snapToNorth(snap?.options, snap?.eventData)));
306
306
  }));
307
307
  });
308
+ this.fitPositions = this.effect((input) => {
309
+ return input.pipe(switchMap((x) => {
310
+ const boundFromInput = latLngBoundFromInput(x.positions);
311
+ if (boundFromInput) {
312
+ const bound = this.latLngBound(boundFromInput);
313
+ return this.mapInstance$.pipe(tap((map) => map.fitBounds(new MapboxGl.LngLatBounds(bound.sw, bound.ne), x.options, x.eventData)));
314
+ }
315
+ else {
316
+ return EMPTY;
317
+ }
318
+ }));
319
+ });
308
320
  this.fitBounds = this.effect((input) => {
309
321
  return input.pipe(switchMap((x) => {
310
322
  const bound = this.latLngBound(x.bounds);