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 25 matching lines...) Expand all Loading... |
36 */ | 36 */ |
37 WebInspector.TimelineOverviewPane = function(model, uiUtils) | 37 WebInspector.TimelineOverviewPane = function(model, uiUtils) |
38 { | 38 { |
39 WebInspector.VBox.call(this); | 39 WebInspector.VBox.call(this); |
40 this._uiUtils = uiUtils; | 40 this._uiUtils = uiUtils; |
41 this.element.id = "timeline-overview-pane"; | 41 this.element.id = "timeline-overview-pane"; |
42 | 42 |
43 this._eventDividers = []; | 43 this._eventDividers = []; |
44 | 44 |
45 this._model = model; | 45 this._model = model; |
| 46 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); |
46 | 47 |
47 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); | 48 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); |
48 this.element.appendChild(this._overviewGrid.element); | 49 this.element.appendChild(this._overviewGrid.element); |
49 | 50 |
50 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); | |
51 | |
52 model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, thi
s._reset, this); | 51 model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, thi
s._reset, this); |
53 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); | 52 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); |
54 this._overviewControls = []; | 53 this._overviewControls = []; |
55 } | 54 } |
56 | 55 |
57 WebInspector.TimelineOverviewPane.Events = { | 56 WebInspector.TimelineOverviewPane.Events = { |
58 WindowChanged: "WindowChanged" | 57 WindowChanged: "WindowChanged" |
59 }; | 58 }; |
60 | 59 |
61 WebInspector.TimelineOverviewPane.prototype = { | 60 WebInspector.TimelineOverviewPane.prototype = { |
(...skipping 23 matching lines...) Expand all Loading... |
85 overviewControls[i].show(this._overviewGrid.element); | 84 overviewControls[i].show(this._overviewGrid.element); |
86 } | 85 } |
87 this._overviewControls = overviewControls; | 86 this._overviewControls = overviewControls; |
88 this.update(); | 87 this.update(); |
89 }, | 88 }, |
90 | 89 |
91 update: function() | 90 update: function() |
92 { | 91 { |
93 delete this._refreshTimeout; | 92 delete this._refreshTimeout; |
94 | 93 |
95 this._overviewCalculator._setWindow(this._model.minimumRecordTime(), thi
s._model.maximumRecordTime()); | 94 if (this._model.isEmpty()) |
| 95 this._overviewCalculator._setWindow(0, 1000); |
| 96 else |
| 97 this._overviewCalculator._setWindow(this._model.minimumRecordTime(),
this._model.maximumRecordTime()); |
| 98 |
96 this._overviewCalculator._setDisplayWindow(0, this._overviewGrid.clientW
idth()); | 99 this._overviewCalculator._setDisplayWindow(0, this._overviewGrid.clientW
idth()); |
97 for (var i = 0; i < this._overviewControls.length; ++i) | 100 for (var i = 0; i < this._overviewControls.length; ++i) |
98 this._overviewControls[i].update(); | 101 this._overviewControls[i].update(); |
99 this._overviewGrid.updateDividers(this._overviewCalculator); | 102 this._overviewGrid.updateDividers(this._overviewCalculator); |
100 this._updateEventDividers(); | 103 this._updateEventDividers(); |
101 this._updateWindow(); | 104 this._updateWindow(); |
102 }, | 105 }, |
103 | 106 |
104 _updateEventDividers: function() | 107 _updateEventDividers: function() |
105 { | 108 { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 }, | 424 }, |
422 | 425 |
423 resetCanvas: function() | 426 resetCanvas: function() |
424 { | 427 { |
425 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 428 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
426 this._canvas.height = this.element.clientHeight * window.devicePixelRati
o; | 429 this._canvas.height = this.element.clientHeight * window.devicePixelRati
o; |
427 }, | 430 }, |
428 | 431 |
429 __proto__: WebInspector.VBox.prototype | 432 __proto__: WebInspector.VBox.prototype |
430 } | 433 } |
OLD | NEW |