Optimizing
This commit is contained in:
parent
ede2bca49a
commit
ad1ede6796
@ -12,11 +12,11 @@
|
||||
"build" : "npm run clean ; npm run build_osx ; npm run build_linux ; npm run build_win ; npm run build_pi",
|
||||
"push_osx" : "~/butler push ~/Desktop/Dotgrid-darwin-x64/ hundredrabbits/dotgrid:osx-64",
|
||||
"push_linux" : "~/butler push ~/Desktop/Dotgrid-linux-x64/ hundredrabbits/dotgrid:linux-64",
|
||||
"push_pi" : "~/butler push ~/Desktop/Dotgrid-linux-armv7l/ hundredrabbits/dotgrid:linux-pi",
|
||||
"push_pi" : "~/butler push ~/Desktop/Dotgrid-linux-armv7l/ hundredrabbits/dotgrid:linux-pi",
|
||||
"push_win" : "~/butler push ~/Desktop/Dotgrid-win32-x64/ hundredrabbits/dotgrid:windows-64",
|
||||
"push_theme" : "~/butler push ~/Github/HundredRabbits/Themes/themes/ hundredrabbits/dotgrid:themes",
|
||||
"push_status" : "~/butler status hundredrabbits/dotgrid",
|
||||
"push" : "npm run build ; npm run push_theme ; npm run push_osx ; npm run push_pi ; npm run push_linux ; npm run push_win ; npm run clean ; npm run push_status"
|
||||
"push" : "npm run build ; npm run theme ; npm run push_osx ; npm run push_linux ; npm run push_win ; npm run clean ; npm run push_status"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^1.8.1"
|
||||
|
@ -344,8 +344,18 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
setTimeout(() => { dotgrid.tool.clear(); },150);
|
||||
}
|
||||
|
||||
this.move_cursor = function(pos)
|
||||
function pos_is_equal(a,b)
|
||||
{
|
||||
return a && b && a.x == b.x && a.y == b.y
|
||||
}
|
||||
|
||||
this.cursor_prev = null;
|
||||
|
||||
this.move_cursor = function(pos, force = false)
|
||||
{
|
||||
if(pos_is_equal(pos,this.cursor_prev) && !force){ return; }
|
||||
|
||||
console.log("move_cursor",pos)
|
||||
if(pos.x>0) {
|
||||
this.cursor.style.visibility = "hidden"
|
||||
} else {
|
||||
@ -355,21 +365,18 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.cursor.style.visibility = "visible"
|
||||
this.cursor.style.left = Math.floor(-(pos.x-this.grid_width));
|
||||
this.cursor.style.top = Math.floor(pos.y+this.grid_height);
|
||||
this.update_cursor(pos);
|
||||
this.cursor_x.style.left = `${-pos.x}px`;
|
||||
this.cursor_x.textContent = parseInt(-pos.x/this.grid_width)
|
||||
this.cursor_y.style.top = `${pos.y}px`;
|
||||
this.cursor_y.textContent = parseInt(pos.y/this.grid_width)
|
||||
window.setTimeout(() => dotgrid.cursor.style.transition = "all 50ms", 17 /*one frame*/)
|
||||
}
|
||||
}
|
||||
|
||||
this.update_cursor = function(pos)
|
||||
{
|
||||
this.cursor_x.style.left = `${-pos.x}px`;
|
||||
this.cursor_x.textContent = parseInt(-pos.x/this.grid_width)
|
||||
this.cursor_y.style.top = `${pos.y}px`;
|
||||
this.cursor_y.textContent = parseInt(pos.y/this.grid_width)
|
||||
this.cursor_prev = pos;
|
||||
}
|
||||
|
||||
this.preview = function(operation)
|
||||
{
|
||||
console.log("preview")
|
||||
if(!operation){ this.preview_el.innerHTML = `<path d='M0,0'></path>`; return;}
|
||||
if(operation != "line" && operation != "arc_c" && operation != "arc_r" && operation != "bezier" && operation != "close"){ this.preview_el.innerHTML = `<path d='M0,0'></path>`; return; }
|
||||
|
||||
@ -461,6 +468,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
|
||||
this.draw = function(exp = false)
|
||||
{
|
||||
console.log("draw")
|
||||
var paths = this.tool.paths();
|
||||
var d = this.tool.path();
|
||||
this.layer_1.setAttribute("d",paths[0]);
|
||||
|
@ -66,6 +66,7 @@ function Guide()
|
||||
|
||||
this.update = function()
|
||||
{
|
||||
console.log("guide_update")
|
||||
this.clear();
|
||||
|
||||
for(id in dotgrid.tool.verteces){
|
||||
|
Loading…
Reference in New Issue
Block a user