From ad02b0e9bb9d3a3b1342f840eda3d0f84682a45f Mon Sep 17 00:00:00 2001 From: Robert Buchholz Date: Tue, 1 Apr 2014 17:36:19 +0200 Subject: [PATCH] Zoom out RangeSlider.Preview on double click --- src/js/Rickshaw.Graph.RangeSlider.Preview.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/js/Rickshaw.Graph.RangeSlider.Preview.js b/src/js/Rickshaw.Graph.RangeSlider.Preview.js index 86b39347..5a161023 100644 --- a/src/js/Rickshaw.Graph.RangeSlider.Preview.js +++ b/src/js/Rickshaw.Graph.RangeSlider.Preview.js @@ -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); @@ -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) {