samar121 opened a new pull request, #9888: URL: https://github.com/apache/nifi/pull/9888
🛠️ Fix: Label rendering issue in boundedMultilineEllipsis This MR addresses a bug where SVG labels using boundedMultilineEllipsis were not displaying correctly when rendered via D3, especially during interactions like dragging or viewport changes. ✅ Root Cause: The issue stemmed from inaccurate line height and line count calculations, which affected label wrapping and positioning. In some cases, the initial tspan was not receiving the proper y attribute, causing the entire label to be misaligned or not visible. 🔧 Fix Details: Reordered the logic inside the while (word) loop to: 1. Assign y position immediately on first word append, ensuring the tspan gets positioned correctly even for single-word lines. 2. Calculate lineHeight and lineCount using getBoundingClientRect() only once (on the first word of the first line), improving performance and consistency. 3. Preserve leading spaces using xml:space="preserve" to match label formatting. 4. Ensure all wrapped lines are properly positioned using dy="1.2em" and line limit logic. 📷 Screenshots: Before (Broken Labels):  After (Fixed Labels):  🔬 Validation: Tested rendering behavior on: 1. Long and short label strings 2. Multi-line wrapping scenarios 3. Resizing, dragging, zooming, and panning All scenarios now render correctly as expected. 📌 Note: This fix improves layout consistency and ensures robust label handling across different canvas states and screen sizes. -- 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]
