From 602791888416c7ba89287daeb5bbd33ae8a37b3f Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 3 Aug 2018 11:50:09 +1200 Subject: [PATCH] Starting interface --- desktop/sources/scripts/cursor.js | 6 +++--- desktop/sources/scripts/interface.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js index 21c954a..27eb2bb 100644 --- a/desktop/sources/scripts/cursor.js +++ b/desktop/sources/scripts/cursor.js @@ -4,7 +4,7 @@ function Cursor() this.translation = null, this.translate = function(from = null,to = null, multi = false) - { + { if((from || to) && this.translation == null){ this.translation = {multi:multi}; console.log("Begin translation") } if(from){ this.translation.from = from; } @@ -54,7 +54,7 @@ function Cursor() if(this.translation.multi){ dotgrid.tool.translate_multi(this.translation.from,this.translation.to); } else{ dotgrid.tool.translate(this.translation.from,this.translation.to); } } - else{ + else if(e.target.id == "guide"){ dotgrid.tool.add_vertex({x:this.pos.x,y:this.pos.y}); } this.translate(); @@ -93,7 +93,7 @@ function Cursor() { var grid = dotgrid.tool.settings.size.width/dotgrid.grid_x; return { - x:clamp(step(pos.x,grid),grid,dotgrid.tool.settings.size.width+grid), + x:clamp(step(pos.x,grid),grid,dotgrid.tool.settings.size.width), y:clamp(step(pos.y,grid),grid,dotgrid.tool.settings.size.height+grid) }; } diff --git a/desktop/sources/scripts/interface.js b/desktop/sources/scripts/interface.js index a40b153..8ad89fb 100644 --- a/desktop/sources/scripts/interface.js +++ b/desktop/sources/scripts/interface.js @@ -34,14 +34,24 @@ function Interface() for(id in tools){ var tool = tools[id]; var shortcut = tool[2]; - html += `${id == "depth" ? `` : ""}${id.capitalize()}${shortcut ? '('+shortcut+')' : ''}` + html += `${id == "depth" ? `` : ""}${id.capitalize()}${shortcut ? '('+shortcut+')' : ''}` } this.menu_el.innerHTML = html } + this.over = function(id) + { + console.log("over",id) + } + + this.down = function(id) + { + console.log("click",id) + } + this.prev_operation = null; - this.refresh = function(force = false) + this.refresh = function(force = false,id) { if(this.prev_operation == dotgrid.cursor.operation && force == false){ return; }