diff --git a/lib/OpenLayers/Control/KeyboardDefaults.js b/lib/OpenLayers/Control/KeyboardDefaults.js index add0f83bca..86d610a0a8 100644 --- a/lib/OpenLayers/Control/KeyboardDefaults.js +++ b/lib/OpenLayers/Control/KeyboardDefaults.js @@ -14,7 +14,7 @@ OpenLayers.Control.KeyboardDefaults.prototype = OpenLayers.Class.inherit( OpenLayers.Control, { /** @type int */ - slideFactor: 50, + slideFactor: 75, /** * @constructor @@ -50,26 +50,48 @@ OpenLayers.Control.KeyboardDefaults.prototype = defaultKeyPress: function (code) { switch(code) { case OpenLayers.Event.KEY_LEFT: - this.map.pan(-50, 0); + this.map.pan(-this.slideFactor, 0); break; case OpenLayers.Event.KEY_RIGHT: - this.map.pan(50, 0); + this.map.pan(this.slideFactor, 0); break; case OpenLayers.Event.KEY_UP: - this.map.pan(0, -50); + this.map.pan(0, -this.slideFactor); break; case OpenLayers.Event.KEY_DOWN: - this.map.pan(0, 50); + this.map.pan(0, this.slideFactor); break; - case 33: // Page Up - case 43: // + + + case 33: // Page Up + var size = this.map.getSize(); + this.map.pan(0, -0.75*size.h); + break; + case 34: // Page Down + var size = this.map.getSize(); + this.map.pan(0, 0.75*size.h); + break; + case 35: // End + var size = this.map.getSize(); + this.map.pan(0.75*size.w, 0); + break; + case 36: // Pos1 + var size = this.map.getSize(); + this.map.pan(-0.75*size.w, 0); + break; + + case 43: // + + this.map.zoomIn(); + break; + case 45: // - + this.map.zoomOut(); + break; + case 107: // + (IE only) this.map.zoomIn(); break; - case 45: // - - case 34: // Page Down + case 109: // - (IE only) this.map.zoomOut(); break; - } + } }, /** @final @type String */ diff --git a/tests/Control/test_KeyboardDefaults.html b/tests/Control/test_KeyboardDefaults.html new file mode 100644 index 0000000000..c8cb53c5c8 --- /dev/null +++ b/tests/Control/test_KeyboardDefaults.html @@ -0,0 +1,107 @@ + +
+ + + + + + +