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; } if(pos_is_equal(pos,this.cursor_prev) && !force){ return; }
console.log("move_cursor",pos)
if(pos.x>0) { if(pos.x>0) {
this.cursor.style.visibility = "hidden" this.cursor.style.visibility = "hidden"
} else { } else {
@ -374,13 +373,13 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.cursor_prev = pos; this.cursor_prev = pos;
} }
this.preview_prev = null
this.preview = function(operation) this.preview = function(operation)
{ {
console.log("preview") if(this.preview_prev == operation){ return; }
if(!operation){ this.preview_el.innerHTML = `<path d='M0,0'></path>`; return;} this.preview_el.innerHTML = !operation ? `<path d='M0,0'></path>` : `<path d='${dotgrid.tool.path([{type:operation,verteces:dotgrid.tool.verteces}])}'></path>`;
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_prev = operation;
this.preview_el.innerHTML = `<path d='${dotgrid.tool.path([{type:operation,verteces:dotgrid.tool.verteces}])}'></path>`;
} }
// Toggles // Toggles

View File

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