mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: added exportPadding to PNG (blob) export in @excalidraw/utils (#5626)
* added exportPadding * Update README.md * Update CHANGELOG.md
This commit is contained in:
parent
da4fa91ffc
commit
836120c14b
3 changed files with 13 additions and 4 deletions
|
@ -35,7 +35,10 @@ export const exportToCanvas = ({
|
|||
files,
|
||||
maxWidthOrHeight,
|
||||
getDimensions,
|
||||
}: ExportOpts) => {
|
||||
exportPadding,
|
||||
}: ExportOpts & {
|
||||
exportPadding?: number;
|
||||
}) => {
|
||||
const { elements: restoredElements, appState: restoredAppState } = restore(
|
||||
{ elements, appState },
|
||||
null,
|
||||
|
@ -46,7 +49,7 @@ export const exportToCanvas = ({
|
|||
getNonDeletedElements(restoredElements),
|
||||
{ ...restoredAppState, offsetTop: 0, offsetLeft: 0, width: 0, height: 0 },
|
||||
files || {},
|
||||
{ exportBackground, viewBackgroundColor },
|
||||
{ exportBackground, exportPadding, viewBackgroundColor },
|
||||
(width: number, height: number) => {
|
||||
const canvas = document.createElement("canvas");
|
||||
|
||||
|
@ -87,6 +90,7 @@ export const exportToBlob = async (
|
|||
opts: ExportOpts & {
|
||||
mimeType?: string;
|
||||
quality?: number;
|
||||
exportPadding?: number;
|
||||
},
|
||||
): Promise<Blob> => {
|
||||
let { mimeType = MIME_TYPES.png, quality } = opts;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue