Plotly.js: Drawing.bBox measures multi-line text incorrectly

Created on 22 Sep 2016  路  2Comments  路  Source: plotly/plotly.js

If text has <br>, it gets tspans and wraps onto multiple lines. If you pass the text node to Drawing.bBox though, it is measured as if the text is all on one line, giving the incorrect bBox.

In the example below, the text node is passed to Drawing.bBox. The 304 returned as the width is the _sum_ of the widths of each tspan. When it's rendered in updatemenus though, each tspan is on a separate line.

2016-09-22 17 17 21

bug

All 2 comments

This one should be resolved in @alexcjohnson 's https://github.com/plotly/plotly.js/pull/1792

Ah good catch @etpinard - yes, fix is included in #1792 (specifically https://github.com/plotly/plotly.js/pull/1792/files#diff-5d20f0f113b3fa06526a5ae593b7de34R640)- and we have tests that were previously testing the incorrect behavior and are now testing the correct behavior, such as https://github.com/plotly/plotly.js/pull/1792/commits/3b293ace4fe24f36466ba63a6ce8e4757b86559c :tada:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pynklu picture pynklu  路  3Comments

bryaan picture bryaan  路  3Comments

maxwell8888 picture maxwell8888  路  3Comments

etpinard picture etpinard  路  3Comments

WG- picture WG-  路  3Comments