Skip to content

Commit

Permalink
Vertical alignment in format expression (#5043)
Browse files Browse the repository at this point in the history
* add support for `top` alingment

* add support for "center" alignment

* add comments

* render tests

* handle vertical text

* cleanout

* update top alignment

* cleanout

* refactor shaping

* Fix vertical alignment

* fix bbox size

* adjust line spacing

* vertical placement

* cleanout

* handle text offset

* minor fix

* const glyph height

* align when no big image

* use section.scale when multiplying on image

* fix big image case

* fix vertical

* simplify imageOffset calculation

* code simplification

* improve readability

* cleaning - removing dead code

* fix only images case

* cleaning + update render tests

* bump maplibre-style-spec version

* update bundle size

* use style spec type

* fix verticalAlign rendering tests

* improve justifyLine readabilty

* refactor getRectAndMetrics

* use switch in getVerticalAlignFactor

* split calculateLineContentSize fn to improve readability

* Revert "split calculateLineContentSize fn to improve readability"

This reverts commit b87ecdd.

* clearing

* improve calculateLineContentSize return type

* move isVertical outside shaping fn

* remove redundant imageName variable

* small shapeLines code simplification

* split shapeLines fn

* fix lint

* add tests for vertical align

* fix lint in test file

* move type definitions to the top of the file

* simplify shapeLines adding sectionAttributes object

* add return type to TaggedString.getMaxImageSize

* add changelog

* update render test files "baseline" -> "bottom"

---------

Co-authored-by: Zbigniew Matysek <[email protected]>
  • Loading branch information
1 parent 0b73fe0 commit b4035a7
Show file tree
Hide file tree
Showing 10 changed files with 871 additions and 82 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### ✨ Features and improvements

- Add support for `vertical-align` in `format` expression ([specification](https://maplibre.org/maplibre-style-spec/expressions/#format))([#5043](https://github.com/maplibre/maplibre-gl-js/pull/5043)).
- _...Add new stuff here..._

### 🐞 Bug fixes
Expand Down
296 changes: 220 additions & 76 deletions src/symbol/shaping.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/build/min.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('test min build', () => {
const decreaseQuota = 4096;

// feel free to update this value after you've checked that it has changed on purpose :-)
const expectedBytes = 908628;
const expectedBytes = 909795;

expect(actualBytes).toBeLessThan(expectedBytes + increaseQuota);
expect(actualBytes).toBeGreaterThan(expectedBytes - decreaseQuota);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b4035a7

Please sign in to comment.