Skip to content
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

Merged
merged 1 commit into from Mar 21, 2020

Conversation

crisbeto
Copy link
Member

Adds support for setting the mapTypeId which determines the kind of map that will be shown (e.g. terrain map, roadmap etc).

Fixes #18577.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release labels Feb 21, 2020
@crisbeto crisbeto requested a review from a team as a code owner February 21, 2020 19:22
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 21, 2020
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Feb 27, 2020
mapConstructorSpy = createMapConstructorSpy(mapSpy).and.callThrough();

const fixture = TestBed.createComponent(TestApp);
fixture.componentInstance.mapTypeId = 'terrain' as unknown as google.maps.MapTypeId;
Copy link
Collaborator

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

Copy link
Member Author

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);
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good

@mbehrlich
Copy link
Collaborator

LGTM

@andrewseguin
Copy link
Contributor

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.
@crisbeto
Copy link
Member Author

Rebased.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for setMapTypeId in GoogleMap component
6 participants