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

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

Issue 458353005: DevTools: always zoom on wheel in flame chart. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 6 years, 4 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 if (this._highlightedEntryIndex === -1) 556 if (this._highlightedEntryIndex === -1)
557 return; 557 return;
558 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelect ed, this._highlightedEntryIndex); 558 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelect ed, this._highlightedEntryIndex);
559 }, 559 },
560 560
561 /** 561 /**
562 * @param {!Event} e 562 * @param {!Event} e
563 */ 563 */
564 _onMouseWheel: function(e) 564 _onMouseWheel: function(e)
565 { 565 {
566 var scrollIsThere = this._totalHeight > this._offsetHeight; 566 // Pan vertically when shift down only.
567 567 var panVertically = e.shiftKey && (e.wheelDeltaY || Math.abs(e.wheelDelt aX) === 120);
568 var panHorizontally = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY) && !e.shiftKey; 568 var panHorizontally = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY) && !e.shiftKey;
569 var panVertically = scrollIsThere && ((e.wheelDeltaY && !e.shiftKey) || (Math.abs(e.wheelDeltaX) === 120 && !e.shiftKey));
570 if (panVertically) { 569 if (panVertically) {
571 this._vScrollElement.scrollTop -= e.wheelDeltaY / 120 * this._offset Height / 8; 570 this._vScrollElement.scrollTop -= (e.wheelDeltaY || e.wheelDeltaX) / 120 * this._offsetHeight / 8;
572 } else if (panHorizontally) { 571 } else if (panHorizontally) {
573 var shift = -e.wheelDeltaX * this._pixelToTime; 572 var shift = -e.wheelDeltaX * this._pixelToTime;
574 this._muteAnimation = true; 573 this._muteAnimation = true;
575 this._handlePanGesture(shift); 574 this._handlePanGesture(shift);
576 this._muteAnimation = false; 575 this._muteAnimation = false;
577 } else { // Zoom. 576 } else { // Zoom.
578 const mouseWheelZoomSpeed = 1 / 120; 577 const mouseWheelZoomSpeed = 1 / 120;
579 this._handleZoomGesture(Math.pow(1.2, -(e.wheelDeltaY || e.wheelDelt aX) * mouseWheelZoomSpeed) - 1); 578 this._handleZoomGesture(Math.pow(1.2, -(e.wheelDeltaY || e.wheelDelt aX) * mouseWheelZoomSpeed) - 1);
580 } 579 }
581 580
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 { 1173 {
1175 this._highlightedMarkerIndex = -1; 1174 this._highlightedMarkerIndex = -1;
1176 this._highlightedEntryIndex = -1; 1175 this._highlightedEntryIndex = -1;
1177 this._selectedEntryIndex = -1; 1176 this._selectedEntryIndex = -1;
1178 this._textWidth = {}; 1177 this._textWidth = {};
1179 this.update(); 1178 this.update();
1180 }, 1179 },
1181 1180
1182 __proto__: WebInspector.HBox.prototype 1181 __proto__: WebInspector.HBox.prototype
1183 } 1182 }
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