From 0447a19501b0aaab53d74e3e717ca83190473f57 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Sat, 9 Jul 2016 10:42:52 +0200 Subject: [PATCH 1/2] Bypassing most of the heavy lifting in the rAF for when there's no user interaction --- src/plots/gl2d/scene2d.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plots/gl2d/scene2d.js b/src/plots/gl2d/scene2d.js index 0d859b2acac..6ab9a091bf6 100644 --- a/src/plots/gl2d/scene2d.js +++ b/src/plots/gl2d/scene2d.js @@ -487,7 +487,11 @@ proto.draw = function() { this.lastPickResult.dataCoord[0] !== nextSelection.dataCoord[0] || this.lastPickResult.dataCoord[1] !== nextSelection.dataCoord[1]) ) { - var selection = this.lastPickResult = nextSelection; + var selection = nextSelection; + this.lastPickResult = { + trace: nextSelection.trace, // could we just retain/compare the trace uid? + dataCoord: nextSelection.dataCoord.slice() + }; this.spikes.update({ center: result.dataCoord }); selection.screenCoord = [ @@ -523,8 +527,6 @@ proto.draw = function() { }, { container: this.svgContainer }); - - this.lastPickResult = { dataCoord: result.dataCoord }; } } else if(!result && this.lastPickResult) { From d58a37f9f4767a6c6889801bd05734feffa294aa Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Mon, 11 Jul 2016 20:22:50 +0200 Subject: [PATCH 2/2] Use trace.uid rather than hanging on to the entire trace just for the lastPickResults (cherry picked from commit a2efeb4) --- src/plots/gl2d/scene2d.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plots/gl2d/scene2d.js b/src/plots/gl2d/scene2d.js index 6ab9a091bf6..c1876847538 100644 --- a/src/plots/gl2d/scene2d.js +++ b/src/plots/gl2d/scene2d.js @@ -483,13 +483,13 @@ proto.draw = function() { if(nextSelection && ( !this.lastPickResult || - this.lastPickResult.trace !== nextSelection.trace || + this.lastPickResult.traceUid !== nextSelection.trace.uid || this.lastPickResult.dataCoord[0] !== nextSelection.dataCoord[0] || this.lastPickResult.dataCoord[1] !== nextSelection.dataCoord[1]) ) { var selection = nextSelection; this.lastPickResult = { - trace: nextSelection.trace, // could we just retain/compare the trace uid? + traceUid: nextSelection.trace ? nextSelection.trace.uid : null, dataCoord: nextSelection.dataCoord.slice() }; this.spikes.update({ center: result.dataCoord });