Made v3 interaction model slightly more powerful. (shift-operate to
authorRobert Konigsberg <konigsberg@google.com>
Mon, 20 Dec 2010 23:09:52 +0000 (15:09 -0800)
committerRobert Konigsberg <konigsberg@google.com>
Mon, 20 Dec 2010 23:09:52 +0000 (15:09 -0800)
zoom)

tests/interaction.html

index 082a54e..d768dd6 100644 (file)
@@ -30,7 +30,8 @@
     </td><td>
     Zoom in: double-click, scroll wheel<br/>
     Zoom out: ctrl-double-click, scroll wheel<br/>
-    Pan: click-drag<br/>
+    Standard Zoom: shift-click-drag
+    Standard Pan: click-drag<br/>
     Restore zoom level: press button<br/>
     </td></tr>
     <tr><td>
     </td></tr>
 
     </table>
-
+        
     <script type="text/javascript">
       function downV3(event, g, context) {
         context.initializeMouseDown(event, g, context);
-        Dygraph.startPan(event, g, context);
+        if (event.altKey || event.shiftKey) {
+          Dygraph.startZoom(event, g, context);
+        } else {
+          Dygraph.startPan(event, g, context);
+        }
       }
 
       function moveV3(event, g, context) {
         if (context.isPanning) {
           Dygraph.movePan(event, g, context);
+        } else if (context.isZooming) {
+          Dygraph.moveZoom(event, g, context);
         }
       }
 
       function upV3(event, g, context) {
         if (context.isPanning) {
           Dygraph.endPan(event, g, context);
+        } else if (context.isZooming) {
+          Dygraph.endZoom(event, g, context);
         }
       }