waterWang opened a new pull request, #21717:
URL: https://github.com/apache/echarts/pull/21717

   fix(pie): correct label background width when backgroundColor and lineHeight 
both set with overflow break
   
   ## Problem
   When a pie chart label has both `backgroundColor` and `overflow: 'break'` 
set,
   and `lineHeight` is explicitly set, the label background width is abnormally
   wide (inflated to the full available width).
   
   ## Root cause
   In `constrainTextWidth`, when measuring the text bounding box for overflow
   wrap, `backgroundColor` is temporarily set to `null`. However, zrender's
   `needDrawBackground()` returns `true` when `lineHeight` is set, even without
   `backgroundColor`. This creates a background rect at the full 
`availableWidth`,
   which inflates `getBoundingRect().width`.
   
   ## Fix
   Temporarily set `lineHeight` to `null` during measurement, preventing the
   spurious background rect from being created. `lineHeight` only affects 
vertical
   spacing and does not affect horizontal text wrapping width.
   
   ## Test
   Added a unit test that creates a pie chart with label backgroundColor,
   overflow: 'break', and lineHeight, then verifies the label bounding rect
   width is not inflated beyond the label text width.
   
   Closes #21710


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to