@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.
@@ -478,6 +478,9 @@ class GoogleMapsService {
478
478
  setBaseLatLng(lat, lng) {
479
479
  this._baseLatLng = { lat, lng };
480
480
  }
481
+ setPadding(padding) {
482
+ this._padding = padding;
483
+ }
481
484
  // TODO: Refactor out of the service meant to just wrap the google maps api.
482
485
  setFeatureContextMenu(menu) {
483
486
  this.closeContextMenu();
@@ -593,7 +596,7 @@ class GoogleMapsService {
593
596
  this._assertInitialized();
594
597
  removeAllFeatures(this.googleMap.data);
595
598
  this.googleMap.data.addGeoJson(data);
596
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
599
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
597
600
  });
598
601
  }
599
602
  // TODO: Refactor out of the service meant to just wrap the google maps api.
@@ -606,7 +609,7 @@ class GoogleMapsService {
606
609
  this.googleMap.panTo(this._baseLatLng);
607
610
  return;
608
611
  }
609
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
612
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
610
613
  // TODO: Fix to pan to center. Currently fitBounds results in the expected
611
614
  // result, but pantToBounds animates.
612
615
  // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))
@@ -1288,6 +1291,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1288
1291
  this.zoom = 14;
1289
1292
  this.longitude = -98.570209;
1290
1293
  this.latitude = 37.633814;
1294
+ this.padding = 0;
1291
1295
  this.mapReady = new EventEmitter();
1292
1296
  this._options = {
1293
1297
  mapTypeControl: true,
@@ -1323,6 +1327,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1323
1327
  }
1324
1328
  }));
1325
1329
  this._googleMaps.setBaseLatLng(this.latitude, this.longitude);
1330
+ this._googleMaps.setPadding(this.padding);
1326
1331
  this._gmApiLoaded = this._googleMapsApiLoader.load().pipe(map(() => true), catchError(() => of(false)));
1327
1332
  }
1328
1333
  ngOnInit() {
@@ -1378,6 +1383,9 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1378
1383
  if (Object.prototype.hasOwnProperty.call(changes, 'editingEnabled')) {
1379
1384
  this._googleMaps.setEditingEnabled(this.editingEnabled);
1380
1385
  }
1386
+ if (Object.prototype.hasOwnProperty.call(changes, 'padding')) {
1387
+ this._googleMaps.setPadding(this.padding);
1388
+ }
1381
1389
  }
1382
1390
  writeValue(value) {
1383
1391
  this.value = value;
@@ -1411,28 +1419,25 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1411
1419
  var _a;
1412
1420
  this._googleMaps.setMap(theMap);
1413
1421
  this._googleMaps.setData(this._mapValueManager.value);
1414
- // NOTE: AgmMap has a race condition problem that causes the input latitude,
1415
- // longitude, and zoom to get ignored, before googlemaps emits
1416
- // 'center_changed'. This should avoid the issue, until we stop using AgmMap
1417
- // or upgrade to a more recent version that may not have the issue anymore.
1418
- // TODO: Check if the switch to '@angular/google-maps' fixed this problem.
1419
- this._googleMaps.reCenterOnFeatures();
1420
- // NOTE: the input zoom level was getting reset after this function ran,
1422
+ // NOTE: The input zoom level was getting reset after this function ran,
1421
1423
  // so putting in this idle listener to wait until the map is fully rendered
1422
1424
  // to set the zoom.
1425
+ // Calling reCenterOnFeatures() after setZoom() ensures that maps with pre-drawn shapes
1426
+ // will display correctly
1423
1427
  this.idleListener = (_a = this._googleMaps.googleMap) === null || _a === void 0 ? void 0 : _a.addListener('idle', () => {
1424
1428
  var _a, _b;
1425
1429
  (_a = this._googleMaps.googleMap) === null || _a === void 0 ? void 0 : _a.setZoom(this.zoom);
1430
+ this._googleMaps.reCenterOnFeatures();
1431
+ this.mapReady.emit(this._googleMaps.googleMap);
1426
1432
  (_b = this.idleListener) === null || _b === void 0 ? void 0 : _b.remove();
1427
1433
  });
1428
- this.mapReady.emit(this._googleMaps.googleMap);
1429
1434
  }
1430
1435
  _onClickDeleteFeature() {
1431
1436
  this._googleMaps.deleteSelection();
1432
1437
  }
1433
1438
  }
1434
1439
  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 });
1435
- 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: [
1440
+ 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: [
1436
1441
  MapValueManagerService,
1437
1442
  GoogleMapsService,
1438
1443
  { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },
@@ -1525,6 +1530,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1525
1530
  type: Input
1526
1531
  }], latitude: [{
1527
1532
  type: Input
1533
+ }], padding: [{
1534
+ type: Input
1528
1535
  }], mapReady: [{
1529
1536
  type: Output
1530
1537
  }], featureContextMenu: [{