Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: Source/devtools/front_end/FlameChart.js

Issue 187303003: FlameChart: REGRESSION zoom doesn't work properly when time window has its initial values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 this._overviewGrid = new WebInspector.OverviewGrid("flame-chart"); 418 this._overviewGrid = new WebInspector.OverviewGrid("flame-chart");
419 this._overviewGrid.element.classList.add("fill"); 419 this._overviewGrid.element.classList.add("fill");
420 this._overviewCanvas = this._overviewContainer.createChild("canvas", "flame- chart-overview-canvas"); 420 this._overviewCanvas = this._overviewContainer.createChild("canvas", "flame- chart-overview-canvas");
421 this._overviewContainer.appendChild(this._overviewGrid.element); 421 this._overviewContainer.appendChild(this._overviewGrid.element);
422 this._overviewCalculator = new WebInspector.FlameChart.OverviewCalculator(); 422 this._overviewCalculator = new WebInspector.FlameChart.OverviewCalculator();
423 this._dataProvider = dataProvider; 423 this._dataProvider = dataProvider;
424 } 424 }
425 425
426 WebInspector.FlameChart.OverviewPane.prototype = { 426 WebInspector.FlameChart.OverviewPane.prototype = {
427 /** 427 /**
428 * @param {number} zoom
429 * @param {number} referencePoint
430 */
431 zoom: function(zoom, referencePoint)
432 {
433 this._overviewGrid.zoom(zoom, referencePoint);
434 },
435
436 /**
437 * @param {number} windowStartTime 428 * @param {number} windowStartTime
438 * @param {number} windowEndTime 429 * @param {number} windowEndTime
439 */ 430 */
440 requestWindowTimes: function(windowStartTime, windowEndTime) 431 requestWindowTimes: function(windowStartTime, windowEndTime)
441 { 432 {
442 this._overviewGrid.setWindow(windowStartTime / this._dataProvider.totalT ime(), windowEndTime / this._dataProvider.totalTime()); 433 this._overviewGrid.setWindow(windowStartTime / this._dataProvider.totalT ime(), windowEndTime / this._dataProvider.totalTime());
443 }, 434 },
444 435
445 /** 436 /**
446 * @param {!number} timeLeft 437 * @param {!number} timeLeft
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 var data = this._dataProvider.entryData(this._highlightedEntryIndex); 720 var data = this._dataProvider.entryData(this._highlightedEntryIndex);
730 if (data) 721 if (data)
731 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySe lected, data); 722 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySe lected, data);
732 }, 723 },
733 724
734 /** 725 /**
735 * @param {?MouseEvent} e 726 * @param {?MouseEvent} e
736 */ 727 */
737 _onMouseWheel: function(e) 728 _onMouseWheel: function(e)
738 { 729 {
739 var windowLeft = this._timeWindowLeft; 730 var windowLeft = this._timeWindowLeft ? this._timeWindowLeft : this._dat aProvider.zeroTime();
pfeldman 2014/03/05 05:33:50 I think using -1 for default values is more approp
740 var windowRight = this._timeWindowRight; 731 var windowRight = this._timeWindowRight !== Infinity ? this._timeWindowR ight : this._dataProvider.zeroTime() + this._dataProvider.totalTime();
732
741 if (e.wheelDeltaY) { 733 if (e.wheelDeltaY) {
742 const mouseWheelZoomSpeed = 1 / 120; 734 const mouseWheelZoomSpeed = 1 / 120;
743 var zoom = Math.pow(1.2, -e.wheelDeltaY * mouseWheelZoomSpeed) - 1; 735 var zoom = Math.pow(1.2, -e.wheelDeltaY * mouseWheelZoomSpeed) - 1;
744 var cursorTime = this._cursorTime(e.offsetX); 736 var cursorTime = this._cursorTime(e.offsetX);
745 windowLeft += (this._timeWindowLeft - cursorTime) * zoom; 737 windowLeft += (windowLeft - cursorTime) * zoom;
746 windowRight += (this._timeWindowRight - cursorTime) * zoom; 738 windowRight += (windowRight - cursorTime) * zoom;
747 } else { 739 } else {
748 var shift = e.wheelDeltaX * this._pixelToTime; 740 var shift = e.wheelDeltaX * this._pixelToTime;
749 shift = Number.constrain(shift, this._zeroTime - windowLeft, this._t otalTime + this._zeroTime - windowRight); 741 shift = Number.constrain(shift, this._zeroTime - windowLeft, this._t otalTime + this._zeroTime - windowRight);
750 windowLeft += shift; 742 windowLeft += shift;
751 windowRight += shift; 743 windowRight += shift;
752 } 744 }
753 windowLeft = Number.constrain(windowLeft, this._zeroTime, this._totalTim e + this._zeroTime); 745 windowLeft = Number.constrain(windowLeft, this._zeroTime, this._totalTim e + this._zeroTime);
754 windowRight = Number.constrain(windowRight, this._zeroTime, this._totalT ime + this._zeroTime); 746 windowRight = Number.constrain(windowRight, this._zeroTime, this._totalT ime + this._zeroTime);
755 this._timeRangeController.requestWindowTimes(windowLeft, windowRight); 747 this._timeRangeController.requestWindowTimes(windowLeft, windowRight);
756 }, 748 },
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 this._timelineGrid.hideDividers(); 1065 this._timelineGrid.hideDividers();
1074 this.draw(this.element.clientWidth, this.element.clientHeight); 1066 this.draw(this.element.clientWidth, this.element.clientHeight);
1075 this._calculator._updateBoundaries(this); 1067 this._calculator._updateBoundaries(this);
1076 this._timelineGrid.element.style.width = this.element.clientWidth; 1068 this._timelineGrid.element.style.width = this.element.clientWidth;
1077 var offsets = this._dataProvider.dividerOffsets(this._calculator.minimum Boundary(), this._calculator.maximumBoundary()); 1069 var offsets = this._dataProvider.dividerOffsets(this._calculator.minimum Boundary(), this._calculator.maximumBoundary());
1078 this._timelineGrid.updateDividers(this._calculator, offsets, true); 1070 this._timelineGrid.updateDividers(this._calculator, offsets, true);
1079 }, 1071 },
1080 1072
1081 __proto__: WebInspector.View.prototype 1073 __proto__: WebInspector.View.prototype
1082 } 1074 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698