@theseam/ui-common 0.4.15 → 0.4.18

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.
@@ -486,6 +486,9 @@ class GoogleMapsService {
486
486
  setBaseLatLng(lat, lng) {
487
487
  this._baseLatLng = { lat, lng };
488
488
  }
489
+ setPadding(padding) {
490
+ this._padding = padding;
491
+ }
489
492
  // TODO: Refactor out of the service meant to just wrap the google maps api.
490
493
  setFeatureContextMenu(menu) {
491
494
  this.closeContextMenu();
@@ -597,7 +600,7 @@ class GoogleMapsService {
597
600
  this._assertInitialized();
598
601
  removeAllFeatures(this.googleMap.data);
599
602
  this.googleMap.data.addGeoJson(data);
600
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
603
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
601
604
  }
602
605
  // TODO: Refactor out of the service meant to just wrap the google maps api.
603
606
  reCenterOnFeatures() {
@@ -609,7 +612,7 @@ class GoogleMapsService {
609
612
  this.googleMap.panTo(this._baseLatLng);
610
613
  return;
611
614
  }
612
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
615
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
613
616
  // TODO: Fix to pan to center. Currently fitBounds results in the expected
614
617
  // result, but pantToBounds animates.
615
618
  // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))
@@ -1279,6 +1282,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1279
1282
  this.zoom = 14;
1280
1283
  this.longitude = -98.570209;
1281
1284
  this.latitude = 37.633814;
1285
+ this.padding = 0;
1282
1286
  this.mapReady = new EventEmitter();
1283
1287
  this._options = {
1284
1288
  mapTypeControl: true,
@@ -1314,6 +1318,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1314
1318
  }
1315
1319
  }));
1316
1320
  this._googleMaps.setBaseLatLng(this.latitude, this.longitude);
1321
+ this._googleMaps.setPadding(this.padding);
1317
1322
  this._gmApiLoaded = this._googleMapsApiLoader.load().pipe(map(() => true), catchError(() => of(false)));
1318
1323
  }
1319
1324
  ngOnInit() {
@@ -1372,6 +1377,9 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1372
1377
  if (Object.prototype.hasOwnProperty.call(changes, 'editingEnabled')) {
1373
1378
  this._googleMaps.setEditingEnabled(this.editingEnabled);
1374
1379
  }
1380
+ if (Object.prototype.hasOwnProperty.call(changes, 'padding')) {
1381
+ this._googleMaps.setPadding(this.padding);
1382
+ }
1375
1383
  }
1376
1384
  writeValue(value) {
1377
1385
  this.value = value;
@@ -1404,27 +1412,24 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1404
1412
  _onMapReady(theMap) {
1405
1413
  this._googleMaps.setMap(theMap);
1406
1414
  this._googleMaps.setData(this._mapValueManager.value);
1407
- // NOTE: AgmMap has a race condition problem that causes the input latitude,
1408
- // longitude, and zoom to get ignored, before googlemaps emits
1409
- // 'center_changed'. This should avoid the issue, until we stop using AgmMap
1410
- // or upgrade to a more recent version that may not have the issue anymore.
1411
- // TODO: Check if the switch to '@angular/google-maps' fixed this problem.
1412
- this._googleMaps.reCenterOnFeatures();
1413
- // NOTE: the input zoom level was getting reset after this function ran,
1415
+ // NOTE: The input zoom level was getting reset after this function ran,
1414
1416
  // so putting in this idle listener to wait until the map is fully rendered
1415
1417
  // to set the zoom.
1418
+ // Calling reCenterOnFeatures() after setZoom() ensures that maps with pre-drawn shapes
1419
+ // will display correctly
1416
1420
  this.idleListener = this._googleMaps.googleMap?.addListener('idle', () => {
1417
1421
  this._googleMaps.googleMap?.setZoom(this.zoom);
1422
+ this._googleMaps.reCenterOnFeatures();
1423
+ this.mapReady.emit(this._googleMaps.googleMap);
1418
1424
  this.idleListener?.remove();
1419
1425
  });
1420
- this.mapReady.emit(this._googleMaps.googleMap);
1421
1426
  }
1422
1427
  _onClickDeleteFeature() {
1423
1428
  this._googleMaps.deleteSelection();
1424
1429
  }
1425
1430
  }
1426
1431
  TheSeamGoogleMapsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamGoogleMapsComponent, deps: [{ token: i0.ElementRef }, { token: i1.FocusMonitor }, { token: GoogleMapsService }, { token: MapValueManagerService }, { token: TheSeamGoogleMapsApiLoader }], target: i0.ɵɵFactoryTarget.Component });
1427
- TheSeamGoogleMapsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamGoogleMapsComponent, selector: "seam-google-maps", inputs: { disabled: "disabled", value: "value", tabIndex: "tabIndex", fileDropEnabled: "fileDropEnabled", fileUploadControlEnabled: "fileUploadControlEnabled", fullscreenControlEnabled: "fullscreenControlEnabled", reCenterControlEnabled: "reCenterControlEnabled", mapTypeControlEnabled: "mapTypeControlEnabled", streetViewControlEnabled: "streetViewControlEnabled", allowDrawingHoleInPolygon: "allowDrawingHoleInPolygon", editingEnabled: "editingEnabled", fileImportHandler: "fileImportHandler", zoom: "zoom", longitude: "longitude", latitude: "latitude" }, outputs: { mapReady: "mapReady" }, host: { properties: { "attr.disabled": "this._attrDisabled", "attr.tabindex": "this._attrTabIndex" } }, providers: [
1432
+ TheSeamGoogleMapsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamGoogleMapsComponent, selector: "seam-google-maps", inputs: { disabled: "disabled", value: "value", tabIndex: "tabIndex", fileDropEnabled: "fileDropEnabled", fileUploadControlEnabled: "fileUploadControlEnabled", fullscreenControlEnabled: "fullscreenControlEnabled", reCenterControlEnabled: "reCenterControlEnabled", mapTypeControlEnabled: "mapTypeControlEnabled", streetViewControlEnabled: "streetViewControlEnabled", allowDrawingHoleInPolygon: "allowDrawingHoleInPolygon", editingEnabled: "editingEnabled", fileImportHandler: "fileImportHandler", zoom: "zoom", longitude: "longitude", latitude: "latitude", padding: "padding" }, outputs: { mapReady: "mapReady" }, host: { properties: { "attr.disabled": "this._attrDisabled", "attr.tabindex": "this._attrTabIndex" } }, providers: [
1428
1433
  MapValueManagerService,
1429
1434
  GoogleMapsService,
1430
1435
  { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },
@@ -1517,6 +1522,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1517
1522
  type: Input
1518
1523
  }], latitude: [{
1519
1524
  type: Input
1525
+ }], padding: [{
1526
+ type: Input
1520
1527
  }], mapReady: [{
1521
1528
  type: Output
1522
1529
  }], featureContextMenu: [{