diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-06-30 00:12:31 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-06-30 00:12:31 -0400 |
| commit | 72ccfc7ca4f71987f69a5734d49a93ab78d9ebe8 (patch) | |
| tree | 08d8db18f268044b932f617ba819ca2fd2178d0b /js/ui | |
| parent | afe71482758d953d819daab995bf5400029396d3 (diff) | |
selection no longer requires grid
Diffstat (limited to 'js/ui')
| -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") |
