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

Add Scale bar plugin #955

Merged
merged 19 commits into from
May 29, 2019
Merged

Add Scale bar plugin #955

merged 19 commits into from
May 29, 2019

Conversation

Chaoba
Copy link
Contributor

@Chaoba Chaoba commented May 15, 2019

Resolves #11
ezgif com-resize (2)

Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

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

Looks great @Chaoba! did a quick initial review. Will try finding some time to run this against the profiler. Would be great if you could add some tests in the meantime.

Kevin Li and others added 5 commits May 17, 2019 08:09
…y/scalebar/ScalebarActivity.kt

Co-Authored-By: Langston Smith <langston.smith@mapbox.com>
…ar.java

Co-Authored-By: Langston Smith <langston.smith@mapbox.com>
…arWidget.java

Co-Authored-By: Langston Smith <langston.smith@mapbox.com>
@Chaoba
Copy link
Contributor Author

Chaoba commented May 20, 2019

@tobrun When using double click to zoom in, ScaleListener can't get notified, how can we handle this scenario?

@LukasPaczos
Copy link
Member

@Chaoba instead of using MapboxMap.OnScaleListener I think it'd better to use OnCameraMoveListener and invalidate the view whenever zoom or latitude changes. Additionally, it'd be great to cache camera values and invalidate the view in loops, every x milliseconds (if the camera position value has changed) instead of on each update which can be extremely frequent.

@langsmith langsmith mentioned this pull request May 20, 2019
@Chaoba Chaoba changed the title [WIP] Add Scale bar plugin Add Scale bar plugin May 22, 2019
@Chaoba Chaoba added the ready for review When your PR has been personally reviewed, its time for an external contributors to approve label May 22, 2019
Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

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

A couple of comments below. Generally looks great!

When it comes to exposing the setters, the more the better, but I've marked only the ones that I feel are necessary to match basic use-cases. An Options class (basically a builder approach) would fit nicely. You could provide those options to the widget through the plugin's constructor, or even in the runtime.

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

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

I've done a little bit more tests with the current setup on the Pixel 2 XL - rapidly zooming in and out:

Refresh interval ScaleBarWidget#onDraw processor time %
5ms 0.65%
10ms 0.54%
16ms 0.46%
25ms 0.20%
100ms 0.18%

From the above, I think it's safe to decrease the default minimum refresh interval to 15ms. It increases the UX on performant devices by allowing us to render the widget in around 60 FPS and doesn't lose pace to the map renderer visually. The interval can be adjusted to lower end devices by developers.

Kevin Li and others added 3 commits May 29, 2019 12:24
…arOption.java

Co-Authored-By: Langston Smith <langston.smith@mapbox.com>
…y/scalebar/ScalebarActivity.kt

Co-Authored-By: Langston Smith <langston.smith@mapbox.com>
Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit:

Please rebase and clean up the git history before merging, or use the squash merge.

@LukasPaczos LukasPaczos added this to the scalebar-0.1.0 milestone May 29, 2019
@Chaoba Chaoba merged commit e811054 into master May 29, 2019
@Chaoba
Copy link
Contributor Author

Chaoba commented May 29, 2019

@LukasPaczos Thanks for your help. 🚀

@virtuoso80
Copy link

Tried it works and looks great. It would be nicer though if you could define a fixed horizontal size for the Scale Bar so that it doesn't constantly resize itself. Thanks

@LukasPaczos
Copy link
Member

Hey @virtuoso80, thanks for the feedback! Could you cut a separate ticket for your request? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review When your PR has been personally reviewed, its time for an external contributors to approve
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scale Widget Plugin
5 participants