diff options
Diffstat (limited to 'js/ui/selection.js')
| -rw-r--r-- | js/ui/selection.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/js/ui/selection.js b/js/ui/selection.js index ed67023..abd7da2 100644 --- a/js/ui/selection.js +++ b/js/ui/selection.js @@ -48,14 +48,20 @@ var selection = (function(){ var contains_y = a[1] <= point[1] && point[1] <= b[1] return (contains_x && contains_y) } - function reposition (a,b) { - var cell = canvas.aa[top(a,b)][left(a,b)].span + function reposition (aa, bb) { + aa = aa || a + bb = bb || b + 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 - var w = width(a,b) - var h = height(a,b) + if (!document.body.classList.contains("grid")){ + cell_width -= 1 + cell_height -= 1 + } + 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.width = (cell_width*w+1) + "px" @@ -140,6 +146,7 @@ var selection = (function(){ } var selection = {} + selection.reposition = reposition selection.down = down selection.move = move selection.up = up |
