commit
f6d7c47fae
@ -145,12 +145,22 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
|||||||
|
|
||||||
if(dotgrid.translation){ dotgrid.translation.to = pos; }
|
if(dotgrid.translation){ dotgrid.translation.to = pos; }
|
||||||
|
|
||||||
|
if(pos.x>0) {
|
||||||
|
this.cursor.style.visibility = "hidden"
|
||||||
|
} else {
|
||||||
|
if(this.cursor.style.visibility == "hidden") {
|
||||||
|
this.cursor.style.transition = "initial"
|
||||||
|
}
|
||||||
|
this.cursor.style.visibility = "visible"
|
||||||
this.cursor.style.left = Math.floor(-(pos.x-this.grid_width));
|
this.cursor.style.left = Math.floor(-(pos.x-this.grid_width));
|
||||||
this.cursor.style.top = Math.floor(pos.y+this.grid_height);
|
this.cursor.style.top = Math.floor(pos.y+this.grid_height);
|
||||||
this.cursor_coord.className = -pos.x > this.width/2 ? "fl left" : "fl"
|
this.cursor_coord.className = -pos.x > this.width/2 ? "fl left" : "fl"
|
||||||
this.cursor_coord.textContent = parseInt(-pos.x/this.grid_width)+","+parseInt(pos.y/this.grid_height);
|
this.cursor_coord.textContent = parseInt(-pos.x/this.grid_width)+","+parseInt(pos.y/this.grid_height);
|
||||||
|
window.setTimeout(() => dotgrid.cursor.style.transition = "all 50ms", 17 /*one frame*/)
|
||||||
|
}
|
||||||
|
|
||||||
dotgrid.guide.update();
|
dotgrid.guide.update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_up = function(e)
|
this.mouse_up = function(e)
|
||||||
@ -160,6 +170,8 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
|||||||
|
|
||||||
if(e.altKey){ return; }
|
if(e.altKey){ return; }
|
||||||
|
|
||||||
|
if(pos.x>0) { dotgrid.translation = null; return; }
|
||||||
|
|
||||||
if(dotgrid.translation && !dotgrid.translation.to.is_equal(dotgrid.translation.from) ){
|
if(dotgrid.translation && !dotgrid.translation.to.is_equal(dotgrid.translation.from) ){
|
||||||
dotgrid.translate(dotgrid.translation);
|
dotgrid.translate(dotgrid.translation);
|
||||||
return;
|
return;
|
||||||
@ -167,8 +179,6 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
|||||||
|
|
||||||
dotgrid.translation = null;
|
dotgrid.translation = null;
|
||||||
|
|
||||||
if(pos.x>0) return;
|
|
||||||
|
|
||||||
if(from === null){ this.set_from(pos.scale(1/this.scale)); }
|
if(from === null){ this.set_from(pos.scale(1/this.scale)); }
|
||||||
else if(to === null){ this.set_to(pos.scale(1/this.scale)); }
|
else if(to === null){ this.set_to(pos.scale(1/this.scale)); }
|
||||||
else{ this.set_end(pos.scale(1/this.scale)); }
|
else{ this.set_end(pos.scale(1/this.scale)); }
|
||||||
|
@ -90,6 +90,7 @@ function Guide()
|
|||||||
var from = dotgrid.translation.from;
|
var from = dotgrid.translation.from;
|
||||||
var to = dotgrid.translation.to;
|
var to = dotgrid.translation.to;
|
||||||
|
|
||||||
|
if(to.x<=0) {
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo((from.x * -2)+20,(from.y * 2)+20);
|
ctx.moveTo((from.x * -2)+20,(from.y * 2)+20);
|
||||||
ctx.lineTo((to.x * -2)+20,(to.y * 2)+20);
|
ctx.lineTo((to.x * -2)+20,(to.y * 2)+20);
|
||||||
@ -100,3 +101,4 @@ function Guide()
|
|||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user