Skip to content

Commit

Permalink
fix(map): fitBounds: handle fitBounds at init
Browse files Browse the repository at this point in the history
close #74
  • Loading branch information
Wykks committed Dec 17, 2018
1 parent b7fbb89 commit d10ff55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class DraggableDirective implements OnInit, OnDestroy {
let leave$;
let updateCoords;
if (this.MarkerComponent) {
console.warn('mglDraggable on Marker is deprecated, use draggable input instead');
console.warn('[ngx-mapbox-gl] mglDraggable on Marker is deprecated, use draggable input instead');
let markerElement = (<Element>this.MarkerComponent.content.nativeElement);
if (markerElement.children.length === 1) {
markerElement = markerElement.children[0];
Expand Down
5 changes: 4 additions & 1 deletion projects/ngx-mapbox-gl/src/lib/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ export class MapComponent implements OnChanges, OnDestroy, AfterViewInit, MapEve
if (changes.maxBounds && !changes.maxBounds.isFirstChange()) {
this.MapService.updateMaxBounds(changes.maxBounds.currentValue);
}
if (changes.fitBounds && !changes.fitBounds.isFirstChange()) {
if (changes.fitBounds) {
if (this.center || this.zoom || this.pitch) {
console.warn('[ngx-mapbox-gl] center / zoom / pitch inputs are being overridden by fitBounds input');
}
this.MapService.fitBounds(changes.fitBounds.currentValue, this.fitBoundsOptions);
}
if (changes.fitScreenCoordinates && !changes.fitBounds.isFirstChange()) {
Expand Down

0 comments on commit d10ff55

Please sign in to comment.