@@ -6,7 +6,7 @@ import { FitBoundsService } from '../services/fit-bounds';
66import { GoogleMapsAPIWrapper } from '../services/google-maps-api-wrapper' ;
77import {
88 FullscreenControlOptions , LatLng , LatLngBounds , LatLngBoundsLiteral , LatLngLiteral ,
9- MapRestriction , MapTypeControlOptions , MapTypeId , MapTypeStyle , PanControlOptions ,
9+ MapRestriction , MapTypeControlOptions , MapTypeId , MapTypeStyle , Padding , PanControlOptions ,
1010 RotateControlOptions , ScaleControlOptions , StreetViewControlOptions , ZoomControlOptions ,
1111} from '../services/google-maps-types' ;
1212import { CircleManager } from '../services/managers/circle-manager' ;
@@ -204,6 +204,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
204204 */
205205 @Input ( ) fitBounds : LatLngBoundsLiteral | LatLngBounds | boolean = false ;
206206
207+ /**
208+ * Padding amount for the bounds.
209+ */
210+ @Input ( ) fitBoundsPadding : number | Padding ;
211+
207212 /**
208213 * The initial enabled/disabled state of the Scale control. This is disabled by default.
209214 */
@@ -521,19 +526,19 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
521526 }
522527 break ;
523528 default :
524- this . _updateBounds ( this . fitBounds ) ;
529+ this . _updateBounds ( this . fitBounds , this . fitBoundsPadding ) ;
525530 }
526531 }
527532
528533 private _subscribeToFitBoundsUpdates ( ) {
529534 this . _zone . runOutsideAngular ( ( ) => {
530535 this . _fitBoundsSubscription = this . _fitBoundsService . getBounds$ ( ) . subscribe ( b => {
531- this . _zone . run ( ( ) => this . _updateBounds ( b ) ) ;
536+ this . _zone . run ( ( ) => this . _updateBounds ( b , this . fitBoundsPadding ) ) ;
532537 } ) ;
533538 } ) ;
534539 }
535540
536- protected _updateBounds ( bounds : LatLngBounds | LatLngBoundsLiteral ) {
541+ protected _updateBounds ( bounds : LatLngBounds | LatLngBoundsLiteral , padding ?: number | Padding ) {
537542 if ( ! bounds ) {
538543 return ;
539544 }
@@ -543,10 +548,10 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
543548 bounds = newBounds ;
544549 }
545550 if ( this . usePanning ) {
546- this . _mapsWrapper . panToBounds ( bounds ) ;
551+ this . _mapsWrapper . panToBounds ( bounds , padding ) ;
547552 return ;
548553 }
549- this . _mapsWrapper . fitBounds ( bounds ) ;
554+ this . _mapsWrapper . fitBounds ( bounds , padding ) ;
550555 }
551556
552557 private _isLatLngBoundsLiteral ( bounds : LatLngBounds | LatLngBoundsLiteral ) : bounds is LatLngBoundsLiteral {
0 commit comments