diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-05-05 02:34:23 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-05-05 02:34:23 -0400 |
| commit | f1f72a20179dff5834d159f72d6dd486c2ff1706 (patch) | |
| tree | 028c5adc060d4cfb6b3fc76783a398a65bb5a95d | |
| parent | 54bdfc801bd84eebbe561e107c1c19495ecb9a1d (diff) | |
check if lost focus, hide selection
| -rw-r--r-- | css/sally.css | 5 | ||||
| -rw-r--r-- | js/matrix.js | 5 | ||||
| -rw-r--r-- | js/ui/controls.js | 1 | ||||
| -rw-r--r-- | js/ui/keys.js | 7 |
4 files changed, 14 insertions, 4 deletions
diff --git a/css/sally.css b/css/sally.css index feb5567..c9afc72 100644 --- a/css/sally.css +++ b/css/sally.css @@ -61,6 +61,11 @@ span { min-width: 8px; min-height: 16px; display: inline-block; } .rapper { cursor: crosshair; } body.grid span { border-right: 1px solid #444; border-bottom: 1px solid #444; } body.grid div { border-left: 1px solid #444; } +body.grid #canvas_rapper > div:first-child, +body.grid #palette_rapper > div:first-child, +body.grid #brush_rapper > div:first-child + { border-top: 1px solid #444; } +body.grid .tool { border: 1px solid #444; } .ed { color: #fff; } .focused { box-shadow: inset 0 0px 3px #fff; border-color: #fff; } .tool.focused, .ed.focused { color: white; text-decoration: underline; } diff --git a/js/matrix.js b/js/matrix.js index 59bad86..bc09099 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -23,8 +23,7 @@ Matrix.prototype.rebuild = function (){ this.append() this.bind() this.generate && this.generate() - // the focused character might disappear after resizing.. - focused = canvas.aa[0][0] + check_if_lost_focus() } Matrix.prototype.clone = function () { var base = this @@ -47,7 +46,7 @@ Matrix.prototype.assign = function (mat) { }) this.append() this.bind() - focused = canvas.aa[0][0] + check_if_lost_focus() return this } diff --git a/js/ui/controls.js b/js/ui/controls.js index 8293a32..fe49527 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -92,6 +92,7 @@ var controls = (function(){ controls.grid = new Checkbox (grid_el) controls.grid.use = function(){ + selection.hide() document.body.classList.toggle('grid') this.update( document.body.classList.contains("grid") ) } diff --git a/js/ui/keys.js b/js/ui/keys.js index 7b636b2..fc9a47d 100644 --- a/js/ui/keys.js +++ b/js/ui/keys.js @@ -16,7 +16,7 @@ var keys = (function(){ e.preventDefault() brush.contract(1) brush.modified = false - focused = canvas.aa[0][0] + check_if_lost_focus() break } case 221: // ] @@ -84,3 +84,8 @@ var keys = (function(){ return keys })() + +function check_if_lost_focus() { + if (! focused || ! focused.span) + focused = canvas.aa[0][0] +}
\ No newline at end of file |
