Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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); |
|
alph
2014/08/12 14:49:59
just curious what does |x| === 120 part do?
| |
| 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.wheelDeltaX || e.wheelDeltaY) / 120 * this._offsetHeight / 8; |
|
alph
2014/08/12 14:49:59
maybe: y || x
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |