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: add scale bar layer #1821

Merged
merged 26 commits into from
Feb 19, 2024
Merged

feat: add scale bar layer #1821

merged 26 commits into from
Feb 19, 2024

Conversation

josxha
Copy link
Contributor

@josxha josxha commented Feb 7, 2024

To do

  • add scale bar as map layer
  • fix left padding partly outside screen when padding 0
  • fix top and left padding not the same
  • lineWidth is now strokeWidth
  • add lineHeight parameter
  • default to black as color
  • fix text rendererd partially outside of screen if the scalebar is very small
  • scalebar alignment
  • fix label overflow on right screen side
  • fix alignment of scalebar if it is smaller than the text

Known problems

  • When performing a fling animation against the top or bottom border, the scalebar increaes. I don't think that this is a bug of this pr, that's why it's not included here.

@josxha josxha added the feature This issue requests a new feature label Feb 7, 2024
@josxha josxha added this to the v7.0 milestone Feb 7, 2024
@josxha josxha self-assigned this Feb 7, 2024
@josxha

This comment was marked as outdated.

@josxha josxha marked this pull request as ready for review February 7, 2024 00:38
@josxha josxha removed the feature This issue requests a new feature label Feb 7, 2024
@josxha josxha marked this pull request as draft February 13, 2024 21:42
@josxha josxha marked this pull request as ready for review February 17, 2024 01:22
Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

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

LGTM I think. I also realised that this only supports one unit (metric), but maybe we can change this later.

lib/src/layer/scalebar/painter/base.dart Show resolved Hide resolved
@josxha
Copy link
Contributor Author

josxha commented Feb 19, 2024

I also realised that this only supports one unit (metric), but maybe we can change this later.

Yes, I experimented with an imperial scale a bit but it's a bit tricky since the calculations are metric and the the stop points of the scale bar need to be adjusted.

Are we ready to merge?

@JaffaKetchup
Copy link
Member

Yeah I think ready to merge. Maybe something like Google Maps double unit scale bar would work well in future.

@josxha
Copy link
Contributor Author

josxha commented Feb 19, 2024

Maybe something like Google Maps double unit scale bar would work well in future.

Yep, would be a nice addition.

@josxha josxha merged commit f22d3a4 into fleaflet:master Feb 19, 2024
7 checks passed
@josxha josxha deleted the scalebar-layer branch February 19, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants