X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2FDygraphOps.js;h=5dfa2be25bf3034b9f439e899c5ee3df7b6643f0;hb=6ace73a81e14176f18a521979b38ba98a70cf642;hp=072d99294f9848fafd8d2501ad1bd4683331fd89;hpb=a12f271c5fc6420d764bae5a5c12ca0785f7fd4c;p=dygraphs.git diff --git a/auto_tests/tests/DygraphOps.js b/auto_tests/tests/DygraphOps.js index 072d992..5dfa2be 100644 --- a/auto_tests/tests/DygraphOps.js +++ b/auto_tests/tests/DygraphOps.js @@ -90,12 +90,9 @@ DygraphOps.dispatchDoubleClick = function(g, custom) { g.canvas_.dispatchEvent(event); }; -DygraphOps.dispatchMouseDown = function(g, x, y, custom) { - var px = Dygraph.findPosX(g.canvas_); - var py = Dygraph.findPosY(g.canvas_); - - var pageX = px + g.toDomXCoord(x); - var pageY = py + g.toDomYCoord(y); +DygraphOps.dispatchMouseDown_Point = function(g, x, y, custom) { + var pageX = Dygraph.findPosX(g.canvas_) + x; + var pageY = Dygraph.findPosY(g.canvas_) + y; var opts = { type : 'mousedown', @@ -108,14 +105,11 @@ DygraphOps.dispatchMouseDown = function(g, x, y, custom) { var event = DygraphOps.createEvent_(opts, custom); g.canvas_.dispatchEvent(event); -}; - -DygraphOps.dispatchMouseMove = function(g, x, y, custom) { - var px = Dygraph.findPosX(g.canvas_); - var py = Dygraph.findPosY(g.canvas_); +} - var pageX = px + g.toDomXCoord(x); - var pageY = py + g.toDomYCoord(y); +DygraphOps.dispatchMouseMove_Point = function(g, x, y, custom) { + var pageX = Dygraph.findPosX(g.canvas_) + x; + var pageY = Dygraph.findPosY(g.canvas_) + y; var opts = { type : 'mousemove', @@ -129,12 +123,9 @@ DygraphOps.dispatchMouseMove = function(g, x, y, custom) { g.canvas_.dispatchEvent(event); }; -DygraphOps.dispatchMouseUp = function(g, x, y, custom) { - var px = Dygraph.findPosX(g.canvas_); - var py = Dygraph.findPosY(g.canvas_); - - var pageX = px + g.toDomXCoord(x); - var pageY = py + g.toDomYCoord(y); +DygraphOps.dispatchMouseUp_Point = function(g, x, y, custom) { + var pageX = Dygraph.findPosX(g.canvas_) + x; + var pageY = Dygraph.findPosY(g.canvas_) + y; var opts = { type : 'mouseup', @@ -147,3 +138,40 @@ DygraphOps.dispatchMouseUp = function(g, x, y, custom) { var event = DygraphOps.createEvent_(opts, custom); g.canvas_.dispatchEvent(event); }; + +/** + * Dispatches a mouse down using the graph's data coordinate system. + * (The y value mapped to the first axis.) + */ +DygraphOps.dispatchMouseDown = function(g, x, y, custom) { + DygraphOps.dispatchMouseDown_Point( + g, + g.toDomXCoord(x), + g.toDomYCoord(y), + custom); +}; + +/** + * Dispatches a mouse move using the graph's data coordinate system. + * (The y value mapped to the first axis.) + */ +DygraphOps.dispatchMouseMove = function(g, x, y, custom) { + DygraphOps.dispatchMouseMove_Point( + g, + g.toDomXCoord(x), + g.toDomYCoord(y), + custom); +}; + +/** + * Dispatches a mouse up using the graph's data coordinate system. + * (The y value mapped to the first axis.) + */ +DygraphOps.dispatchMouseUp = function(g, x, y, custom) { + DygraphOps.dispatchMouseUp_Point( + g, + g.toDomXCoord(x), + g.toDomYCoord(y), + custom); +}; +