Skip to content

Add Scale bar plugin - #955

Merged
Chaoba merged 19 commits into
masterfrom
kl-scalebar
May 29, 2019
Merged

Chaoba merged 19 commits into
masterfrom
kl-scalebar

Conversation

@Chaoba

@Chaoba Chaoba commented May 15, 2019 •

Copy link
Copy Markdown
Contributor

Resolves #11
ezgif com-resize (2)

@Chaoba Chaoba self-assigned this May 15, 2019

@tobrun tobrun left a comment

Copy link
Copy Markdown
Member

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.

Comment thread app/build.gradle Resolved
@Chaoba

Chaoba commented May 20, 2019

Copy link
Copy Markdown
Contributor Author

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

@LukasPaczos

Copy link
Copy Markdown
Contributor

@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

@LukasPaczos LukasPaczos left a comment

Copy link
Copy Markdown
Contributor

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.

@LukasPaczos LukasPaczos left a comment

Copy link
Copy Markdown
Contributor

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
Comment thread plugin-scalebar/build.gradle Resolved

@LukasPaczos LukasPaczos left a comment

Copy link
Copy Markdown
Contributor

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

Chaoba commented May 29, 2019

Copy link
Copy Markdown
Contributor Author

@LukasPaczos Thanks for your help. 🚀

@virtuoso80

Copy link
Copy Markdown

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
Copy Markdown
Contributor

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