This repository has been archived by the owner on Aug 14, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add comments to reduce confusion risks
- Loading branch information
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for future reference: comments in YAML start with
#
instead of//
(https://yaml.org/spec/1.2/spec.html#id2780069) 😅5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea what went wrong and how I failed to catch this. I was sure that I tested this as usual.
Maybe app install failed for an unrelated reason and I have not noticed this? Because both testing in app and in Tangram Play would reveal this.
Thanks for catching this terribleness and sorry for not catching it myself.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem at all! I was just wondering why the preview at https://ent8r.github.io/streetcomplete-mapstyle wasn't working as expected 😄
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, do you have any idea how to avoid styling outside the map style in streetcomplete/StreetComplete#1877 ?
I tried to both increase text as user zoom in and apply system text scaling and ended with an ugly hack.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following might work in any case:
Anyway, I'm currently experimenting a little bit with Tangram Play and will tell you if I found something new, maybe an easier solution...
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooo, so function was supposed to return a number - not a stop array! That is great!
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it would work in any way with a stop array instead of a simple number, but testing it with something like the following led to no success, so it might be true that functions must return a number and no array...
The following does not work because it seems that calculations (like a multiplication) are only possible in the context of a function
So the only solution that seems to be working is the one I posted above.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ENT8R Are you sure that it is actually working? From what I see it is computed once and not recalculated, so changing zoom level is not changing text size. I tested it in Tangram Play and in a compiled app.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it works even without reloading the page:
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why breakpoints at all though and not just a function?
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though, road widths are also defined with stop positions, so maybe it is better if text scales when they scale.
https://github.com/ENT8R/streetcomplete-mapstyle/blob/master/layers/roads.yaml#L59
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solely because breakpoints was the first viable solution that I found (there was no other reason for that).
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
road widths are linearly scaled between specified breakpoints, there are no sudden jumps. If smooth text scaling works then it is almost certainly preferable.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful. In Android App it silently fails, requires "px" string to be attached to the returned value. Then it works.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears to be quantized to full zoom levels anyway.
5dcfd32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, $zoom is unfortunately only full zoom levels. If not, it could have been used to display the actual width of a road, see tangrams/tangram-es#2144