Chromium Code Reviews| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 */ | 8 */ |
| 9 WebInspector.ChartViewport = function() | 9 WebInspector.ChartViewport = function() |
| 10 { | 10 { |
| 11 WebInspector.VBox.call(this, true); | 11 WebInspector.VBox.call(this, true); |
| 12 | 12 |
| 13 this.contentElement.addEventListener("mousewheel", this._onMouseWheel.bind(t his), false); | 13 this.contentElement.addEventListener("mousewheel", this._onMouseWheel.bind(t his), false); |
| 14 this.contentElement.addEventListener("keydown", this._handleZoomPanKeys.bind (this), false); | 14 this.contentElement.addEventListener("keydown", this._handleZoomPanKeys.bind (this), false); |
| 15 | 15 |
| 16 WebInspector.installInertialDragHandle(this.contentElement, this._startDragg ing.bind(this), this._dragging.bind(this), this._endDragging.bind(this), "-webki t-grabbing", null); | 16 /** @private */ |
|
caseq
2016/10/20 21:33:51
let's not use it on all privates. perhaps rather f
alph
2016/10/20 22:59:37
Done.
| |
| 17 WebInspector.installDragHandle(this.contentElement, this._startRangeSelectio n.bind(this), this._rangeSelectionDragging.bind(this), this._endRangeSelection.b ind(this), "text", null); | 17 this._dragContainer = this.contentElement.createChild("div", "fill"); |
|
caseq
2016/10/20 21:33:51
I don't think this is good approach.
alph
2016/10/20 22:59:38
I'd really appreciate if you can suggest anything
| |
| 18 WebInspector.installInertialDragHandle(this._dragContainer, this._startDragg ing.bind(this), this._dragging.bind(this), this._endDragging.bind(this), "-webki t-grabbing", null); | |
| 19 WebInspector.installDragHandle(this._dragContainer, this._startRangeSelectio n.bind(this), this._rangeSelectionDragging.bind(this), this._endRangeSelection.b ind(this), "text", null); | |
| 18 | 20 |
| 19 /** @private */ | 21 /** @private */ |
| 20 this._vScrollElement = this.contentElement.createChild("div", "flame-chart-v -scroll"); | 22 this._vScrollElement = this.contentElement.createChild("div", "flame-chart-v -scroll"); |
| 21 this._vScrollContent = this._vScrollElement.createChild("div"); | 23 this._vScrollContent = this._vScrollElement.createChild("div"); |
| 22 this._vScrollElement.addEventListener("scroll", this._onScroll.bind(this), f alse); | 24 this._vScrollElement.addEventListener("scroll", this._onScroll.bind(this), f alse); |
| 23 | 25 |
| 24 /** @private */ | 26 /** @private */ |
| 25 this._selectionOverlay = this.contentElement.createChild("div", "flame-chart -selection-overlay hidden"); | 27 this._selectionOverlay = this.contentElement.createChild("div", "flame-chart -selection-overlay hidden"); |
| 26 /** @private */ | 28 /** @private */ |
| 27 this._selectedTimeSpanLabel = this._selectionOverlay.createChild("div", "tim e-span"); | 29 this._selectedTimeSpanLabel = this._selectionOverlay.createChild("div", "tim e-span"); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 46 { | 48 { |
| 47 return [this._vScrollElement]; | 49 return [this._vScrollElement]; |
| 48 }, | 50 }, |
| 49 | 51 |
| 50 /** | 52 /** |
| 51 * @private | 53 * @private |
| 52 */ | 54 */ |
| 53 _updateScrollBar: function() | 55 _updateScrollBar: function() |
| 54 { | 56 { |
| 55 var showScroll = this._totalHeight > this._offsetHeight; | 57 var showScroll = this._totalHeight > this._offsetHeight; |
| 56 if (this._vScrollElement.classList.contains("hidden") === showScroll) { | 58 if (this._vScrollElement.classList.contains("hidden") !== showScroll) |
| 57 this._vScrollElement.classList.toggle("hidden", !showScroll); | 59 return; |
| 58 this._updateContentElementSize(); | 60 this._vScrollElement.classList.toggle("hidden", !showScroll); |
| 59 } | 61 this._updateContentElementSize(); |
| 60 }, | 62 }, |
| 61 | 63 |
| 62 /** | 64 /** |
| 63 * @override | 65 * @override |
| 64 */ | 66 */ |
| 65 onResize: function() | 67 onResize: function() |
| 66 { | 68 { |
| 67 this._updateScrollBar(); | 69 this._updateScrollBar(); |
| 68 this._updateContentElementSize(); | 70 this._updateContentElementSize(); |
| 69 this.scheduleUpdate(); | 71 this.scheduleUpdate(); |
| 70 }, | 72 }, |
| 71 | 73 |
| 72 reset: function() | 74 reset: function() |
| 73 { | 75 { |
| 74 this._vScrollElement.scrollTop = 0; | 76 this._vScrollElement.scrollTop = 0; |
| 75 /** @private */ | 77 /** @private */ |
| 76 this._scrollTop = 0; | 78 this._scrollTop = 0; |
| 77 /** @private */ | 79 /** @private */ |
| 78 this._rangeSelectionStart = 0; | 80 this._rangeSelectionStart = 0; |
| 79 /** @private */ | 81 /** @private */ |
| 80 this._rangeSelectionEnd = 0; | 82 this._rangeSelectionEnd = 0; |
| 81 /** @private */ | 83 /** @private */ |
| 82 this._scrollTop = 0; | |
| 83 /** @private */ | |
| 84 this._isDragging = false; | 84 this._isDragging = false; |
| 85 /** @private */ | 85 /** @private */ |
| 86 this._dragStartPointX = 0; | 86 this._dragStartPointX = 0; |
| 87 /** @private */ | 87 /** @private */ |
| 88 this._dragStartPointY = 0; | 88 this._dragStartPointY = 0; |
| 89 /** @private */ | 89 /** @private */ |
| 90 this._dragStartScrollTop = 0; | 90 this._dragStartScrollTop = 0; |
| 91 /** @private */ | 91 /** @private */ |
| 92 this._timeWindowLeft = 0; | 92 this._timeWindowLeft = 0; |
| 93 /** @private */ | 93 /** @private */ |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 this._cancelAnimation(); | 473 this._cancelAnimation(); |
| 474 this._cancelWindowTimesAnimation = WebInspector.animateFunction(this.ele ment.window(), this._animateWindowTimes.bind(this), | 474 this._cancelWindowTimesAnimation = WebInspector.animateFunction(this.ele ment.window(), this._animateWindowTimes.bind(this), |
| 475 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindo wRight, to: endTime}], 5, | 475 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindo wRight, to: endTime}], 5, |
| 476 this._animationCompleted.bind(this)); | 476 this._animationCompleted.bind(this)); |
| 477 this._pendingAnimationTimeLeft = startTime; | 477 this._pendingAnimationTimeLeft = startTime; |
| 478 this._pendingAnimationTimeRight = endTime; | 478 this._pendingAnimationTimeRight = endTime; |
| 479 }, | 479 }, |
| 480 | 480 |
| 481 __proto__: WebInspector.VBox.prototype | 481 __proto__: WebInspector.VBox.prototype |
| 482 } | 482 } |
| OLD | NEW |