Implemented open/save
This commit is contained in:
		@@ -55,33 +55,6 @@ function Keyboard()
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if((e.key == "n" || e.key == "Backspace") && (e.ctrlKey || e.metaKey)){
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      ronin.guide.inspect = false;
 | 
			
		||||
      ronin.guide.clear();
 | 
			
		||||
      ronin.cursor.target.clear();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(e.key == "N" && (e.ctrlKey || e.metaKey) && e.shiftKey){
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      ronin.guide.inspect = false;
 | 
			
		||||
      ronin.guide.clear();
 | 
			
		||||
      ronin.layers.above.clear()
 | 
			
		||||
      ronin.layers.below.clear()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Open
 | 
			
		||||
    if(e.key == "o" && (e.ctrlKey || e.metaKey)){
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      ronin.io.methods.load.run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Save
 | 
			
		||||
    if(e.key == "s" && (e.ctrlKey || e.metaKey)){
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      ronin.io.methods.save.run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ronin.hint.update(e);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -9,6 +9,12 @@ function Frame()
 | 
			
		||||
    ronin.el.appendChild(this.el);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  this.methods.new = new Method("new","WxH","New Canvas",function(q){
 | 
			
		||||
    ronin.layers.above.clear();
 | 
			
		||||
    ronin.layers.below.clear();
 | 
			
		||||
    ronin.frame.resize_to({width:930,height:540});
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  this.width = 400;
 | 
			
		||||
  this.height = 400;
 | 
			
		||||
  this.zoom = {scale:1,offset:{x:0,y:0}};
 | 
			
		||||
 
 | 
			
		||||
@@ -72,11 +72,10 @@ function Ronin()
 | 
			
		||||
    this.controller.add("default","*","Reset",() => { ronin.reset(); },"CmdOrCtrl+Backspace");
 | 
			
		||||
    this.controller.add("default","*","Quit",() => { app.exit(); },"CmdOrCtrl+Q");
 | 
			
		||||
 | 
			
		||||
    this.controller.add("default","File","New",() => { ronin.new(); },"CmdOrCtrl+N");
 | 
			
		||||
    this.controller.add("default","File","Open",() => { ronin.open(); },"CmdOrCtrl+O");
 | 
			
		||||
    this.controller.add("default","File","Save",() => { ronin.save(); },"CmdOrCtrl+S");
 | 
			
		||||
 | 
			
		||||
    this.controller.add("default","I/O","Import Image",() => { ronin.io.methods.load.run(); },"CmdOrCtrl+I");
 | 
			
		||||
    this.controller.add("default","File","New Image",() => { ronin.frame.methods.new.run(); },"CmdOrCtrl+N");
 | 
			
		||||
    this.controller.add("default","File","Open Image",() => { ronin.io.methods.open.run(); },"CmdOrCtrl+O");
 | 
			
		||||
    this.controller.add("default","File","Import Image",() => { ronin.io.methods.load.run(); },"CmdOrCtrl+I");
 | 
			
		||||
    this.controller.add("default","File","Export Image",() => { ronin.io.methods.save.run(); },"CmdOrCtrl+R");
 | 
			
		||||
 | 
			
		||||
    this.controller.add("default","Layers","Above Layer",() => { ronin.cursor.select_layer(ronin.layers.above); },"c");
 | 
			
		||||
    this.controller.add("default","Layers","Below Layer",() => { ronin.cursor.select_layer(ronin.layers.below); },"z");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user