From 109474c99ca5fc941dc8a9d12115e3d40438d2a9 Mon Sep 17 00:00:00 2001 From: Jono Brandel Date: Mon, 31 Jan 2011 12:25:57 -0800 Subject: [PATCH] added key event up and down arrows to controller.number.js --- controllers/controller.number.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/controllers/controller.number.js b/controllers/controller.number.js index 37e35ad..8f0a7a2 100644 --- a/controllers/controller.number.js +++ b/controllers/controller.number.js @@ -62,6 +62,20 @@ var NumberController = function() { clickedNumberField = true; document.addEventListener('mousemove', dragNumberField, false); }, false); + + // Handle up arrow and down arrow + numberField.addEventListener('keyup', function(e) { + switch(e.keyCode) { + case 38: // up + var newVal = _this.getValue() + step; + _this.setValue(newVal); + break; + case 40: // down + var newVal = _this.getValue() - step; + _this.setValue(newVal); + break; + } + }, false); document.addEventListener('mouseup', function(e) { document.removeEventListener('mousemove', dragNumberField, false);