Ver Fonte

prevent exporting empty canvas

dwelle há 5 anos atrás
pai
commit
4eda1cfb5d
1 ficheiros alterados com 2 adições e 0 exclusões
  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();