diff --git a/desktop/main.js b/desktop/main.js index a00c438..c61e540 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -51,11 +51,11 @@ app.inspect = function () { app.win.toggleDevTools() } -app.toggle_fullscreen = function () { +app.toggleFullscreen = function () { app.win.setFullScreen(!app.win.isFullScreen()) } -app.toggle_visible = function () { +app.toggleVisible = function () { if (process.platform == 'win32') { if (!app.win.isMinimized()) { app.win.minimize() } else { app.win.restore() } } else { diff --git a/desktop/sources/index.html b/desktop/sources/index.html index 356ffab..1f12af5 100644 --- a/desktop/sources/index.html +++ b/desktop/sources/index.html @@ -4,20 +4,20 @@ + - - + + - - + + - - + @@ -35,8 +35,8 @@ DOTGRID.controller = new Controller(); DOTGRID.controller.add("default","*","About",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Dotgrid'); },"CmdOrCtrl+,"); - DOTGRID.controller.add("default","*","Fullscreen",() => { app.toggle_fullscreen(); },"CmdOrCtrl+Enter"); - DOTGRID.controller.add("default","*","Hide",() => { app.toggle_visible(); },"CmdOrCtrl+H"); + DOTGRID.controller.add("default","*","Fullscreen",() => { app.toggleFullscreen(); },"CmdOrCtrl+Enter"); + DOTGRID.controller.add("default","*","Hide",() => { app.toggleVisible(); },"CmdOrCtrl+H"); DOTGRID.controller.add("default","*","Inspect",() => { app.inspect(); },"CmdOrCtrl+."); DOTGRID.controller.add("default","*","Reset",() => { DOTGRID.reset(); DOTGRID.theme.reset(); },"CmdOrCtrl+Backspace"); DOTGRID.controller.add("default","*","Quit",() => { app.exit(); },"CmdOrCtrl+Q"); @@ -94,8 +94,8 @@ DOTGRID.controller.add("default","Theme","Download Themes..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes'); }) DOTGRID.controller.add("picker","*","About",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Dotgrid'); },"CmdOrCtrl+,"); - DOTGRID.controller.add("picker","*","Fullscreen",() => { app.toggle_fullscreen(); },"CmdOrCtrl+Enter"); - DOTGRID.controller.add("picker","*","Hide",() => { app.toggle_visible(); },"CmdOrCtrl+H"); + DOTGRID.controller.add("picker","*","Fullscreen",() => { app.toggleFullscreen(); },"CmdOrCtrl+Enter"); + DOTGRID.controller.add("picker","*","Hide",() => { app.toggleVisible(); },"CmdOrCtrl+H"); DOTGRID.controller.add("picker","*","Inspect",() => { app.inspect(); },"CmdOrCtrl+."); DOTGRID.controller.add("picker","*","Documentation",() => { DOTGRID.controller.docs(); },"CmdOrCtrl+Esc"); DOTGRID.controller.add("picker","*","Reset",() => { DOTGRID.reset(); DOTGRID.theme.reset(); },"CmdOrCtrl+Backspace"); diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index 0bd8e4e..968cb72 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -1,7 +1,17 @@ 'use strict' function Dotgrid (width, height) { - const defaultTheme = { background: '#eee', f_high: '#000', f_med: '#999', f_low: '#ccc', f_inv: '#000', b_high: '#000', b_med: '#888', b_low: '#aaa', b_inv: '#ffb545' } + const defaultTheme = { + background: '#eee', + f_high: '#000', + f_med: '#999', + f_low: '#ccc', + f_inv: '#000', + b_high: '#000', + b_med: '#888', + b_low: '#aaa', + b_inv: '#ffb545' + } // ISU @@ -49,6 +59,19 @@ function Dotgrid (width, height) { DOTGRID.renderer.update() } + this.clear = function () { + this.history.clear() + this.tool.reset() + this.reset() + this.renderer.update() + this.interface.update(true) + } + + this.reset = function () { + this.tool.clear() + this.update() + } + // File this.new = function () { @@ -133,19 +156,6 @@ function Dotgrid (width, height) { // Draw - this.reset = function () { - this.tool.clear() - this.update() - } - - this.clear = function () { - this.history.clear() - this.tool.reset() - this.reset() - this.renderer.update() - this.interface.update(true) - } - this.resize = function () { const size = { width: step(window.innerWidth - 90, 15), height: step(window.innerHeight - 120, 15) } @@ -163,6 +173,8 @@ function Dotgrid (width, height) { document.title = `Dotgrid — ${size.width}x${size.height}` } + // Events + this.drag = function (e) { e.preventDefault() e.stopPropagation() diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index a224028..57cba69 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -206,7 +206,7 @@ function Tool (dotgrid) { this.source = function (type) { if (type == 'grid') { dotgrid.renderer.toggle() } - if (type == 'screen') { app.toggle_fullscreen() } + if (type == 'screen') { app.toggleFullscreen() } if (type == 'open') { dotgrid.open() } if (type == 'save') { dotgrid.save() } diff --git a/index.html b/index.html index d1885c2..0589ac7 100644 --- a/index.html +++ b/index.html @@ -21,11 +21,11 @@ + -