From e854c3d3a9ba2a4d9da3365892478742f5a58e8e Mon Sep 17 00:00:00 2001 From: mirabilos Date: Tue, 7 Feb 2023 12:21:29 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"fix=20useless=20resynchronisation=20w?= =?UTF-8?q?hen=20range=20isn=E2=80=99t=20used":=20this=20is=20most=20likel?= =?UTF-8?q?y=20(part=20of)=20the=20#1011=20cause?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3034672bec44738dd15bc74591f8da477b5ebc98. --- src/extras/synchronizer.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/extras/synchronizer.js b/src/extras/synchronizer.js index 2b8bb749..0650118b 100644 --- a/src/extras/synchronizer.js +++ b/src/extras/synchronizer.js @@ -158,11 +158,8 @@ var synchronize = function(/* dygraphs..., opts */) { }; }; -function arraysAreEqualOrBothNULL(a, b) { - if (a === null && b === null) - return true; - if (!Array.isArray(a) || !Array.isArray(b)) - return false; +function arraysAreEqual(a, b) { + if (!Array.isArray(a) || !Array.isArray(b)) return false; var i = a.length; if (i !== b.length) return false; while (i--) { @@ -180,9 +177,9 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) { if (block || initial) return; block = true; var opts = { - valueRange: syncOpts.range ? me.yAxisRange() : null, dateWindow: me.xAxisRange() }; + if (syncOpts.range) opts.valueRange = me.yAxisRange(); for (var j = 0; j < gs.length; j++) { if (gs[j] == me) { @@ -193,8 +190,8 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) { } // Only redraw if there are new options - if (arraysAreEqualOrBothNULL(opts.dateWindow, gs[j].getOption('dateWindow')) && - arraysAreEqualOrBothNULL(opts.valueRange, gs[j].getOption('valueRange'))) { + if (arraysAreEqual(opts.dateWindow, gs[j].getOption('dateWindow')) && + arraysAreEqual(opts.valueRange, gs[j].getOption('valueRange'))) { continue; }