-
-
Notifications
You must be signed in to change notification settings - Fork 65
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, |
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:baseline
(default)center
top
Examples
Center
Top
Baseline (default, current behaviour)
Mixed
API Modifications
Add new property to style override object of
format
expression:vertical-align
:enum
baseline
baseline
,center
,top
format
expression elementBehaviour
baseline
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: