|
1 | 1 | import {
|
2 |
| - AfterViewInit, |
| 2 | + afterNextRender, |
3 | 3 | ChangeDetectionStrategy,
|
4 | 4 | Component,
|
5 | 5 | ElementRef,
|
@@ -55,7 +55,6 @@ export class MapComponent
|
55 | 55 | implements
|
56 | 56 | OnChanges,
|
57 | 57 | OnDestroy,
|
58 |
| - AfterViewInit, |
59 | 58 | Omit<MapboxOptions, 'bearing' | 'container' | 'pitch' | 'zoom'>,
|
60 | 59 | MapEvent
|
61 | 60 | {
|
@@ -309,63 +308,63 @@ export class MapComponent
|
309 | 308 |
|
310 | 309 | @ViewChild('container', { static: true }) mapContainer: ElementRef;
|
311 | 310 |
|
312 |
| - constructor(private mapService: MapService) {} |
313 |
| - |
314 |
| - ngAfterViewInit() { |
315 |
| - this.warnDeprecatedOutputs(); |
316 |
| - this.mapService.setup({ |
317 |
| - accessToken: this.accessToken, |
318 |
| - customMapboxApiUrl: this.customMapboxApiUrl, |
319 |
| - mapOptions: { |
320 |
| - collectResourceTiming: this.collectResourceTiming, |
321 |
| - container: this.mapContainer.nativeElement, |
322 |
| - crossSourceCollisions: this.crossSourceCollisions, |
323 |
| - fadeDuration: this.fadeDuration, |
324 |
| - minZoom: this.minZoom, |
325 |
| - maxZoom: this.maxZoom, |
326 |
| - minPitch: this.minPitch, |
327 |
| - maxPitch: this.maxPitch, |
328 |
| - style: this.style, |
329 |
| - hash: this.hash, |
330 |
| - interactive: this.interactive, |
331 |
| - bearingSnap: this.bearingSnap, |
332 |
| - pitchWithRotate: this.pitchWithRotate, |
333 |
| - clickTolerance: this.clickTolerance, |
334 |
| - attributionControl: this.attributionControl, |
335 |
| - logoPosition: this.logoPosition, |
336 |
| - failIfMajorPerformanceCaveat: this.failIfMajorPerformanceCaveat, |
337 |
| - preserveDrawingBuffer: this.preserveDrawingBuffer, |
338 |
| - refreshExpiredTiles: this.refreshExpiredTiles, |
339 |
| - maxBounds: this.maxBounds, |
340 |
| - scrollZoom: this.scrollZoom, |
341 |
| - boxZoom: this.boxZoom, |
342 |
| - dragRotate: this.dragRotate, |
343 |
| - dragPan: this.dragPan, |
344 |
| - keyboard: this.keyboard, |
345 |
| - doubleClickZoom: this.doubleClickZoom, |
346 |
| - touchPitch: this.touchPitch, |
347 |
| - touchZoomRotate: this.touchZoomRotate, |
348 |
| - trackResize: this.trackResize, |
349 |
| - center: this.center, |
350 |
| - zoom: this.zoom, |
351 |
| - bearing: this.bearing, |
352 |
| - pitch: this.pitch, |
353 |
| - renderWorldCopies: this.renderWorldCopies, |
354 |
| - maxTileCacheSize: this.maxTileCacheSize, |
355 |
| - localIdeographFontFamily: this.localIdeographFontFamily, |
356 |
| - transformRequest: this.transformRequest, |
357 |
| - bounds: this.bounds ? this.bounds : this.fitBounds, |
358 |
| - fitBoundsOptions: this.fitBoundsOptions, |
359 |
| - antialias: this.antialias, |
360 |
| - locale: this.locale, |
361 |
| - cooperativeGestures: this.cooperativeGestures, |
362 |
| - projection: this.projection, |
363 |
| - }, |
364 |
| - mapEvents: this, |
| 311 | + constructor(private mapService: MapService) { |
| 312 | + afterNextRender(() => { |
| 313 | + this.warnDeprecatedOutputs(); |
| 314 | + this.mapService.setup({ |
| 315 | + accessToken: this.accessToken, |
| 316 | + customMapboxApiUrl: this.customMapboxApiUrl, |
| 317 | + mapOptions: { |
| 318 | + collectResourceTiming: this.collectResourceTiming, |
| 319 | + container: this.mapContainer.nativeElement, |
| 320 | + crossSourceCollisions: this.crossSourceCollisions, |
| 321 | + fadeDuration: this.fadeDuration, |
| 322 | + minZoom: this.minZoom, |
| 323 | + maxZoom: this.maxZoom, |
| 324 | + minPitch: this.minPitch, |
| 325 | + maxPitch: this.maxPitch, |
| 326 | + style: this.style, |
| 327 | + hash: this.hash, |
| 328 | + interactive: this.interactive, |
| 329 | + bearingSnap: this.bearingSnap, |
| 330 | + pitchWithRotate: this.pitchWithRotate, |
| 331 | + clickTolerance: this.clickTolerance, |
| 332 | + attributionControl: this.attributionControl, |
| 333 | + logoPosition: this.logoPosition, |
| 334 | + failIfMajorPerformanceCaveat: this.failIfMajorPerformanceCaveat, |
| 335 | + preserveDrawingBuffer: this.preserveDrawingBuffer, |
| 336 | + refreshExpiredTiles: this.refreshExpiredTiles, |
| 337 | + maxBounds: this.maxBounds, |
| 338 | + scrollZoom: this.scrollZoom, |
| 339 | + boxZoom: this.boxZoom, |
| 340 | + dragRotate: this.dragRotate, |
| 341 | + dragPan: this.dragPan, |
| 342 | + keyboard: this.keyboard, |
| 343 | + doubleClickZoom: this.doubleClickZoom, |
| 344 | + touchPitch: this.touchPitch, |
| 345 | + touchZoomRotate: this.touchZoomRotate, |
| 346 | + trackResize: this.trackResize, |
| 347 | + center: this.center, |
| 348 | + zoom: this.zoom, |
| 349 | + bearing: this.bearing, |
| 350 | + pitch: this.pitch, |
| 351 | + renderWorldCopies: this.renderWorldCopies, |
| 352 | + maxTileCacheSize: this.maxTileCacheSize, |
| 353 | + localIdeographFontFamily: this.localIdeographFontFamily, |
| 354 | + transformRequest: this.transformRequest, |
| 355 | + bounds: this.bounds ? this.bounds : this.fitBounds, |
| 356 | + fitBoundsOptions: this.fitBoundsOptions, |
| 357 | + antialias: this.antialias, |
| 358 | + locale: this.locale, |
| 359 | + cooperativeGestures: this.cooperativeGestures, |
| 360 | + projection: this.projection, |
| 361 | + }, |
| 362 | + mapEvents: this, |
| 363 | + }); |
| 364 | + if (this.cursorStyle) { |
| 365 | + this.mapService.changeCanvasCursor(this.cursorStyle); |
| 366 | + } |
365 | 367 | });
|
366 |
| - if (this.cursorStyle) { |
367 |
| - this.mapService.changeCanvasCursor(this.cursorStyle); |
368 |
| - } |
369 | 368 | }
|
370 | 369 |
|
371 | 370 | ngOnDestroy() {
|
|
0 commit comments