Title: [145888] trunk/Source/WebCore
Revision
145888
Author
loi...@chromium.org
Date
2013-03-15 01:38:07 -0700 (Fri, 15 Mar 2013)

Log Message

Web Inspector: Flame Chart. When user zooms the chart, the point under cursor has to be the zooming center.
https://bugs.webkit.org/show_bug.cgi?id=112417

Reviewed by Yury Semikhatsky.

It converts the cursor position into time,
changes the scale factor and calculates the new offset for the canvas.

* inspector/front-end/FlameChart.js:
(WebInspector.FlameChart.prototype._adjustXScale):
(WebInspector.FlameChart.prototype._onMouseWheel):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (145887 => 145888)


--- trunk/Source/WebCore/ChangeLog	2013-03-15 08:33:14 UTC (rev 145887)
+++ trunk/Source/WebCore/ChangeLog	2013-03-15 08:38:07 UTC (rev 145888)
@@ -1,3 +1,17 @@
+2013-03-15  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: Flame Chart. When user zooms the chart, the point under cursor has to be the zooming center.
+        https://bugs.webkit.org/show_bug.cgi?id=112417
+
+        Reviewed by Yury Semikhatsky.
+
+        It converts the cursor position into time,
+        changes the scale factor and calculates the new offset for the canvas.
+
+        * inspector/front-end/FlameChart.js:
+        (WebInspector.FlameChart.prototype._adjustXScale):
+        (WebInspector.FlameChart.prototype._onMouseWheel):
+
 2013-03-13  Eugene Klyuchnikov  <eus...@chromium.org>
 
         Web Inspector: [Network] Sort columns context menu items alphabetically.

Modified: trunk/Source/WebCore/inspector/front-end/FlameChart.js (145887 => 145888)


--- trunk/Source/WebCore/inspector/front-end/FlameChart.js	2013-03-15 08:33:14 UTC (rev 145887)
+++ trunk/Source/WebCore/inspector/front-end/FlameChart.js	2013-03-15 08:38:07 UTC (rev 145888)
@@ -257,16 +257,28 @@
 
     _adjustXScale: function(direction, x)
     {
+        var cursorTime = (x + this._xOffset) / this._xScaleFactor;
         if (direction > 0)
             this._xScaleFactor /= 2;
         else
             this._xScaleFactor *= 2;
+
+        var absoluteX = Math.floor(cursorTime * this._xScaleFactor);
+        var rightEndOfViewPort = absoluteX - x + this._canvas.width;
+
+        var rightEndOfGraph = Math.floor(this._timelineData.totalTime * this._xScaleFactor);
+        if (rightEndOfViewPort > rightEndOfGraph)
+            rightEndOfViewPort = rightEndOfGraph;
+
+        this._xOffset = rightEndOfViewPort - this._canvas.width;
+        if (this._xOffset < 0)
+            this._xOffset = 0;
     },
 
     _onMouseWheel: function(e)
     {
         if (!e.shiftKey)
-            this._adjustXScale(e.wheelDelta, e.x);
+            this._adjustXScale(e.wheelDelta, e.offsetX);
         else
             this._adjustXOffset(e.wheelDelta);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to