Sfoglia il codice sorgente

prevent exporting empty canvas

dwelle 5 anni fa
parent
commit
4eda1cfb5d
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      src/index.js

+ 2 - 0
src/index.js

@@ -34,6 +34,8 @@ function exportAsPNG({
   exportVisibleOnly,
   exportPadding = 10
 }) {
+  if ( !elements.length ) return window.alert("Cannot export empty canvas.");
+
   // deselect & rerender
 
   clearSelection();