OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 /** | 4 /** |
5 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 UI.ChartViewport = class extends UI.VBox { | 7 PerfUI.ChartViewport = class extends UI.VBox { |
8 constructor() { | 8 constructor() { |
9 super(true); | 9 super(true); |
10 | 10 |
11 this.viewportElement = this.contentElement.createChild('div', 'fill'); | 11 this.viewportElement = this.contentElement.createChild('div', 'fill'); |
12 this.viewportElement.addEventListener('mousewheel', this._onMouseWheel.bind(
this), false); | 12 this.viewportElement.addEventListener('mousewheel', this._onMouseWheel.bind(
this), false); |
13 this.viewportElement.addEventListener('keydown', this._handleZoomPanKeys.bin
d(this), false); | 13 this.viewportElement.addEventListener('keydown', this._handleZoomPanKeys.bin
d(this), false); |
14 | 14 |
15 UI.installInertialDragHandle( | 15 UI.installInertialDragHandle( |
16 this.viewportElement, this._startDragging.bind(this), this._dragging.bin
d(this), this._endDragging.bind(this), | 16 this.viewportElement, this._startDragging.bind(this), this._dragging.bin
d(this), this._endDragging.bind(this), |
17 '-webkit-grabbing', null); | 17 '-webkit-grabbing', null); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 return {left: windowLeft, right: windowRight}; | 364 return {left: windowLeft, right: windowRight}; |
365 } | 365 } |
366 | 366 |
367 /** | 367 /** |
368 * @param {{left: number, right: number}} bounds | 368 * @param {{left: number, right: number}} bounds |
369 * @private | 369 * @private |
370 */ | 370 */ |
371 _requestWindowTimes(bounds) { | 371 _requestWindowTimes(bounds) { |
372 bounds.left = Number.constrain(bounds.left, this._minimumBoundary, this._tot
alTime + this._minimumBoundary); | 372 bounds.left = Number.constrain(bounds.left, this._minimumBoundary, this._tot
alTime + this._minimumBoundary); |
373 bounds.right = Number.constrain(bounds.right, this._minimumBoundary, this._t
otalTime + this._minimumBoundary); | 373 bounds.right = Number.constrain(bounds.right, this._minimumBoundary, this._t
otalTime + this._minimumBoundary); |
374 if (bounds.right - bounds.left < UI.FlameChart.MinimalTimeWindowMs) | 374 if (bounds.right - bounds.left < PerfUI.FlameChart.MinimalTimeWindowMs) |
375 return; | 375 return; |
376 this._flameChartDelegate.requestWindowTimes(bounds.left, bounds.right); | 376 this._flameChartDelegate.requestWindowTimes(bounds.left, bounds.right); |
377 } | 377 } |
378 | 378 |
379 /** | 379 /** |
380 * @param {number} startTime | 380 * @param {number} startTime |
381 * @param {number} endTime | 381 * @param {number} endTime |
382 * @private | 382 * @private |
383 */ | 383 */ |
384 _animateWindowTimes(startTime, endTime) { | 384 _animateWindowTimes(startTime, endTime) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } | 436 } |
437 this._cancelAnimation(); | 437 this._cancelAnimation(); |
438 this._cancelWindowTimesAnimation = UI.animateFunction( | 438 this._cancelWindowTimesAnimation = UI.animateFunction( |
439 this.element.window(), this._animateWindowTimes.bind(this), | 439 this.element.window(), this._animateWindowTimes.bind(this), |
440 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindowRig
ht, to: endTime}], 5, | 440 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindowRig
ht, to: endTime}], 5, |
441 this._animationCompleted.bind(this)); | 441 this._animationCompleted.bind(this)); |
442 this._pendingAnimationTimeLeft = startTime; | 442 this._pendingAnimationTimeLeft = startTime; |
443 this._pendingAnimationTimeRight = endTime; | 443 this._pendingAnimationTimeRight = endTime; |
444 } | 444 } |
445 }; | 445 }; |
OLD | NEW |