- isDrawing = true;
- setPoint(event, g, context);
- }
- },
- mousemove: function (event, g, context) {
- if (tool == 'zoom') {
- Dygraph.defaultInteractionModel.mousemove(event, g, context);
- } else {
- if (!isDrawing) return;
- setPoint(event, g, context);
- }
- },
- mouseup: function(event, g, context) {
- if (tool == 'zoom') {
- Dygraph.defaultInteractionModel.mouseup(event, g, context);
- } else {
- finishDraw();
- }
- },
- mouseout: function(event, g, context) {
- if (tool == 'zoom') {
- Dygraph.defaultInteractionModel.mouseout(event, g, context);
- }
- },
- dblclick: function(event, g, context) {
- Dygraph.defaultInteractionModel.dblclick(event, g, context);
- },
- mousewheel: function(event, g, context) {
- var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40;
- var percentage = normal / 50;
- var axis = g.xAxisRange();
- var xOffset = g.toDomCoords(axis[0], null)[0];
- var x = event.offsetX - xOffset;
- var w = g.toDomCoords(axis[1], null)[0] - xOffset;
- var xPct = w == 0 ? 0 : (x / w);
+ },
+ mousemove: function (event, g, context) {
+ if (tool == 'zoom') {
+ Dygraph.defaultInteractionModel.mousemove(event, g, context);
+ } else {
+ if (!isDrawing) return;
+ setPoint(event, g, context);
+ }
+ },
+ mouseup: function(event, g, context) {
+ if (tool == 'zoom') {
+ Dygraph.defaultInteractionModel.mouseup(event, g, context);
+ } else {
+ finishDraw();
+ }
+ },
+ mouseout: function(event, g, context) {
+ if (tool == 'zoom') {
+ Dygraph.defaultInteractionModel.mouseout(event, g, context);
+ }
+ },
+ dblclick: function(event, g, context) {
+ Dygraph.defaultInteractionModel.dblclick(event, g, context);
+ },
+ mousewheel: function(event, g, context) {
+ var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40;
+ var percentage = normal / 50;
+ var axis = g.xAxisRange();
+ var xOffset = g.toDomCoords(axis[0], null)[0];
+ var x = event.offsetX - xOffset;
+ var w = g.toDomCoords(axis[1], null)[0] - xOffset;
+ var xPct = w === 0 ? 0 : (x / w);