Skip to content

Bounding box calculations are incorrect for miter stroke joins #90

@adroitwhiz

Description

@adroitwhiz

Expected Behavior

SvgRenderer._transformMeasurements() should always resize the SVG's viewBox to at least the size of every element in the SVG, with no clipping.

Actual Behavior

_transformMeasurements doesn't take into account the extra bounding box space added by miter (pointy-cornered) strokes. See this test case.

This is because it compensates for getBBox() not adding stroke widths by manually enlarging the bounding box by half the largest stroke with in the SVG. This works for circular and bevel joins, but not for miter joins, which can stick out arbitrarily far depending on what the element's stroke-miterlimit is set to.

The only cross-browser way I can think of to fix this is to manually calculate the miters' bounds, but this could get messy. Any other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions