diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js index e58bf09..ffd7558 100644 --- a/desktop/sources/scripts/cursor.js +++ b/desktop/sources/scripts/cursor.js @@ -30,6 +30,8 @@ function Cursor() e.preventDefault(); } + this.last_pos = {x:0,y:0} + this.move = function(e) { this.pos = this.pos_from_event(e) @@ -39,16 +41,21 @@ function Cursor() this.translate(null,this.pos) } - dotgrid.guide.refresh(); + if(this.last_pos.x != this.pos.x || this.last_pos.y != this.pos.y){ + dotgrid.guide.refresh(); + } + dotgrid.interface.refresh(); e.preventDefault(); + + this.last_pos = this.pos; } this.up = function(e) { this.pos = this.pos_from_event(e) - if(e.altKey){ dotgrid.tool.remove_segments_at(this.pos); return; } + if(e.altKey){ dotgrid.tool.remove_segments_at(this.pos); this.translate(); return; } // Translation if(this.translation){ diff --git a/desktop/sources/scripts/guide.js b/desktop/sources/scripts/guide.js index a8cfc07..e368640 100644 --- a/desktop/sources/scripts/guide.js +++ b/desktop/sources/scripts/guide.js @@ -15,9 +15,10 @@ function Guide() this.clear(); this.refresh(); } - - this.refresh = function() + + this.refresh = function(force = false) { + this.clear(); if(dotgrid.tool.index == 2){ this.draw_markers() ; this.draw_vertices() } @@ -89,6 +90,7 @@ function Guide() var color = is_step ? dotgrid.theme.active.f_med : dotgrid.theme.active.f_low; if((y == 0 || y == dotgrid.grid_y) && cursor.x == x+1){ color = dotgrid.theme.active.f_high; } else if((x == 0 || x == dotgrid.grid_x-1) && cursor.y == y+1){ color = dotgrid.theme.active.f_high; } + else if(cursor.x == x+1 && cursor.y == y+1){ color = dotgrid.theme.active.f_high; } this.draw_marker({ x:parseInt(x * dotgrid.grid_width) + dotgrid.grid_width, @@ -98,6 +100,17 @@ function Guide() } } + this.draw_marker = function(pos,radius = 1,color) + { + var ctx = this.el.getContext('2d'); + ctx.beginPath(); + ctx.lineWidth = 2; + ctx.arc(pos.x * this.scale, pos.y * this.scale, radius, 0, 2 * Math.PI, false); + ctx.fillStyle = color; + ctx.fill(); + ctx.closePath(); + } + this.draw_vertex = function(pos, radius = 5) { var ctx = this.el.getContext('2d'); @@ -136,17 +149,6 @@ function Guide() ctx.closePath(); } - this.draw_marker = function(pos,radius = 1,color) - { - var ctx = this.el.getContext('2d'); - ctx.beginPath(); - ctx.lineWidth = 2; - ctx.arc(pos.x * this.scale, pos.y * this.scale, radius, 0, 2 * Math.PI, false); - ctx.fillStyle = color; - ctx.fill(); - ctx.closePath(); - } - this.draw_path = function(path,style) { var ctx = this.el.getContext('2d'); @@ -193,9 +195,9 @@ function Guide() ctx.beginPath(); ctx.lineWidth = 3; ctx.lineCap = "round"; - ctx.arc(Math.abs(pos.x * -this.scale), Math.abs(pos.y * this.scale), 3, 0, 2 * Math.PI, false); - ctx.fillStyle = dotgrid.theme.active.f_low; - ctx.fill(); + ctx.arc(Math.abs(pos.x * -this.scale), Math.abs(pos.y * this.scale), 5, 0, 2 * Math.PI, false); + ctx.strokeStyle = dotgrid.theme.active.background; + ctx.stroke(); ctx.closePath(); ctx.beginPath(); diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index e5e6cec..83a37c5 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -176,7 +176,7 @@ function Tool() this.style().fill = this.style().fill == "none" ? this.style().color : "none"; } else if(type == "thickness"){ - this.style().thickness = clamp(this.style().thickness+mod,1,40); + this.style().thickness = clamp(this.style().thickness+mod,1,100); } else if(type == "mirror"){ this.style().mirror_style = this.style().mirror_style > 3 ? 0 : this.style().mirror_style+1;