* Fixes to the Keyboard Handler to make it work better --

* drop keypress event (not used, registers as keydown in IE< which results
      in double events) 
    * return evt instead of evt.keyCode || evt.charCode, so apps can do
      whatever they like best
 * adjust ModifyFeature to new API
 * Adjust KeyboardDefaults to new API, and include a new set of keyCodes
    in switch statement to catch more cases
 * Include keyboard defaults test in list-tests.

Patch from tcoulter, work from Pedro Simonetti (See #1108), Paul Spencer,
myself. r=pagameba,me (Closes #1292)   


git-svn-id: http://svn.openlayers.org/trunk/openlayers@7644 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-07-31 17:45:16 +00:00
parent 3dcc30a24c
commit 09b4073636
6 changed files with 135 additions and 61 deletions

View File

@@ -67,7 +67,7 @@
t.eq(control.deleteCodes[0], 46, "Delete code properly turned into an array.");
var control = new OpenLayers.Control.ModifyFeature(layer);
t.eq(control.deleteCodes[0], 46, "Default deleteCodes include delete");
t.eq(control.deleteCodes[1], 100, "Default deleteCodes include 'd'");
t.eq(control.deleteCodes[1], 68, "Default deleteCodes include 'd'");
control.destroy();
layer.destroy();
@@ -123,12 +123,12 @@
"vertex deletion: onModification called with the proper feature");
};
// run the above four tests twice
control.handleKeypress(delKey);
control.handleKeypress(dKey);
control.handleKeypress({keyCode:delKey});
control.handleKeypress({keyCode:dKey});
// now make sure nothing happens if the vertex is mid-drag
control.dragControl.handlers.drag.dragging = true;
control.handleKeypress(delKey);
control.handleKeypress({keyCode:delKey});
// clean up
control.destroy();
@@ -428,7 +428,7 @@
};
point.geometry.parent = poly.geometry;
control.dragControl.feature = point;
control.handleKeypress(46);
control.handleKeypress({keyCode:46});
layer.drawFeature = oldDraw;
map.destroy();