Optimized preview

This commit is contained in:
Devine Lu Linvega 2018-04-03 10:25:14 +12:00
parent ad1ede6796
commit 341cf4309b
2 changed files with 5 additions and 7 deletions

View File

@ -355,7 +355,6 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
{
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 {
@ -374,13 +373,13 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.cursor_prev = pos;
}
this.preview_prev = null
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; }
this.preview_el.innerHTML = `<path d='${dotgrid.tool.path([{type:operation,verteces:dotgrid.tool.verteces}])}'></path>`;
if(this.preview_prev == operation){ return; }
this.preview_el.innerHTML = !operation ? `<path d='M0,0'></path>` : `<path d='${dotgrid.tool.path([{type:operation,verteces:dotgrid.tool.verteces}])}'></path>`;
this.preview_prev = operation;
}
// Toggles

View File

@ -66,7 +66,6 @@ function Guide()
this.update = function()
{
console.log("guide_update")
this.clear();
for(id in dotgrid.tool.verteces){