Progress on documentation tools.
This commit is contained in:
@@ -14,10 +14,10 @@ function Controller()
|
||||
if(!this.menu[mode]){ this.menu[mode] = {}; }
|
||||
if(!this.menu[mode][cat]){ this.menu[mode][cat] = {}; }
|
||||
this.menu[mode][cat][label] = {fn:fn,accelerator:accelerator};
|
||||
console.log("Added control",mode,cat,label,accelerator)
|
||||
console.log(`${mode}/${cat}/${label} <${accelerator}>`);
|
||||
}
|
||||
|
||||
this.commit = function()
|
||||
this.format = function()
|
||||
{
|
||||
var f = [];
|
||||
var m = this.menu[this.mode];
|
||||
@@ -29,7 +29,18 @@ function Controller()
|
||||
}
|
||||
f.push({label:cat,submenu:submenu});
|
||||
}
|
||||
this.app.inject_menu(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
this.commit = function()
|
||||
{
|
||||
this.app.inject_menu(this.format());
|
||||
}
|
||||
|
||||
this.docs = function()
|
||||
{
|
||||
console.log("Generating docs..");
|
||||
this.app.generate_docs(this.format());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,11 +125,11 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
||||
this.theme.start();
|
||||
this.guide.start();
|
||||
this.interface.start();
|
||||
this.controller.start();
|
||||
|
||||
this.controller.add("default","*","Reset",() => { dotgrid.reset(); dotgrid.theme.reset(); },"CmdOrCtrl+Backspace");
|
||||
this.controller.add("default","*","About Dotgrid",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Dotgrid'); },"CmdOrCtrl+,");
|
||||
this.controller.add("default","*","Developer Tools",() => { app.inspect },"CmdOrCtrl+.");
|
||||
this.controller.add("default","*","Developer Tools",() => { app.inspect(); },"CmdOrCtrl+.");
|
||||
this.controller.add("default","*","Generate Docs",() => { dotgrid.controller.docs(); },"CmdOrCtrl+Esc");
|
||||
this.controller.add("default","*","Toggle Fullscreen",() => { app.toggle_fullscreen(); },"CmdOrCtrl+Enter");
|
||||
this.controller.add("default","*","Toggle Visible",() => { app.toggle_visible(); },"CmdOrCtrl+H");
|
||||
this.controller.add("default","*","Quit",() => { app.exit(); },"CmdOrCtrl+Q");
|
||||
@@ -149,7 +149,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
||||
|
||||
this.controller.add("default","Stroke","Line",() => { dotgrid.draw_line(); },"A");
|
||||
this.controller.add("default","Stroke","Arc",() => { dotgrid.draw_arc("0,1"); },"S");
|
||||
this.controller.add("default","Stroke","Arc(CC)",() => { dotgrid.draw_arc("0,0"); },"D");
|
||||
this.controller.add("default","Stroke","Arc Reverse",() => { dotgrid.draw_arc("0,0"); },"D");
|
||||
this.controller.add("default","Stroke","Bezier",() => { dotgrid.draw_bezier(); },"F");
|
||||
this.controller.add("default","Stroke","Close",() => { dotgrid.draw_close(); },"Z");
|
||||
|
||||
|
||||
@@ -10,16 +10,16 @@ function Interface()
|
||||
// Interface
|
||||
var html = ""
|
||||
var path_arr = [
|
||||
["line","line (d)","M60,60 L240,240",""],
|
||||
["arc_c","arc clockwise (s)","M60,60 A180,180 0 0,1 240,240",""],
|
||||
["arc_r","arc reverse (a)","M60,60 A180,180 0 0,0 240,240",""],
|
||||
["bezier","bezier (f)","M60,60 Q60,150 150,150 Q240,150 240,240 ",""],
|
||||
["close","close (g)","M60,60 A180,180 0 0,1 240,240 M60,60 A180,180 0 0,0 240,240",""],
|
||||
["line","line","M60,60 L240,240",""],
|
||||
["arc_c","arc clockwise","M60,60 A180,180 0 0,1 240,240",""],
|
||||
["arc_r","arc reverse","M60,60 A180,180 0 0,0 240,240",""],
|
||||
["bezier","bezier","M60,60 Q60,150 150,150 Q240,150 240,240 ",""],
|
||||
["close","close","M60,60 A180,180 0 0,1 240,240 M60,60 A180,180 0 0,0 240,240",""],
|
||||
|
||||
["thickness","thickness ([ & ])","M60,60 L240,240","stroke-dasharray: 30,15"],
|
||||
["linecap","linecap (/)","M60,60 L240,240 M240,180 L240,240 M180,240 L240,240"],
|
||||
["mirror","mirror (space)","M60,60 L240,240 M180,120 L210,90 M120,180 L90,210 "],
|
||||
["fill","fill (h)","M60,60 L60,150 L150,150 L240,150 L240,240 Z "],
|
||||
["thickness","thickness","M60,60 L240,240","stroke-dasharray: 30,15"],
|
||||
["linecap","linecap","M60,60 L240,240 M240,180 L240,240 M180,240 L240,240"],
|
||||
["mirror","mirror","M60,60 L240,240 M180,120 L210,90 M120,180 L90,210 "],
|
||||
["fill","fill","M60,60 L60,150 L150,150 L240,150 L240,240 Z "],
|
||||
|
||||
["export","export (ctrl s)","M150,50 L50,150 L150,250 L250,150 L150,50 Z"]
|
||||
]
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
function Keyboard()
|
||||
{
|
||||
this.listen = function(e)
|
||||
{
|
||||
// // zoom
|
||||
// if(e.key == "~" || e.keyCode == 192){
|
||||
// dotgrid.interface.toggle_zoom();
|
||||
// e.preventDefault();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // undo
|
||||
// if(e.key == "z" && (e.ctrlKey || e.metaKey)){
|
||||
// e.preventDefault();
|
||||
// dotgrid.erase();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Reset
|
||||
// if((e.key == "Backspace" || e.key == "Delete") && e.ctrlKey && e.shiftKey){
|
||||
// e.preventDefault();
|
||||
// dotgrid.theme.reset();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var numbers = ["0","1","2","3","4","5","6","7","8","9"]
|
||||
// if(numbers.indexOf(e.key) > -1 || e.code == "Digit0" || e.keyCode == 48){
|
||||
// keyboard.cheatcode(e.key);
|
||||
// return;
|
||||
// }
|
||||
// else{
|
||||
// this.code_history = "";
|
||||
// }
|
||||
|
||||
// switch(e.keyCode || e.key) {
|
||||
// case 65 : dotgrid.draw_arc(e.shiftKey ? "1,0" : "0,0"); break; // 'a/A'
|
||||
// case 83 : dotgrid.draw_arc(e.shiftKey ? "1,1" : "0,1"); break; // 's/S'
|
||||
// case 68 : dotgrid.draw_line(); break; // 'd'
|
||||
// case 70 : dotgrid.draw_bezier(); break; // 'f'
|
||||
// case "g" : dotgrid.draw_close(); break;
|
||||
// case 71 : dotgrid.draw_close(); break; // 'g'
|
||||
// case "h" : dotgrid.toggle_fill(); break;
|
||||
// case 72 : dotgrid.toggle_fill(); break; // 'g'
|
||||
|
||||
// case "[" : dotgrid.mod_thickness(-1); break;
|
||||
// case 219 : dotgrid.mod_thickness(-1); break; // '['
|
||||
// case "]" : dotgrid.mod_thickness(1); break;
|
||||
// case 221 : dotgrid.mod_thickness(1); break; // ']'
|
||||
|
||||
// case "+" : dotgrid.mod_thickness(1); break;
|
||||
// case "-" : dotgrid.mod_thickness(-1); break;
|
||||
// case "<" : dotgrid.mod_thickness(1); break;
|
||||
// case ">" : dotgrid.mod_thickness(-1); break;
|
||||
|
||||
// case "/" : dotgrid.mod_linecap(1); break; // '/'
|
||||
// case 191 : dotgrid.mod_linecap(1); break; // '/'
|
||||
|
||||
// case "space" : dotgrid.mod_linecap(1); break; // '/'
|
||||
// case 32 : dotgrid.mod_mirror(); break; // 'space'
|
||||
|
||||
// case "Escape" : dotgrid.mod_linecap(1); break; // '/'
|
||||
// case 27 : dotgrid.reset(); break; // 'ESC'
|
||||
// case 8 : dotgrid.erase(); break; // 'Backspace'
|
||||
// case 13 : dotgrid.export(); break; // 'Enter'
|
||||
|
||||
// case 9 : dotgrid.interface.toggle(); e.preventDefault(); break; // 'tab'
|
||||
|
||||
// case 38 : dotgrid.mod_move(new Pos(0,-15)); break; // 'up'
|
||||
// case 40 : dotgrid.mod_move(new Pos(0,15)); break; // 'down'
|
||||
// case 37 : dotgrid.mod_move(new Pos(-15,0)); break; // 'left'
|
||||
// case 39 : dotgrid.mod_move(new Pos(15,0)); break; // 'right'
|
||||
// }
|
||||
// dotgrid.draw();
|
||||
}
|
||||
|
||||
this.code_history = "";
|
||||
|
||||
this.cheatcode = function(key)
|
||||
{
|
||||
if(key.length != 1){ return; }
|
||||
this.code_history += key;
|
||||
|
||||
if(this.code_history.length == 2){
|
||||
var x = this.code_history.substr(0,2);
|
||||
var y = 15;
|
||||
dotgrid.move_cursor(new Pos(x * -15,y * 15))
|
||||
}
|
||||
if(this.code_history.length > 3){
|
||||
var x = this.code_history.substr(0,2);
|
||||
var y = this.code_history.substr(2,2);
|
||||
dotgrid.add_point(new Pos(x * -15,y * 15))
|
||||
dotgrid.move_cursor(new Pos(x * -15,y * 15))
|
||||
this.code_history = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user