From 5256b822a23d63640eaf396a07ed642df8185eaa Mon Sep 17 00:00:00 2001 From: Michael Storm Date: Fri, 27 Jan 2017 14:09:24 -0800 Subject: [PATCH] Remove rendundant moveEnd event on rendererAgent which caused hi-res map vectors to be drawn twice --- public/libs/earth/1.0.0/earth.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/libs/earth/1.0.0/earth.js b/public/libs/earth/1.0.0/earth.js index 94cb22793..a566ab1c5 100644 --- a/public/libs/earth/1.0.0/earth.js +++ b/public/libs/earth/1.0.0/earth.js @@ -159,7 +159,6 @@ var signalEnd = _.debounce(function() { if (!op || op.type !== "drag" && op.type !== "zoom") { configuration.save({orientation: globe.orientation()}, {source: "moveEnd"}); - dispatch.trigger("moveEnd"); } }, MOVE_END_WAIT); // wait for a bit to decide if user has stopped moving the globe @@ -323,13 +322,15 @@ } // Throttled draw method helps with slow devices that would get overwhelmed by too many redraw events. + // Trailing call is disabled because, when MOVE_END_WAIT is set to 0, the "redraw" event on rendererAgent + // triggered in doDraw() after 5ms can cause cancelInterpolation() to be called _after_ the "moveEnd" event, + // but before the interpolateField task is run. var REDRAW_WAIT = 5; // milliseconds - var doDraw_throttled = _.throttle(doDraw, REDRAW_WAIT, {leading: false}); + var doDraw_throttled = _.throttle(doDraw, REDRAW_WAIT, {leading: false, trailing: false}); function doDraw() { d3.selectAll("path").attr("d", path); rendererAgent.trigger("redraw"); - doDraw_throttled = _.throttle(doDraw, REDRAW_WAIT, {leading: false}); } // Attach to map rendering events on input controller.