-
Notifications
You must be signed in to change notification settings - Fork 76
Permit crop and fitTo in the render function #380
Copy link
Copy link
Open
Description
When working with extracting multiple
Presently crop can be used by changing the viewport, But fitTo is still a load-time parameter.
This is the awkward method for crop before render (broken in 2.6.x; working in 2.5.x.
Per issue: #287
const bbox = resvg.getBBox();
bbox.x=rect.x;
bbox.y=rect.y;
bbox.width = rect.width;
bbox.height = rect.height;
resvg.cropByBBox(bbox)
Unfortunately, fitTo is only usable in the constructor:
fitTo: {
mode: 'height',
value: 4096,
},
When cutting out multiple areas of an SVG file and rendering to multiple sizes, it would be a bit nicer to be able to supply fitTo and crop into the render function itself, so the SVG is only loaded once but usable for many outputs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels