[perf-web] Fix first horizontal drag of the charts



commit ed79e32327cf79becaab9bba22f57cc4ad4336f6
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Sep 14 16:41:45 2014 -0400

    Fix first horizontal drag of the charts
    
    Drags started from an unclamped center time, rather than
    the displayed center time, making the behavior quite confusing
    on initial load.

 static/main.js |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/static/main.js b/static/main.js
index 4d6fefd..4fe2618 100644
--- a/static/main.js
+++ b/static/main.js
@@ -1411,7 +1411,9 @@ PerfDisplay.prototype.onWindowLoaded = function() {
         source: mainLeft,
         target: mainLeft,
         startFunction: function() {
-            this.dragStartTime = theDisplay.centerTime;
+            // theDisplay.centerTime is unclamped to get stability when zooming, but
+            // we want the *displayed* center time.
+            this.dragStartTime = theDisplay.startSeconds + theDisplay.rangeSeconds / 2;
         },
         scrollFunctionX: function(deltaX) {
             theDisplay.scrollByDeltaX(this.dragStartTime, -deltaX);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]