}
export async function importBoard(prevState: FormState, formData: FormData): Promise<FormState> {
- const boardIdsRaw = formData.get('board');
+ const boardIdsRaw = formData.getAll('board');
if (!boardIdsRaw) {
return prevState;
}
- const boardIds: string[] = Array.isArray(boardIdsRaw) ? boardIdsRaw : [boardIdsRaw] as string[];
+ const boardIds: string[] = Array.isArray(boardIdsRaw) ? boardIdsRaw as string[] : [boardIdsRaw] as string[];
// Get board from Miro API
const { miro, userId } = initMiroAPI();
// The coordinate system in Miro is different from the coordinate system in Neoboard.
// In Neoboard the frames are only neoboardWhiteboardWidth wide and whiteboardHeight tall.
+ const neoboardPadding = 10;
+
// The first step is to find the bounding box of all the slides.
let minX = Number.MAX_SAFE_INTEGER;
let minY = Number.MAX_SAFE_INTEGER;
// The second step is to scale all the elements to fit within the bounding box.
const width = maxX - minX;
const height = maxY - minY;
- const scale = Math.min((neoboardWhiteboardWidth - 5) / width, (neoboardWhiteboardHeight - 5) / height);
+ const scale = Math.min((neoboardWhiteboardWidth - neoboardPadding) / width, (neoboardWhiteboardHeight - neoboardPadding) / height);
const transformedBoard: Whiteboard = {
version: board.version,
borderRadius = 25;
}
+ const neoboardPadding = 5;
+
const opacity = item.style?.fillOpacity ?? (item.style?.fillColor ? "1.0" : "0.0");
const borderColorOpacity = item.style?.borderOpacity ?? "1.0";
x: item.position?.x ?? 0,
y: item.position?.y ?? 0,
},
- width: item.geometry?.width ?? 1,
- height: item.geometry?.height ?? 1,
+ width: (item.geometry?.width ?? 1) + neoboardPadding,
+ height: (item.geometry?.height ?? 1) + neoboardPadding,
fillColor: opacity === "1.0" ? (item.style?.fillColor ?? "#ffffff") : "transparent",
strokeColor: borderColorOpacity === "1.0" ? (item.style?.borderColor ?? "#1a1a1a") : "transparent",
strokeWidth: parseFloat(item.style?.borderWidth ?? "2.0"),