Improved shortcuts further
This commit is contained in:
parent
16ddcfb27a
commit
2042b541a8
2
BUILD.md
2
BUILD.md
@ -32,8 +32,6 @@ cd /xxiivv/Nataniev/public/public.projects/builds/
|
|||||||
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-darwin-x64/
|
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-darwin-x64/
|
||||||
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-linux-x64/
|
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-linux-x64/
|
||||||
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-win32-x64/
|
rm -r /xxiivv/Nataniev/public/public.projects/builds/Dotgrid-win32-x64/
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
2
main.js
2
main.js
@ -6,7 +6,7 @@ let win
|
|||||||
|
|
||||||
app.on('ready', () =>
|
app.on('ready', () =>
|
||||||
{
|
{
|
||||||
win = new BrowserWindow({width: 390, height: 420, minWidth: 390, minHeight: 420, maxWidth: 390, maxHeight: 420, backgroundColor:"#000", frame:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
|
win = new BrowserWindow({width: 400, height: 420, minWidth: 400, minHeight: 420, maxWidth: 400, maxHeight: 420, backgroundColor:"#000", frame:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'})
|
||||||
|
|
||||||
win.loadURL(`file://${__dirname}/sources/index.html`)
|
win.loadURL(`file://${__dirname}/sources/index.html`)
|
||||||
|
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
const {dialog,app} = require('electron').remote;
|
const {dialog,app} = require('electron').remote;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
dotgrid = new Dotgrid(300,300,30,30,5,5, 10,"square","#000000");
|
dotgrid = new Dotgrid(300,300,20,20,4,4, 10,"square","#000000");
|
||||||
dotgrid.install();
|
dotgrid.install();
|
||||||
|
|
||||||
var keyboard = new Keyboard();
|
var keyboard = new Keyboard();
|
||||||
|
|
||||||
document.onkeydown = function myFunction(event){ keyboard.listen(event); };
|
document.onkeyup = function myFunction(event){ keyboard.listen(event); };
|
||||||
document.addEventListener('mousedown', function(e){ dotgrid.mouse_down(e); }, false);
|
document.addEventListener('mousedown', function(e){ dotgrid.mouse_down(e); }, false);
|
||||||
document.addEventListener('mousemove', function(e){ dotgrid.mouse_move(e); }, false);
|
document.addEventListener('mousemove', function(e){ dotgrid.mouse_move(e); }, false);
|
||||||
document.addEventListener('mouseup', function(e){ dotgrid.mouse_up(e);}, false);
|
document.addEventListener('mouseup', function(e){ dotgrid.mouse_up(e);}, false);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
body { background:#fff; padding: 5px; font-family: 'input_mono_regular'; -webkit-user-select: none; overflow: hidden;}
|
body { background:#fff; padding: 5px; font-family: 'input_mono_regular'; -webkit-user-select: none; overflow: hidden;}
|
||||||
|
|
||||||
#wrapper { width: calc(100% - 50px); height: calc(100% - 50px); padding: 25px; background: inherit; -webkit-app-region: drag;}
|
#wrapper { width: calc(100% - 50px); height: calc(100% - 50px); padding: 25px; background: inherit; -webkit-app-region: drag;}
|
||||||
#dotgrid { margin:0px auto; position:relative; overflow: hidden; padding:10px;-webkit-app-region: no-drag;}
|
#dotgrid { margin:0px auto; position:relative; overflow: hidden; padding:10px;-webkit-app-region: no-drag; width:310px !important; height:310px !important;}
|
||||||
#cursor { width:8px; height:8px; margin-top:-5px; margin-left:-5px; position:absolute; z-index:25; border-radius:5px; border:1px solid black;}
|
#cursor { opacity: 1; transition: all 50ms; width:8px; height:8px; margin-top:-5px; margin-left:-5px; position:absolute; z-index:25; border-radius:5px; border:1px solid black;}
|
||||||
#cursor_coord { font-size:10px; z-index: 10000; margin-left:15px; margin-top:-2px;}
|
#cursor_coord { font-size:10px; z-index: 10000; margin-left:15px; margin-top:-2px;}
|
||||||
#cursor_coord.left { margin-left:-110px; text-align: right; width:100px; }
|
#cursor_coord.left { margin-left:-110px; text-align: right; width:100px; }
|
||||||
#cursor_from { width:4px; height:4px; background:white; margin-top:-3px; margin-left:-3px; position:absolute; z-index:2500; border-radius:10px; left:-100px;border:1px solid black;}
|
#cursor_from { width:4px; height:4px; background:white; margin-top:-3px; margin-left:-3px; position:absolute; z-index:2500; border-radius:10px; left:-100px;border:1px solid black;}
|
||||||
#cursor_to { width:4px; height:4px; background:white; margin-top:-3px; margin-left:-3px; position:absolute; z-index:2500; border-radius:10px; left:-100px; border:1px solid black;}
|
#cursor_to { width:4px; height:4px; background:white; margin-top:-3px; margin-left:-3px; position:absolute; z-index:2500; border-radius:10px; left:-100px; border:1px solid black;}
|
||||||
#cursor_end { width:4px; height:4px; background:white; margin-top:-3px; margin-left:-3px; position:absolute; z-index:2500; border-radius:10px; left:-100px; border:1px solid black;}
|
#cursor_end { width:4px; height:4px; background:white; margin-top:-3px; margin-left:-3px; position:absolute; z-index:2500; border-radius:10px; left:-100px; border:1px solid black;}
|
||||||
#interface { max-width: 295px;margin:0px auto;font-size: 11px;line-height: 30px; text-transform: uppercase; margin-top:20px;-webkit-app-region: no-drag;}
|
|
||||||
#guide,#widgets { position: absolute;top: 0px;left: 0px; width: 300px;height: 300px;}
|
#guide,#widgets { position: absolute;top: 0px;left: 0px; width: 300px;height: 300px;}
|
||||||
#widgets { z-index: 9000 }
|
#widgets { z-index: 9000 }
|
||||||
#render { display: none }
|
#render { display: none }
|
||||||
@ -18,9 +18,11 @@ body { background:#fff; padding: 5px; font-family: 'input_mono_regular'; -webkit
|
|||||||
.icon.inactive { opacity: 0.1 !important }
|
.icon.inactive { opacity: 0.1 !important }
|
||||||
.icon:hover { cursor: pointer; opacity: 1 }
|
.icon:hover { cursor: pointer; opacity: 1 }
|
||||||
|
|
||||||
svg.vector { z-index: 1000;position: relative }
|
svg.vector { z-index: 1000;position: relative; left:5px; top:5px; }
|
||||||
|
|
||||||
#dotgrid #guide { opacity: 0; transition: all 500ms; }
|
#dotgrid #guide { opacity: 0; transition: all 500ms; }
|
||||||
#dotgrid #widgets { opacity: 0; transition: all 150ms; }
|
#dotgrid #widgets { opacity: 0; transition: all 150ms; left: 5px;top: 5px; }
|
||||||
#dotgrid:hover #guide { opacity: 1 }
|
#dotgrid:hover #guide { opacity: 1 }
|
||||||
#dotgrid:hover #widgets { opacity: 1 }
|
#dotgrid:hover #widgets { opacity: 1 }
|
||||||
|
|
||||||
|
#interface { max-width: 295px;margin:0px auto;font-size: 11px;line-height: 30px; text-transform: uppercase; margin-top:15px;-webkit-app-region: no-drag;}
|
@ -201,26 +201,26 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
|||||||
|
|
||||||
this.set_from = function(pos)
|
this.set_from = function(pos)
|
||||||
{
|
{
|
||||||
from = pos;
|
from = pos.mirror().clamp(0,300).mirror();
|
||||||
|
|
||||||
cursor_from.style.left = Math.floor(-pos.x*this.scale + this.grid_width);
|
cursor_from.style.left = Math.floor(-from.x*this.scale + this.grid_width);
|
||||||
cursor_from.style.top = Math.floor(pos.y*this.scale + this.grid_height);
|
cursor_from.style.top = Math.floor(from.y*this.scale + this.grid_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set_to = function(pos)
|
this.set_to = function(pos)
|
||||||
{
|
{
|
||||||
cursor_to.style.left = Math.floor(-pos.x*this.scale + this.grid_width);
|
to = pos.mirror().clamp(0,300).mirror();
|
||||||
cursor_to.style.top = Math.floor(pos.y*this.scale + this.grid_height);
|
|
||||||
|
|
||||||
to = pos;
|
cursor_to.style.left = Math.floor(-to.x*this.scale + this.grid_width);
|
||||||
|
cursor_to.style.top = Math.floor(to.y*this.scale + this.grid_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set_end = function(pos)
|
this.set_end = function(pos)
|
||||||
{
|
{
|
||||||
cursor_end.style.left = Math.floor(-pos.x*this.scale + this.grid_width);
|
end = pos.mirror().clamp(0,300).mirror();
|
||||||
cursor_end.style.top = Math.floor(pos.y*this.scale + this.grid_height);
|
|
||||||
|
|
||||||
end = pos;
|
cursor_end.style.left = Math.floor(-end.x*this.scale + this.grid_width);
|
||||||
|
cursor_end.style.top = Math.floor(end.y*this.scale + this.grid_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.delete_at = function(pos)
|
this.delete_at = function(pos)
|
||||||
@ -436,7 +436,6 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
|||||||
this.draw()
|
this.draw()
|
||||||
var svg = this.svg_el.outerHTML
|
var svg = this.svg_el.outerHTML
|
||||||
|
|
||||||
|
|
||||||
dotgrid.resize()
|
dotgrid.resize()
|
||||||
dialog.showSaveDialog((fileName) => {
|
dialog.showSaveDialog((fileName) => {
|
||||||
dotgrid.resize()
|
dotgrid.resize()
|
||||||
|
@ -45,10 +45,10 @@ function Keyboard()
|
|||||||
|
|
||||||
case 9 : dotgrid.toggle_fill(); e.preventDefault(); break; // 'tab'
|
case 9 : dotgrid.toggle_fill(); e.preventDefault(); break; // 'tab'
|
||||||
|
|
||||||
case 38 : dotgrid.mod_move(new Pos(0,-10)); break; // 'up'
|
case 38 : dotgrid.mod_move(new Pos(0,-15)); break; // 'up'
|
||||||
case 40 : dotgrid.mod_move(new Pos(0,10)); break; // 'down'
|
case 40 : dotgrid.mod_move(new Pos(0,15)); break; // 'down'
|
||||||
case 37 : dotgrid.mod_move(new Pos(-10,0)); break; // 'left'
|
case 37 : dotgrid.mod_move(new Pos(-15,0)); break; // 'left'
|
||||||
case 39 : dotgrid.mod_move(new Pos(10,0)); break; // 'right'
|
case 39 : dotgrid.mod_move(new Pos(15,0)); break; // 'right'
|
||||||
}
|
}
|
||||||
dotgrid.draw();
|
dotgrid.draw();
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,16 @@ function Pos(x,y)
|
|||||||
{
|
{
|
||||||
return new Pos(this.x*a,this.y*a)
|
return new Pos(this.x*a,this.y*a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.mirror = function(x = -1,y = 1)
|
||||||
|
{
|
||||||
|
return new Pos(this.x * x,this.y * y);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clamp = function(min,max)
|
||||||
|
{
|
||||||
|
return new Pos(clamp(this.x,min,max),clamp(this.y,min,max));
|
||||||
|
}
|
||||||
|
|
||||||
|
function clamp(v, min, max) { return v < min ? min : v > max ? max : v; }
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user