Skip to content

Commit

Permalink
feat(SebmGoogleMap): support maxZoom and minZoom
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarljubenovic authored and sebholstein committed Dec 16, 2016
1 parent c81a15f commit 0789a17
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/core/directives/google-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ import {KmlLayerManager} from './../services/managers/kml-layer-manager';
PolygonManager, KmlLayerManager
],
inputs: [
'longitude', 'latitude', 'zoom', 'draggable: mapDraggable', 'disableDoubleClickZoom',
'disableDefaultUI', 'scrollwheel', 'backgroundColor', 'draggableCursor', 'draggingCursor',
'keyboardShortcuts', 'zoomControl', 'styles', 'usePanning', 'streetViewControl', 'fitBounds',
'scaleControl', 'mapTypeControl'
'longitude', 'latitude', 'zoom', 'minZoom', 'maxZoom', 'draggable: mapDraggable',
'disableDoubleClickZoom', 'disableDefaultUI', 'scrollwheel', 'backgroundColor', 'draggableCursor',
'draggingCursor', 'keyboardShortcuts', 'zoomControl', 'styles', 'usePanning', 'streetViewControl',
'fitBounds', 'scaleControl', 'mapTypeControl'
],
outputs: [
'mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle', 'boundsChange', 'zoomChange'
Expand Down Expand Up @@ -86,6 +86,18 @@ export class SebmGoogleMap implements OnChanges, OnInit, OnDestroy {
*/
zoom: number = 8;

/**
* The minimal zoom level of the map allowed. When not provided, no restrictions to the zoom level
* are enforced.
*/
minZoom: number;

/**
* The maximal zoom level of the map allowed. When not provided, no restrictions to the zoom level
* are enforced.
*/
maxZoom: number;

/**
* Enables/disables if map is draggable.
*/
Expand Down Expand Up @@ -180,7 +192,8 @@ export class SebmGoogleMap implements OnChanges, OnInit, OnDestroy {
*/
private static _mapOptionsAttributes: string[] = [
'disableDoubleClickZoom', 'scrollwheel', 'draggable', 'draggableCursor', 'draggingCursor',
'keyboardShortcuts', 'zoomControl', 'styles', 'streetViewControl', 'zoom', 'mapTypeControl'
'keyboardShortcuts', 'zoomControl', 'styles', 'streetViewControl', 'zoom', 'mapTypeControl',
'minZoom', 'maxZoom'
];

private _observableSubscriptions: Subscription[] = [];
Expand Down Expand Up @@ -236,6 +249,8 @@ export class SebmGoogleMap implements OnChanges, OnInit, OnDestroy {
this._mapsWrapper.createMap(el, {
center: {lat: this.latitude || 0, lng: this.longitude || 0},
zoom: this.zoom,
minZoom: this.minZoom,
maxZoom: this.maxZoom,
disableDefaultUI: this.disableDefaultUI,
backgroundColor: this.backgroundColor,
draggable: this.draggable,
Expand Down
2 changes: 2 additions & 0 deletions src/core/services/google-maps-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export interface MouseEvent { latLng: LatLng; }
export interface MapOptions {
center?: LatLng|LatLngLiteral;
zoom?: number;
minZoom?: number;
maxZoom?: number;
disableDoubleClickZoom?: boolean;
disableDefaultUI?: boolean;
backgroundColor?: string;
Expand Down

0 comments on commit 0789a17

Please sign in to comment.