Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

Export to canvas only selected elements (#323)

Christopher Chedeau157f0eae0c84
diff --git a/src/components/SidePanel.tsx b/src/components/SidePanel.tsx
index 6e119fac35..428dc4a90b 100644
--- a/src/components/SidePanel.tsx
+++ b/src/components/SidePanel.tsx
@@ -136,9 +136,12 @@ export const SidePanel: React.FC<SidePanelProps> = ({
syncActionResult={syncActionResult}
elements={elements}
appState={appState}
- onExportCanvas={(type: ExportType) =>
- exportCanvas(type, elements, canvas, appState)
- }
+ onExportCanvas={(type: ExportType) => {
+ const exportedElements = elements.some(element => element.isSelected)
+ ? elements.filter(element => element.isSelected)
+ : elements;
+ return exportCanvas(type, exportedElements, canvas, appState);
+ }}
/>
</div>
);