From 72ccfc7ca4f71987f69a5734d49a93ab78d9ebe8 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 30 Jun 2015 00:12:31 -0400 Subject: selection no longer requires grid --- js/ui/selection.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js/ui') diff --git a/js/ui/selection.js b/js/ui/selection.js index a3c3694..2ef2941 100644 --- a/js/ui/selection.js +++ b/js/ui/selection.js @@ -54,16 +54,15 @@ var selection = (function(){ var cell = canvas.aa[top(aa, bb)][left(aa, bb)].span var cell_left = cell.offsetLeft var cell_top = cell.offsetTop - var cell_width = 9 - var cell_height = 16 - if (!document.body.classList.contains("grid")){ - cell_width -= 1 - cell_height -= 1 - } + var cell_width = cell.offsetWidth + var cell_height = cell.offsetHeight + if (canvas.grid) { cell_width++; cell_height++ } + var w = width(aa, bb) var h = height(aa, bb) + selector_el.style.top = (cell_top-1) + "px" - selector_el.style.left = (cell_left-2) + "px" + selector_el.style.left = (cell_left-1) + "px" selector_el.style.width = (cell_width*w+1) + "px" selector_el.style.height = (cell_height*h+1) + "px" } @@ -111,6 +110,7 @@ var selection = (function(){ if (creating) { orient(a,b) selection_canvas.resize(width(a,b), height(a,b)) + reposition(a,b) blit.copy_from( canvas, selection_canvas, a[0], a[1] ) selection_canvas.build() selector_el.classList.remove("creating") -- cgit v1.2.3-70-g09d2