Skip to content

Drawing.bBox measures multi-line text incorrectly #973

@rreusser

Description

@rreusser
Contributor

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

Activity

etpinard

etpinard commented on Jun 16, 2017

@etpinard
Contributor

This one should be resolved in @alexcjohnson 's #1792

alexcjohnson

alexcjohnson commented on Jun 16, 2017

@alexcjohnson
Collaborator

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 3b293ac 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rreusser@alexcjohnson@etpinard

        Issue actions

          Drawing.bBox measures multi-line text incorrectly · Issue #973 · plotly/plotly.js