Skip to content

Commit

Permalink
Zoom out RangeSlider.Preview on double click
Browse files Browse the repository at this point in the history
  • Loading branch information
rbu committed Sep 29, 2015
1 parent 5286770 commit ad02b0e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/js/Rickshaw.Graph.RangeSlider.Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,15 @@ Rickshaw.Graph.RangeSlider.Preview = Rickshaw.Class.create({
});
}

function zoomOut() {
self.graphs.forEach(function(graph) {
graph.window.xMin = undefined;
graph.window.xMax = undefined;

graph.update();
});
}

function onMousedown() {
drag.target = d3.event.target;
drag.start = self._getClientXFromEvent(d3.event, drag);
Expand Down Expand Up @@ -455,6 +464,7 @@ Rickshaw.Graph.RangeSlider.Preview = Rickshaw.Class.create({
element.select("rect.left_handle").on("touchstart", onMousedownLeftHandle);
element.select("rect.right_handle").on("touchstart", onMousedownRightHandle);
element.select("rect.middle_handle").on("touchstart", onMousedownMiddleHandle);
element.on("dblclick", zoomOut);
},

_getClientXFromEvent: function(event, drag) {
Expand Down

0 comments on commit ad02b0e

Please sign in to comment.