@dereekb/dbx-web 9.7.3 → 9.7.6

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.
@@ -5,7 +5,7 @@ import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, Dbx
5
5
  import { switchMap as switchMap$1 } from 'rxjs/operators';
6
6
  import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, asObservable } from '@dereekb/rxjs';
7
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, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter, LAT_LONG_10M_PRECISION, roundNumberToStepFunction } from '@dereekb/util';
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';
9
9
  import { ComponentStore } from '@ngrx/component-store';
10
10
  import * as MapboxGl from 'mapbox-gl';
11
11
  import { bounds } from '@mapbox/geo-viewport';
@@ -121,7 +121,7 @@ class DbxMapboxMapStore extends ComponentStore {
121
121
  retainContent: true
122
122
  });
123
123
  this.dbxMapboxService = dbxMapboxService;
124
- this.safeLatLngPoint = latLngPointFunction();
124
+ this.safeLatLngPoint = latLngPointFunction({ wrap: true });
125
125
  this.latLngPoint = latLngPointFunction({ wrap: false, validate: false });
126
126
  this.latLngBound = latLngBoundFunction({ pointFunction: this.latLngPoint });
127
127
  // MARK: Effects
@@ -204,6 +204,14 @@ class DbxMapboxMapStore extends ComponentStore {
204
204
  return this.mapInstance$.pipe(tap((map) => map.setZoom(zoom)));
205
205
  }));
206
206
  });
207
+ this.setZoomRange = this.effect((input) => {
208
+ return input.pipe(switchMap((zoomRange) => {
209
+ return this.mapInstance$.pipe(tap((map) => {
210
+ map.setMinZoom(zoomRange.min || null);
211
+ map.setMaxZoom(zoomRange.max || null);
212
+ }));
213
+ }));
214
+ });
207
215
  this.setMinZoom = this.effect((input) => {
208
216
  return input.pipe(switchMap((zoom) => {
209
217
  return this.mapInstance$.pipe(tap((map) => map.setMinZoom(zoom)));
@@ -316,7 +324,7 @@ class DbxMapboxMapStore extends ComponentStore {
316
324
  var _a, _b;
317
325
  const inputCenter = (_a = x.center) !== null && _a !== void 0 ? _a : (_b = x.to) === null || _b === void 0 ? void 0 : _b.center;
318
326
  const center = inputCenter ? this.safeLatLngPoint(inputCenter) : undefined;
319
- return this.mapInstance$.pipe(tap((map) => map.jumpTo(Object.assign(Object.assign({}, x.to), { center }), x.eventData)));
327
+ return this.mapInstance$.pipe(tap((map) => map.jumpTo(filterUndefinedValues(Object.assign(Object.assign({}, x.to), { center })), x.eventData)));
320
328
  }));
321
329
  });
322
330
  this.easeTo = this.effect((input) => {
@@ -324,7 +332,7 @@ class DbxMapboxMapStore extends ComponentStore {
324
332
  var _a, _b;
325
333
  const inputCenter = (_a = x.center) !== null && _a !== void 0 ? _a : (_b = x.to) === null || _b === void 0 ? void 0 : _b.center;
326
334
  const center = inputCenter ? this.safeLatLngPoint(inputCenter) : undefined;
327
- return this.mapInstance$.pipe(tap((map) => map.easeTo(Object.assign(Object.assign({}, x.to), { center }), x.eventData)));
335
+ return this.mapInstance$.pipe(tap((map) => map.easeTo(filterUndefinedValues(Object.assign(Object.assign({}, x.to), { center })), x.eventData)));
328
336
  }));
329
337
  });
330
338
  this.flyTo = this.effect((input) => {
@@ -332,7 +340,7 @@ class DbxMapboxMapStore extends ComponentStore {
332
340
  var _a, _b;
333
341
  const inputCenter = (_a = x.center) !== null && _a !== void 0 ? _a : (_b = x.to) === null || _b === void 0 ? void 0 : _b.center;
334
342
  const center = inputCenter ? this.safeLatLngPoint(inputCenter) : undefined;
335
- return this.mapInstance$.pipe(tap((map) => map.flyTo(Object.assign(Object.assign({}, x.to), { center }), x.eventData)));
343
+ return this.mapInstance$.pipe(tap((map) => map.flyTo(filterUndefinedValues(Object.assign(Object.assign({}, x.to), { center })), x.eventData)));
336
344
  }));
337
345
  });
338
346
  this.resetPitchAndBearing = this.effect((input) => {
@@ -1198,7 +1206,7 @@ function filterByMapboxViewportBound(config) {
1198
1206
  };
1199
1207
  });
1200
1208
  }), combineLatestWith(boundDecisionObs), map(([items, boundFunction]) => {
1201
- let valuesInBounds = [];
1209
+ const valuesInBounds = [];
1202
1210
  items.forEach((item) => {
1203
1211
  if (boundFunction(item.bound)) {
1204
1212
  valuesInBounds.push(item.value);