header-menu.js 620 B

1234567891011121314151617181920212223
  1. import { stageManager } from "./stage-manager";
  2. class HeaderMenu {
  3. constructor() {
  4. $("body").on("click", "#save", this.save.bind(this));
  5. }
  6. bootstrap() {}
  7. save() {
  8. const layer = stageManager.getCurrentLayer();
  9. const file = layer.actionManager.save();
  10. var a = document.createElement("a"),
  11. url = URL.createObjectURL(file);
  12. a.href = url;
  13. a.download = `${layer.name}.geo`;
  14. document.body.appendChild(a);
  15. a.click();
  16. setTimeout(function() {
  17. document.body.removeChild(a);
  18. window.URL.revokeObjectURL(url);
  19. }, 0);
  20. }
  21. }
  22. export const headerMenu = new HeaderMenu();