feat: add logo into export
This commit is contained in:
+30
-1
@@ -16,7 +16,14 @@ import {
|
||||
FontString,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "./element/types";
|
||||
import { AppState, DataURL, Dimensions, LastActiveTool, Zoom } from "./types";
|
||||
import {
|
||||
AppState,
|
||||
DataURL,
|
||||
Dimensions,
|
||||
ExportPadding,
|
||||
LastActiveTool,
|
||||
Zoom,
|
||||
} from "./types";
|
||||
import { unstable_batchedUpdates } from "react-dom";
|
||||
import { SHAPES } from "./shapes";
|
||||
import { isEraserActive, isHandToolActive } from "./appState";
|
||||
@@ -1052,3 +1059,25 @@ export const expandToAspectRatio = (
|
||||
height: newHeight,
|
||||
};
|
||||
};
|
||||
|
||||
const isExportPadding = (value: any): value is ExportPadding => {
|
||||
return (
|
||||
Array.isArray(value) &&
|
||||
value.length === 4 &&
|
||||
value.every((item) => typeof item === "number")
|
||||
);
|
||||
};
|
||||
|
||||
export const convertToExportPadding = (
|
||||
padding: number | ExportPadding,
|
||||
): ExportPadding => {
|
||||
if (typeof padding === "number") {
|
||||
return [padding, padding, padding, padding];
|
||||
}
|
||||
|
||||
if (isExportPadding(padding)) {
|
||||
return padding;
|
||||
}
|
||||
|
||||
throw new Error("Invalid padding value");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user