-DygraphOps.dispatchMouseUp = function(g, x, y, func) {
- var px = Dygraph.findPosX(g.canvas_);
- var py = Dygraph.findPosY(g.canvas_);
-
- var pageX = px + g.toDomXCoord(x);
- var pageY = py + g.toDomYCoord(y);
-
- var evt = document.createEvent('MouseEvents');
- evt.initMouseEvent(
- 'mouseup',
- true, true, document.defaultView,
- 0, pageX, pageY, pageX, pageY,
- false, false, false, false, 0, null);
- if (func) {
- func(evt);
- }
- g.canvas_.dispatchEvent(evt);
+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',
+ screenX : pageX,
+ screenY : pageY,
+ clientX : pageX,
+ clientY : pageY,
+ };
+
+ 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);