diff options
Diffstat (limited to 'js/ui/selection.js')
| -rw-r--r-- | js/ui/selection.js | 14 |
1 files changed, 7 insertions, 7 deletions
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") |
