Commit a1f61fc8 authored by loislo@chromium.org's avatar loislo@chromium.org

FlameChart: REGRESSION zoom doesn't work properly when time window has its initial values.

scenario:
1) record less than one second timeline
2) zoom in or zoom out

BUG=
R=pfeldman@chromium.org

Review URL: https://codereview.chromium.org/187303003

git-svn-id: svn://svn.chromium.org/blink/trunk@168434 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent cba61820
......@@ -424,15 +424,6 @@ WebInspector.FlameChart.OverviewPane = function(dataProvider)
}
WebInspector.FlameChart.OverviewPane.prototype = {
/**
* @param {number} zoom
* @param {number} referencePoint
*/
zoom: function(zoom, referencePoint)
{
this._overviewGrid.zoom(zoom, referencePoint);
},
/**
* @param {number} windowStartTime
* @param {number} windowEndTime
......@@ -736,14 +727,15 @@ WebInspector.FlameChart.MainPane.prototype = {
*/
_onMouseWheel: function(e)
{
var windowLeft = this._timeWindowLeft;
var windowRight = this._timeWindowRight;
var windowLeft = this._timeWindowLeft ? this._timeWindowLeft : this._dataProvider.zeroTime();
var windowRight = this._timeWindowRight !== Infinity ? this._timeWindowRight : this._dataProvider.zeroTime() + this._dataProvider.totalTime();
if (e.wheelDeltaY) {
const mouseWheelZoomSpeed = 1 / 120;
var zoom = Math.pow(1.2, -e.wheelDeltaY * mouseWheelZoomSpeed) - 1;
var cursorTime = this._cursorTime(e.offsetX);
windowLeft += (this._timeWindowLeft - cursorTime) * zoom;
windowRight += (this._timeWindowRight - cursorTime) * zoom;
windowLeft += (windowLeft - cursorTime) * zoom;
windowRight += (windowRight - cursorTime) * zoom;
} else {
var shift = e.wheelDeltaX * this._pixelToTime;
shift = Number.constrain(shift, this._zeroTime - windowLeft, this._totalTime + this._zeroTime - windowRight);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment