[OpenLayers-Commits] r12054 - sandbox/tschaub/editing/examples
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Jun 6 23:28:48 EDT 2011
Author: tschaub
Date: 2011-06-06 20:28:47 -0700 (Mon, 06 Jun 2011)
New Revision: 12054
Modified:
sandbox/tschaub/editing/examples/draw-undo-redo.js
Log:
Safe stop.
Modified: sandbox/tschaub/editing/examples/draw-undo-redo.js
===================================================================
--- sandbox/tschaub/editing/examples/draw-undo-redo.js 2011-06-07 03:19:52 UTC (rev 12053)
+++ sandbox/tschaub/editing/examples/draw-undo-redo.js 2011-06-07 03:28:47 UTC (rev 12054)
@@ -21,16 +21,17 @@
OpenLayers.Event.observe(document, "keydown", function(evt) {
var code = evt.keyCode;
+ var handled = false;
if (code === 90) {
// z
if ("metaKey" in evt) {
if (evt.metaKey) {
draw.undo();
- evt.preventDefault();
+ handled = true;
}
} else if (evt.ctrlKey) {
draw.undo();
- evt.preventDefault();
+ handled = true;
}
}
if (code === 89) {
@@ -38,13 +39,16 @@
if ("metaKey" in evt) {
if (evt.metaKey) {
draw.redo();
- evt.preventDefault();
+ handled = true;
}
} else if (evt.ctrlKey) {
draw.redo();
- evt.preventDefault();
+ handled = true;
}
}
+ if (handled) {
+ OpenLayers.Event.stop(evt);
+ }
if (code === 27) {
// esc
draw.cancel();
More information about the Commits
mailing list