Export to canvas only selected elements (#323)

Fixes #308
This commit is contained in:
Christopher Chedeau 2020-01-11 16:15:26 -08:00 committed by GitHub
parent 9fa69448e4
commit 157f0eae0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>
);