-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(google-maps): support setting the map type #18578
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
mapConstructorSpy = createMapConstructorSpy(mapSpy).and.callThrough(); | ||
|
||
const fixture = TestBed.createComponent(TestApp); | ||
fixture.componentInstance.mapTypeId = 'terrain' as unknown as google.maps.MapTypeId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not google.maps.MapTypeId.TERRAIN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the global google
variable isn't available when running unit tests.
@@ -249,6 +258,9 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy { | |||
|
|||
ngOnChanges() { | |||
this._setSize(); | |||
if (this._googleMap && this.mapTypeId) { | |||
this._googleMap.setMapTypeId(this.mapTypeId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will call setMapTypeId for every change. My preference would be to continue the existing pattern, or failing that, at least include a check that the mapTypeId has changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, but from what I can tell, the Google Maps API already knows not to do anything if you're giving it the same map type that it already has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sounds good
LGTM |
Needs rebase |
Adds support for setting the `mapTypeId` which determines the kind of map that will be shown (e.g. terrain map, roadmap etc). Fixes angular#18577.
ded2308
to
5be0633
Compare
Rebased. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds support for setting the
mapTypeId
which determines the kind of map that will be shown (e.g. terrain map, roadmap etc).Fixes #18577.