diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-02-18 13:07:21 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-02-18 13:07:21 -0500 |
| commit | 5b7549932c55ebe7388258fb19b65a907dd5d3d1 (patch) | |
| tree | 58a91193e85c6088e05c58012dcdce868cb8806c /js/ui/controls.js | |
| parent | d67f7095d4d3f061431d9ec88996cda0e9b00267 (diff) | |
dont break the thing if you click one of the width/height fields
Diffstat (limited to 'js/ui/controls.js')
| -rw-r--r-- | js/ui/controls.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/js/ui/controls.js b/js/ui/controls.js index 6f0fb91..485f690 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -203,14 +203,15 @@ var controls = (function(){ controls.canvas_width.key = int_key(function(n, keyCode){ controls.canvas_width.read() - if (controls.canvas_width.char.length == 1) { + if (controls.canvas_width.char.length < 3) { n = parseInt(controls.canvas_width.char) * 10 + n } controls.canvas_width.char = ""+n controls.canvas_width.build() }) controls.canvas_width.onBlur = function(){ - var w = parseInt(controls.canvas_width.char) || 1 + var w = parseInt(controls.canvas_width.char) + if (! w) return; controls.canvas_width.char = w+"" controls.canvas_width.build() canvas.resize(w, canvas.h) @@ -225,7 +226,8 @@ var controls = (function(){ controls.canvas_height.build() }) controls.canvas_height.onBlur = function(){ - var h = parseInt(controls.canvas_height.char) || 1 + var h = parseInt(controls.canvas_height.char) + if (! h) return; controls.canvas_height.char = h+"" controls.canvas_height.build() canvas.resize(canvas.w, h) |
