-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Vertical alignment in format expression #832
Comments
Thanks for taking the time to open the proposal! |
I understand your concern. I believe what you've mention can be achieved by combining together additional property. If we want to move single word a few pixels, we could add
For the padding between words the easiest solution is to use spaces. I'm not sure if this requires another solution. For the alternatives, we did think of numeric based approach, where value moves element up and down. There are two possibilities:
|
I propose to rename this property, because it suggests it works like https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align, but in reality is similar to the https://developer.mozilla.org/en-US/docs/Web/CSS/align-self. I belive showing the analogy to CSS properties can be helpful. It is easier to explain and adopt trough using existing terminology. Regarding the @HarelM concern on the extendibility of this proposal. I think it's pretty extensible. One solution is having relative offset property that @stanislawpuda-tomtom explained or a different set of properties altogether that may or may not be combained with the vertical-align. |
I would advise to bring this up in the monthly meeting to discuss this. |
Will do! Regarding the name, I went through few possible options:
But to be honest, |
@zbigniewmatysek-tomtom any feedback on the above? |
@HarelM If we decide to extend spec to support bottom alignment, it will be cumbersome to name it. I like the "Middle", since it reflects that alignment is in a single axis. How about And in the future (if someone finds it useful): |
I'm not sure baseline is intuitive, it's not intuitive to me at least... |
LGTM. I also don't see an use case for the bottom, but I wanted to raise this just in case. We can go with your proposal. |
What is the difference between bottom and baseline? |
It's the piece of text or image that the format override applies to. By the way, there is a CSS |
The behavior of css |
@zbigniewmatysek-tomtom Care to explain what the difference is? |
I think I understand what you mean.
Here pink is In fact, It does for table cells though: https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align |
I assume the tallest image of the format expression also participates in determining the top line? |
This is correct - the highest section of the line, can be either image or text |
Design Proposal: Add vertical alignment to format expression
Motivation
Format expression can facilitate multiple text and image elements of different sizes. At the moment all of them are aligned to the font baseline. It is not possible to change the vertical alignment. Having a possibility to change the alignment, eg. center, would allow us to create rich labels.
If following design would be accepted I would like to make contributions to this repo and MapLibre GL JS with the implementation.
Proposed Change
We would like to introduce
vertical-align
property to style override informat
expression.vertical-align
property can take three options:bottom
(default)center
top
Examples
Center
Top
Bottom (default, current behaviour)
Mixed
API Modifications
Add new property to style override object of
format
expression:vertical-align
:enum
bottom
bottom
,center
,top
format
expression elementBehaviour
bottom
default: text baseline and image bottom are in line (current behaviour)center
: image center and text center (line between baseline and top) are in line with center of the highest element in the rowtop
: image top and text top (line determined by the highest character in the font) are in lineIt is possible to set
vertical-align
for each element informat
expression separately.Migration Plan and Compatibility
There is no breaking change. Rendering of existing styles is unchanged. Only if style has new property
vertical-align
with non-default value, there is a difference in label rendering.The text was updated successfully, but these errors were encountered: