Add mousewheel scrolling, but I'll bet this doesn't work on OSX
authorAndy Allan <gravitystorm@gmail.com>
Mon, 1 Nov 2010 15:26:11 +0000 (15:26 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Mon, 1 Nov 2010 15:26:11 +0000 (15:26 +0000)
TODO.txt
net/systemeD/potlatch2/EditController.as
net/systemeD/potlatch2/controller/ControllerState.as

index ec1d3bd..9a81ea1 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -81,7 +81,6 @@ Requested enhancements
 
 == UI ==
 
-* Mouse wheel zooming
 * Bbox-sensitive menu for background imagery
 * CSS editing
 * Quick-search on add-relations-to-way dialog (RelationSelectPanel)
index 2ca88c3..45201c0 100644 (file)
@@ -38,6 +38,7 @@ package net.systemeD.potlatch2 {
             map.parent.addEventListener(MouseEvent.MOUSE_MOVE, mapMouseEvent);
             map.parent.addEventListener(MouseEvent.MOUSE_UP, mapMouseEvent);
             map.parent.addEventListener(MouseEvent.MOUSE_DOWN, mapMouseEvent);
+            map.parent.addEventListener(MouseEvent.MOUSE_WHEEL, mapMouseEvent);
             map.parent.addEventListener(MouseEvent.CLICK, mapMouseEvent);
             map.parent.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
             map.parent.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
index be13bb1..08f57df 100644 (file)
@@ -103,7 +103,13 @@ package net.systemeD.potlatch2.controller {
                                controller.map.setHighlight(focus, { hover: true });
                        } else if ( event.type == MouseEvent.MOUSE_OUT ) {
                                controller.map.setHighlight(focus, { hover: false });
-                       }
+            } else if ( event.type == MouseEvent.MOUSE_WHEEL ) {
+                if (event.delta > 0) {
+                  map.zoomIn();
+                } else if (event.delta < 0) {
+                  map.zoomOut();
+                }
+            }
                        return null;
                }