From 1f237ed602f1d2c91c1f9901b796ca027ec918ef Mon Sep 17 00:00:00 2001 From: Robert Konigsberg <konigsberg@google.com> Date: Mon, 20 Dec 2010 15:09:52 -0800 Subject: [PATCH] Made v3 interaction model slightly more powerful. (shift-operate to zoom) --- tests/interaction.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/interaction.html b/tests/interaction.html index 082a54e..d768dd6 100644 --- a/tests/interaction.html +++ b/tests/interaction.html @@ -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> @@ -42,22 +43,30 @@ </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); } } -- 2.7.4