OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 base.require('ui'); | 7 base.require('ui'); |
8 base.require('ui.list_view'); | 8 base.require('ui.list_view'); |
9 base.require('quad_view_viewport'); | 9 base.require('quad_view_viewport'); |
10 base.require('tree_quad_view'); | 10 base.require('tree_quad_view'); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 [1/32., 1/16., 1/8., 1/4, 1/2, 1].forEach(function(scale) { | 45 [1/32., 1/16., 1/8., 1/4, 1/2, 1].forEach(function(scale) { |
46 var mapOption = document.createElement('option'); | 46 var mapOption = document.createElement('option'); |
47 mapOption.textContent = Math.floor(scale * 100) + '%'; | 47 mapOption.textContent = Math.floor(scale * 100) + '%'; |
48 mapOption.scale = scale; | 48 mapOption.scale = scale; |
49 this.scaleSelector_.appendChild(mapOption); | 49 this.scaleSelector_.appendChild(mapOption); |
50 }.bind(this)); | 50 }.bind(this)); |
51 this.scaleSelector_.selectedIndex = 3; | 51 this.scaleSelector_.selectedIndex = 3; |
52 optionsEl.appendChild(ui.createSpan('Scale:')); | 52 optionsEl.appendChild(ui.createSpan('Scale:')); |
53 optionsEl.appendChild(this.scaleSelector_); | 53 optionsEl.appendChild(this.scaleSelector_); |
54 | 54 |
| 55 this.headerTextEl_ = document.createElement('span'); |
| 56 optionsEl.appendChild(ui.createSpan('Details:')); |
| 57 optionsEl.appendChild(this.headerTextEl_); |
| 58 |
| 59 |
55 this.activeTreeQuadView_ = new TreeQuadView(); | 60 this.activeTreeQuadView_ = new TreeQuadView(); |
56 this.pendingTreeQuadView_ = new TreeQuadView(); | 61 this.pendingTreeQuadView_ = new TreeQuadView(); |
57 this.inactiveTileView_ = new InactiveTileView(); | 62 this.inactiveTileView_ = new InactiveTileView(); |
58 | 63 |
59 this.onSelectionChanged_ = this.onSelectionChanged_.bind(this); | 64 this.onSelectionChanged_ = this.onSelectionChanged_.bind(this); |
60 this.activeTreeQuadView_.addEventListener('selection-changed', | 65 this.activeTreeQuadView_.addEventListener('selection-changed', |
61 this.onSelectionChanged_); | 66 this.onSelectionChanged_); |
62 this.pendingTreeQuadView_.addEventListener('selection-changed', | 67 this.pendingTreeQuadView_.addEventListener('selection-changed', |
63 this.onSelectionChanged_); | 68 this.onSelectionChanged_); |
64 this.inactiveTileView_.addEventListener('selection-changed', | 69 this.inactiveTileView_.addEventListener('selection-changed', |
(...skipping 29 matching lines...) Expand all Loading... |
94 | 99 |
95 updateChildren_: function() { | 100 updateChildren_: function() { |
96 var lthi = this.lthi_; | 101 var lthi = this.lthi_; |
97 if (!lthi) { | 102 if (!lthi) { |
98 this.activeTreeQuadView_.tree = undefined; | 103 this.activeTreeQuadView_.tree = undefined; |
99 this.pendingTreeQuadView_.tree = undefined; | 104 this.pendingTreeQuadView_.tree = undefined; |
100 this.viewport_ = undefined; | 105 this.viewport_ = undefined; |
101 return; | 106 return; |
102 } | 107 } |
103 | 108 |
104 var bbox = new base.BBox2(); | 109 var bbox = lthi.history.allTilesBBox; |
105 bbox.addBBox2(lthi.pendingTree.tileBBox); | |
106 bbox.addBBox2(lthi.activeTree.tileBBox); | |
107 | |
108 if (!this.viewport_) { | 110 if (!this.viewport_) { |
109 if (!bbox.isEmpty) { | 111 if (!bbox.isEmpty) { |
110 this.viewport_ = new ccfv.QuadViewViewport( | 112 this.viewport_ = new ccfv.QuadViewViewport( |
111 lthi.history.allTilesBBox); | 113 bbox); |
112 this.viewport_.scale = this.scaleSelector_.selectedOptions[0].scale; | 114 this.viewport_.scale = this.scaleSelector_.selectedOptions[0].scale; |
113 this.activeTreeQuadView_.viewport = this.viewport_; | 115 this.activeTreeQuadView_.viewport = this.viewport_; |
114 this.pendingTreeQuadView_.viewport = this.viewport_; | 116 this.pendingTreeQuadView_.viewport = this.viewport_; |
115 } else { | 117 } else { |
116 return; | 118 return; |
117 } | 119 } |
118 } | 120 } |
119 | 121 |
120 this.activeTreeQuadView_.viewport.setWorldBBox(bbox); | |
121 this.pendingTreeQuadView_.viewport.setWorldBBox(bbox); | |
122 | |
123 this.activeTreeQuadView_.which_tree = lthi.activeTree.which_tree; | 122 this.activeTreeQuadView_.which_tree = lthi.activeTree.which_tree; |
124 this.activeTreeQuadView_.tiles = lthi.activeTree.tiles; | 123 this.activeTreeQuadView_.tiles = lthi.activeTree.tiles; |
125 this.activeTreeQuadView_.headerText = | 124 this.activeTreeQuadView_.headerText = |
126 'Active Tree: ' + lthi.activeTree.tiles.length + ' live tiles'; | 125 'Active Tree: ' + lthi.activeTree.tiles.length + ' live tiles'; |
127 this.activeTreeQuadView_.deviceViewportSizeForFrame = | 126 this.activeTreeQuadView_.deviceViewportSizeForFrame = |
128 lthi.deviceViewportSize; | 127 lthi.deviceViewportSize; |
129 | 128 |
130 this.pendingTreeQuadView_.which_tree = lthi.pendingTree.which_tree; | 129 this.pendingTreeQuadView_.which_tree = lthi.pendingTree.which_tree; |
131 this.pendingTreeQuadView_.tiles = lthi.pendingTree.tiles; | 130 this.pendingTreeQuadView_.tiles = lthi.pendingTree.tiles; |
132 this.pendingTreeQuadView_.headerText = | 131 this.pendingTreeQuadView_.headerText = |
133 'Pending Tree: ' + lthi.pendingTree.tiles.length + ' live tiles'; | 132 'Pending Tree: ' + lthi.pendingTree.tiles.length + ' live tiles'; |
134 this.pendingTreeQuadView_.deviceViewportSizeForFrame = | 133 this.pendingTreeQuadView_.deviceViewportSizeForFrame = |
135 lthi.deviceViewportSize; | 134 lthi.deviceViewportSize; |
136 | 135 |
| 136 this.headerTextEl_.textContent = lthi.inactiveTiles.length + |
| 137 ' inactive tiles'; |
137 this.inactiveTileView_.tiles = lthi.inactiveTiles; | 138 this.inactiveTileView_.tiles = lthi.inactiveTiles; |
138 }, | 139 }, |
139 | 140 |
140 onSelectionChanged_: function(e) { | 141 onSelectionChanged_: function(e) { |
141 var e2 = new base.Event('selection-changed'); | 142 var e2 = new base.Event('selection-changed'); |
142 e2.selection = e.selection; | 143 e2.selection = e.selection; |
143 this.dispatchEvent(e2); | 144 this.dispatchEvent(e2); |
144 return true; | 145 return true; |
145 } | 146 } |
146 }; | 147 }; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 this.dispatchEvent(e); | 253 this.dispatchEvent(e); |
253 } | 254 } |
254 } | 255 } |
255 | 256 |
256 return { | 257 return { |
257 LTHIView: LTHIView, | 258 LTHIView: LTHIView, |
258 InactiveTileView: InactiveTileView, | 259 InactiveTileView: InactiveTileView, |
259 } | 260 } |
260 }); | 261 }); |
261 | 262 |
OLD | NEW |