Added missing shortcuts

This commit is contained in:
Devine Lu Linvega 2018-08-18 09:45:05 +12:00
parent 2b795e5d4a
commit 298631fbc0
2 changed files with 23 additions and 26 deletions

View File

@ -12,7 +12,6 @@ function Picker()
try{ dotgrid.controller.set("picker"); }
catch(err){ console.log("No controller"); }
dotgrid.interface.el.className = "picker"
this.el.focus()
this.original = dotgrid.tool.style().color

View File

@ -1,34 +1,32 @@
document.onkeydown = function key_down(e)
{
};
document.onkeyup = (e) =>
{
var ch = e.key.toLowerCase();
console.log(ch);
if(e.target && e.target.id == "picker"){ return; }
if(ch == "1"){ dotgrid.tool.select_layer(0); }
if(ch == "2"){ dotgrid.tool.select_layer(1); }
if(ch == "3"){ dotgrid.tool.select_layer(2); }
if(ch == "backspace"){ dotgrid.tool.remove_segment(); e.preventDefault(); }
if(ch == "escape"){ dotgrid.tool.clear(); e.preventDefault(); }
if(ch == "u"){ dotgrid.interface.toggle(); }
if(ch == "h"){ dotgrid.guide.toggle(); }
if(ch == "1"){ dotgrid.tool.select_layer(0); e.preventDefault(); }
if(ch == "2"){ dotgrid.tool.select_layer(1); e.preventDefault(); }
if(ch == "3"){ dotgrid.tool.select_layer(2); e.preventDefault(); }
if(ch == "a"){ dotgrid.tool.cast("line"); }
if(ch == "s"){ dotgrid.tool.cast("arc_c"); }
if(ch == "d"){ dotgrid.tool.cast("arc_r"); }
if(ch == "f"){ dotgrid.tool.cast("bezier"); }
if(ch == "z"){ dotgrid.tool.cast("close"); }
if(ch == "u"){ dotgrid.interface.toggle(); e.preventDefault(); }
if(ch == "h"){ dotgrid.guide.toggle(); e.preventDefault(); }
if(ch == "q"){ dotgrid.tool.toggle("linecap"); }
if(ch == "w"){ dotgrid.tool.toggle("linejoin"); }
if(ch == "e"){ dotgrid.tool.toggle("mirror"); }
if(ch == "r"){ dotgrid.tool.toggle("fill"); }
if(ch == "g"){ dotgrid.picker.start(); }
if(ch == "}"){ dotgrid.tool.toggle("thickness",1); }
if(ch == "{"){ dotgrid.tool.toggle("thickness",-1); }
if(ch == "]"){ dotgrid.tool.toggle("thickness",5); }
if(ch == "["){ dotgrid.tool.toggle("thickness",-5); }
if(ch == "a"){ dotgrid.tool.cast("line"); e.preventDefault(); }
if(ch == "s"){ dotgrid.tool.cast("arc_c"); e.preventDefault(); }
if(ch == "d"){ dotgrid.tool.cast("arc_r"); e.preventDefault(); }
if(ch == "f"){ dotgrid.tool.cast("bezier"); e.preventDefault(); }
if(ch == "z"){ dotgrid.tool.cast("close"); e.preventDefault(); }
if(ch == "q"){ dotgrid.tool.toggle("linecap"); e.preventDefault(); }
if(ch == "w"){ dotgrid.tool.toggle("linejoin"); e.preventDefault(); }
if(ch == "e"){ dotgrid.tool.toggle("mirror"); e.preventDefault(); }
if(ch == "r"){ dotgrid.tool.toggle("fill"); e.preventDefault(); }
if(ch == "g"){ dotgrid.picker.start(); e.preventDefault(); }
if(ch == "}"){ dotgrid.tool.toggle("thickness",1); e.preventDefault(); }
if(ch == "{"){ dotgrid.tool.toggle("thickness",-1); e.preventDefault(); }
if(ch == "]"){ dotgrid.tool.toggle("thickness",5); e.preventDefault(); }
if(ch == "["){ dotgrid.tool.toggle("thickness",-5); e.preventDefault(); }
}