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

Allow changing the feature.mouseover order. #807

Merged
merged 2 commits into from
Apr 11, 2018
Merged

Allow changing the feature.mouseover order. #807

merged 2 commits into from
Apr 11, 2018

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Apr 10, 2018

Add an event that allows changing the selection order for feature.mouseover. Also, add two common handlers for such ordering.

Specifically, the geo.event.feature.mouseover_order event is triggered if the mouse is located on multiple elements of a feature. The feature.mouseOverOrderHighestIndex function will always sort these so that the highest index element is on top. The polygonFeature.mouseOverOrderClosestBorder function will sort polygons so that they are sorted based on how far the mouse is from their borders, with the closest on top. Note that, as always, the mouse must be within the polygon for it to be considered.

@manthey
Copy link
Contributor Author

manthey commented Apr 10, 2018

You can try this out in the local tutorial editor (you'll need to fix the url's host and port).

@manthey manthey changed the base branch from polygon-stroke-order to master April 11, 2018 16:36
manthey added 2 commits April 11, 2018 12:37
Add an event that allows changing the selection order for
feature.mouseover.  Also, add two common handlers for such ordering.

Specifically, the geo.event.feature.mouseover_order event is triggered
if the mouse is located on multiple elements of a feature.  The
`feature.mouseOverOrderHighestIndex` function will always sort these so
that the highest index element is on top.  The
`polygonFeature.mouseOverOrderClosestBorder` function will sort polygons
so that they are sorted based on how far the mouse is from their
borders, with the closest on top.  Note that, as always, the mouse must
be within the polygon for it to be considered.
One event is generate per feature that is under the mouse when a mouse
click is generated on features.  By reordering them, this affects the
order those events are generated and tags a different event as the top
element.

This also fixes some documentation.
@manthey
Copy link
Contributor Author

manthey commented Apr 11, 2018

Here is another tutorial that will show the mouse click ordering.

Copy link

@matthewma7 matthewma7 left a comment

Choose a reason for hiding this comment

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

Works great for me and my use case! Thank you for this feature @manthey.

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.

2 participants