From: mjanda Date: Mon, 2 Feb 2015 08:53:27 +0000 (+0100) Subject: Call previously attached callbacks X-Git-Tag: v2.0.0~76^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=978e9dc411fd59b9ef4be5f712e3e89401630654;p=dygraphs.git Call previously attached callbacks --- diff --git a/extras/synchronizer.js b/extras/synchronizer.js index ca05a2b..67e5d5c 100644 --- a/extras/synchronizer.js +++ b/extras/synchronizer.js @@ -125,13 +125,14 @@ Dygraph.synchronize = function(/* dygraphs..., opts */) { }; }; -// TODO: call any `drawCallback`s that were set before this. function attachZoomHandlers(gs, syncOpts) { var block = false; for (var i = 0; i < gs.length; i++) { var g = gs[i]; + var oldDC = g.getFunctionOption('drawCallback'); g.updateOptions({ drawCallback: function(me, initial) { + if (oldDC) oldDC(me, initial); if (block || initial) return; block = true; var opts = { @@ -153,8 +154,11 @@ function attachSelectionHandlers(gs) { var block = false; for (var i = 0; i < gs.length; i++) { var g = gs[i]; + var oldHC = g.getFunctionOption('highlightCallback'); + var oldUHC = g.getFunctionOption('unhighlightCallback'); g.updateOptions({ highlightCallback: function(event, x, points, row, seriesName) { + if (oldHC) oldHC(event, x, points, row, seriesName); if (block) return; block = true; var me = this; @@ -168,6 +172,7 @@ function attachSelectionHandlers(gs) { block = false; }, unhighlightCallback: function(event) { + if (oldUHC) oldUHC(event); if (block) return; block = true; var me = this;