Skip to content

how does drawElement interact with devicePixelRatio and/or how can one be specified?Β #30

@greggman

Description

@greggman

the readme on this issue says:

drawElement(element ...) takes the CTM (current transform matrix) of the canvas into consideration. The image drawn into the canvas is sized to element's border box size;

But that is not enough into to know how to render when wanting to take devicePixelRatio into account.

Assume a devicePixelRatio of 3.5 from a Samsung S20 Ultra. Given an element with a border box size of 400x300 CSS pixels, to match the HTML I'd want that rendered to 1400x1050 in the canvas. It doesn't seem like there is a way to know apriori what size the developer wants. Should a devicePixelRatio option be add to the options? Or maybe there's some other solution like making a container element that is 400x300 but setting it's zoom to 350%. Just throwing out 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