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(direction): add a toogle to control user interaction with map #1396

Merged
merged 6 commits into from
Sep 21, 2023

Conversation

pelord
Copy link
Member

@pelord pelord commented Sep 19, 2023

Please check if the PR fulfills these requirements

What is the current behavior? (You can also link to an open issue here)
There is no method to disable map's interaction from the user.

What is the new behavior?
Add a toogle to allow the user to enable/disable the map interaction.

This is useful if the user wants to query the map, not add a intermediate point.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications:

Other information:

@pelord pelord requested a review from alecarn September 19, 2023 20:59
packages/geo/src/lib/directions/directions.component.ts Outdated Show resolved Hide resolved
Comment on lines 449 to 457
if (toggle) {
this.interactions.map((interaction) =>
this.routesFeatureStore.layer.map.ol.addInteraction(interaction)
);
} else {
this.interactions.map((interaction) =>
this.routesFeatureStore.layer.map.ol.removeInteraction(interaction)
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Simplification possible:

Suggested change
if (toggle) {
this.interactions.map((interaction) =>
this.routesFeatureStore.layer.map.ol.addInteraction(interaction)
);
} else {
this.interactions.map((interaction) =>
this.routesFeatureStore.layer.map.ol.removeInteraction(interaction)
);
}
const ol = this.routesFeatureStore.layer.map.ol;
this.interactions.map((interaction) =>
toggle ? ol.addInteraction(interaction) : ol.removeInteraction(interaction);
);

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Good idea!

packages/geo/src/lib/directions/directions.component.html Outdated Show resolved Hide resolved
@pelord pelord merged commit cdea457 into release/16.0.0 Sep 21, 2023
1 check passed
@pelord pelord deleted the directionControl branch September 21, 2023 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants