X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Finteraction.js;h=ced5aefcbd1bf04c0d2f90765d1e624ee97861f1;hb=54425b14df388e9337a1d77876512bb60ba74c3b;hp=1449e71494d50a88ae0a283694b76fc419cc3fef;hpb=2c1befcbc7f5540004910f41a8c50c708a914765;p=dygraphs.git diff --git a/tests/interaction.js b/tests/interaction.js index 1449e71..ced5aef 100644 --- a/tests/interaction.js +++ b/tests/interaction.js @@ -1,3 +1,6 @@ +// Code for a variety of interaction models. Used in interaction.html, but split out from +// that file so they can be tested in isolation. +// function downV3(event, g, context) { context.initializeMouseDown(event, g, context); if (event.altKey || event.shiftKey) { @@ -70,7 +73,17 @@ function dblClickV3(event, g, context) { } } +var lastClickedGraph = null; + +function clickV3(event, g, context) { + lastClickedGraph = g; + Dygraph.cancelEvent(event); +} + function scrollV3(event, g, context) { + if (lastClickedGraph != g) { + return; + } var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40; // For me the normalized value shows 0.075 for one click. If I took // that verbatim, it would be a 7.5%.