1
- import { Component , ElementRef , EventEmitter , OnChanges , OnDestroy , OnInit , SimpleChange } from '@angular/core' ;
1
+ import { Component , ElementRef , EventEmitter , OnChanges , OnDestroy , OnInit , SimpleChanges } from '@angular/core' ;
2
2
import { Subscription } from 'rxjs/Subscription' ;
3
3
4
4
import { MouseEvent } from '../map-types' ;
5
5
import { GoogleMapsAPIWrapper } from '../services/google-maps-api-wrapper' ;
6
- import { LatLng , LatLngLiteral } from '../services/google-maps-types' ;
6
+ import { FullscreenControlOptions , LatLng , LatLngLiteral , MapTypeControlOptions , PanControlOptions ,
7
+ RotateControlOptions , ScaleControlOptions , StreetViewControlOptions , ZoomControlOptions } from '../services/google-maps-types' ;
7
8
import { LatLngBounds , LatLngBoundsLiteral , MapTypeStyle } from '../services/google-maps-types' ;
8
9
import { CircleManager } from '../services/managers/circle-manager' ;
9
10
import { InfoWindowManager } from '../services/managers/info-window-manager' ;
@@ -153,6 +154,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
153
154
*/
154
155
zoomControl : boolean = true ;
155
156
157
+ /**
158
+ * Options for the Zoom control.
159
+ */
160
+ zoomControlOptions : ZoomControlOptions ;
161
+
156
162
/**
157
163
* Styles to apply to each of the default map types. Note that for Satellite/Hybrid and Terrain
158
164
* modes, these styles will only apply to labels and geometry.
@@ -173,6 +179,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
173
179
*/
174
180
streetViewControl : boolean = true ;
175
181
182
+ /**
183
+ * Options for the Street View control.
184
+ */
185
+ streetViewControlOptions : StreetViewControlOptions ;
186
+
176
187
/**
177
188
* Sets the viewport to contain the given bounds.
178
189
*/
@@ -183,18 +194,60 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
183
194
*/
184
195
scaleControl : boolean = false ;
185
196
197
+ /**
198
+ * Options for the scale control.
199
+ */
200
+ scaleControlOptions : ScaleControlOptions ;
201
+
186
202
/**
187
203
* The initial enabled/disabled state of the Map type control.
188
204
*/
189
205
mapTypeControl : boolean = false ;
190
206
207
+ /**
208
+ * Options for the Map type control.
209
+ */
210
+ mapTypeControlOptions : MapTypeControlOptions ;
211
+
212
+ /**
213
+ * The initial enabled/disabled state of the Pan control.
214
+ */
215
+ panControl : boolean = false ;
216
+
217
+ /**
218
+ * Options for the Pan control.
219
+ */
220
+ panControlOptions : PanControlOptions ;
221
+
222
+ /**
223
+ * The initial enabled/disabled state of the Rotate control.
224
+ */
225
+ rotateControl : boolean = false ;
226
+
227
+ /**
228
+ * Options for the Rotate control.
229
+ */
230
+ rotateControlOptions : RotateControlOptions ;
231
+
232
+ /**
233
+ * The initial enabled/disabled state of the Fullscreen control.
234
+ */
235
+ fullscreenControl : boolean = false ;
236
+
237
+ /**
238
+ * Options for the Fullscreen control.
239
+ */
240
+ fullscreenControlOptions : FullscreenControlOptions ;
241
+
191
242
/**
192
243
* Map option attributes that can change over time
193
244
*/
194
245
private static _mapOptionsAttributes : string [ ] = [
195
246
'disableDoubleClickZoom' , 'scrollwheel' , 'draggable' , 'draggableCursor' , 'draggingCursor' ,
196
- 'keyboardShortcuts' , 'zoomControl' , 'styles' , 'streetViewControl' , 'zoom' , 'mapTypeControl' ,
197
- 'minZoom' , 'maxZoom'
247
+ 'keyboardShortcuts' , 'zoomControl' , 'zoomControlOptions' , 'styles' , 'streetViewControl' ,
248
+ 'streetViewControlOptions' , 'zoom' , 'mapTypeControl' , 'mapTypeControlOptions' , 'minZoom' ,
249
+ 'maxZoom' , 'panControl' , 'panControlOptions' , 'rotateControl' , 'rotateControlOptions' ,
250
+ 'fullscreenControl' , 'fullscreenControlOptions'
198
251
] ;
199
252
200
253
private _observableSubscriptions : Subscription [ ] = [ ] ;
@@ -253,16 +306,28 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
253
306
minZoom : this . minZoom ,
254
307
maxZoom : this . maxZoom ,
255
308
disableDefaultUI : this . disableDefaultUI ,
309
+ disableDoubleClickZoom : this . disableDoubleClickZoom ,
310
+ scrollwheel : this . scrollwheel ,
256
311
backgroundColor : this . backgroundColor ,
257
312
draggable : this . draggable ,
258
313
draggableCursor : this . draggableCursor ,
259
314
draggingCursor : this . draggingCursor ,
260
315
keyboardShortcuts : this . keyboardShortcuts ,
261
- zoomControl : this . zoomControl ,
262
316
styles : this . styles ,
317
+ zoomControl : this . zoomControl ,
318
+ zoomControlOptions : this . zoomControlOptions ,
263
319
streetViewControl : this . streetViewControl ,
320
+ streetViewControlOptions : this . streetViewControlOptions ,
264
321
scaleControl : this . scaleControl ,
265
- mapTypeControl : this . mapTypeControl
322
+ scaleControlOptions : this . scaleControlOptions ,
323
+ mapTypeControl : this . mapTypeControl ,
324
+ mapTypeControlOptions : this . mapTypeControlOptions ,
325
+ panControl : this . panControl ,
326
+ panControlOptions : this . panControlOptions ,
327
+ rotateControl : this . rotateControl ,
328
+ rotateControlOptions : this . rotateControlOptions ,
329
+ fullscreenControl : this . fullscreenControl ,
330
+ fullscreenControlOptions : this . fullscreenControlOptions ,
266
331
} ) ;
267
332
268
333
// register event listeners
@@ -280,12 +345,12 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
280
345
}
281
346
282
347
/* @internal */
283
- ngOnChanges ( changes : { [ propName : string ] : SimpleChange } ) {
348
+ ngOnChanges ( changes : SimpleChanges ) {
284
349
this . _updateMapOptionsChanges ( changes ) ;
285
350
this . _updatePosition ( changes ) ;
286
351
}
287
352
288
- private _updateMapOptionsChanges ( changes : { [ propName : string ] : SimpleChange } ) {
353
+ private _updateMapOptionsChanges ( changes : SimpleChanges ) {
289
354
let options : { [ propName : string ] : any } = { } ;
290
355
let optionKeys =
291
356
Object . keys ( changes ) . filter ( k => AgmMap . _mapOptionsAttributes . indexOf ( k ) !== - 1 ) ;
@@ -307,7 +372,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
307
372
} ) ;
308
373
}
309
374
310
- private _updatePosition ( changes : { [ propName : string ] : SimpleChange } ) {
375
+ private _updatePosition ( changes : SimpleChanges ) {
311
376
if ( changes [ 'latitude' ] == null && changes [ 'longitude' ] == null &&
312
377
changes [ 'fitBounds' ] == null ) {
313
378
// no position update needed
0 commit comments