diff options
Diffstat (limited to 'js/record.js')
| -rw-r--r-- | js/record.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/record.js b/js/record.js index 06c8ba9..fab2669 100644 --- a/js/record.js +++ b/js/record.js @@ -36,6 +36,7 @@ el.innerHTML = UI_TEMPLATE document.body.appendChild(el) bind() + activate() } function bind(){ curtain = $("curtain") @@ -54,8 +55,25 @@ h_el.addEventListener("change", box_position, false) x_el.addEventListener("change", box_position, false) y_el.addEventListener("change", box_position, false) + window.addEventListener("keydown", keydown, false) + } + var listening = false + function activate(){ + listening = true outline.style.display = "none" controls.style.display = "block" + curtain.style.display = "block" + } + function deactivate(){ + listening = false + outline.style.display = "none" + controls.style.display = "none" + curtain.style.display = "none" + } + function keydown(e){ + if (e.keyCode == 27) { // esc + ! activated ? activate : deactivate + } } function defer(callback){ var timeout = null @@ -65,6 +83,7 @@ } } function box_start(e){ + if (! listening) return e.stopPropagation() x = e.pageX y = e.pageY @@ -116,6 +135,7 @@ function unclickable(id){ $(id).style.pointerEvents = "none" } function px(n){ return (~~n) + "px" } function record(e){ + if (! listening) return e.stopPropagation() count = _int("framecount") delay = _float("framedelay") * 1000 |
