ecomfe / zrender

A lightweight graphic library providing 2d draw for Apache ECharts
https://ecomfe.github.io/zrender-doc/public/
BSD 3-Clause "New" or "Revised" License
6.06k stars 1.56k forks source link

fix(text): not need fixed bounding box when contentWidth min than style.width #1091

Closed linghaoSu closed 1 week ago

linghaoSu commented 4 months ago

When overflow is set and style.width is not empty, a fixed boundingBox is used, where the x value of the boundingBox is adjusted according to style.width.

https://github.com/ecomfe/zrender/blob/247e11966657fb0fd3d92533e15e8b655bff3327/src/graphic/Text.ts#L604-L614

However, when the width of the text is smaller than the set style.width, the boundingBox will be positioned to the left, as shown in the following figure.

image

https://github.com/user-attachments/assets/b4de2455-b083-4bdf-9b8b-ff8b5c9bb0d0

fix https://github.com/apache/echarts/issues/18306

plainheart commented 1 week ago

Thank you for your contribution! It was superseded by #1100.