Search and Top Navigation
Ticket #3081: slider.2.diff
File slider.2.diff, 1.1 KB (added by davidb, July 11, 2008 02:14AM UTC)
completes keyboard implementation (not tested on all browsers)
Index: ui/ui.slider.js
===================================================================
--- ui/ui.slider.js (revision 439)
+++ ui/ui.slider.js (working copy)
@@ -157,11 +157,21 @@
keydown: function(keyCode, handle) {
- if(/(37|38|39|40)/.test(keyCode)) {
- var oper = /(37|40)/.test(keyCode) ? "-=" : "+=";
+ var k = keyCode;
+ if(/(33|34|35|36|37|38|39|40)/.test(k)) {
+ var o = this.options, xpos, ypos;
+ if (/(35|36)/.test(k)) {
+ xpos = (k == 35) ? o.max.x : o.min.x;
+ ypos = (k == 35) ? o.max.y : o.min.y;
+ } else {
+ var oper = /(34|37|40)/.test(k) ? "-=" : "+=";
+ var step = /(37|38|39|40)/.test(k) ? "oneStep" : "pageStep";
+ xpos = oper + this[step]("x");
+ ypos = oper + this[step]("y");
+ }
this.moveTo({
- x: oper + this.oneStep("x"),
- y: oper + this.oneStep("y")
+ x: xpos,
+ y: ypos
}, handle);
}
},
@@ -280,6 +290,9 @@
oneStep: function(axis) {
return this.options.stepping[axis] || 1;
},
+ pageStep: function(axis) {
+ return /* this.options.paging[axis] ||*/ 10;
+ },
start: function(e, handle) {
Download in other formats:
Original Format
File slider.2.diff, 1.1 KB (added by davidb, July 11, 2008 02:14AM UTC)
completes keyboard implementation (not tested on all browsers)
Index: ui/ui.slider.js
===================================================================
--- ui/ui.slider.js (revision 439)
+++ ui/ui.slider.js (working copy)
@@ -157,11 +157,21 @@
keydown: function(keyCode, handle) {
- if(/(37|38|39|40)/.test(keyCode)) {
- var oper = /(37|40)/.test(keyCode) ? "-=" : "+=";
+ var k = keyCode;
+ if(/(33|34|35|36|37|38|39|40)/.test(k)) {
+ var o = this.options, xpos, ypos;
+ if (/(35|36)/.test(k)) {
+ xpos = (k == 35) ? o.max.x : o.min.x;
+ ypos = (k == 35) ? o.max.y : o.min.y;
+ } else {
+ var oper = /(34|37|40)/.test(k) ? "-=" : "+=";
+ var step = /(37|38|39|40)/.test(k) ? "oneStep" : "pageStep";
+ xpos = oper + this[step]("x");
+ ypos = oper + this[step]("y");
+ }
this.moveTo({
- x: oper + this.oneStep("x"),
- y: oper + this.oneStep("y")
+ x: xpos,
+ y: ypos
}, handle);
}
},
@@ -280,6 +290,9 @@
oneStep: function(axis) {
return this.options.stepping[axis] || 1;
},
+ pageStep: function(axis) {
+ return /* this.options.paging[axis] ||*/ 10;
+ },
start: function(e, handle) {