Skip to content

Target element get clipped when it has a margin #56

@Talcite

Description

@Talcite

I'm unsure if this is a configuration problem on client side, but if the target element of snapshot has a margin, the output image will be clipped. Below I have added a margin to the demo box and this was the result:

Image

Demo: https://codepen.io/Talcite/pen/zxGmjYa

The image generation viewport seems to have "remembered" the position of the element and stick to that way, assuming it has no margin. Therefore, it no longer reflect the true position of the element.

Besides, the dimensions of exported PNG (and the SVG viewport) are not exactly the same as the displayed pixel dimension of the target element; the image is usually larger. This is not a real concern though, but I hope that the feature will be added in the future to allow user to specify an exact value of output image size (have seen this request in another issue), or the only way left is to fumble with the scale option and do some math.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions