| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/color_scheme.html"> | 8 <link rel="import" href="/tracing/base/color_scheme.html"> |
| 9 <link rel="import" href="/tracing/model/selection_state.html"> | 9 <link rel="import" href="/tracing/model/selection_state.html"> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * @fileoverview Provides color scheme related functions. | 15 * @fileoverview Provides color scheme related functions. |
| 16 */ | 16 */ |
| 17 tr.exportTo('tr.ui.b', function() { | 17 tr.exportTo('tr.ui.b', function() { |
| 18 var ColorScheme = tr.b.ColorScheme; | 18 var ColorScheme = tr.b.ColorScheme; |
| 19 | 19 |
| 20 var colors = ColorScheme.colors; | 20 var colors = ColorScheme.colors; |
| 21 var colorsAsStrings = ColorScheme.colorsAsStrings; | 21 var colorsAsStrings = ColorScheme.colorsAsStrings; |
| 22 var numBaseColors = ColorScheme.properties.numBaseColors; | 22 var numColorsPerVariant = ColorScheme.properties.numColorsPerVariant; |
| 23 | 23 |
| 24 var SelectionState = tr.model.SelectionState; | 24 var SelectionState = tr.model.SelectionState; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Provides methods to get view values for events. | 27 * Provides methods to get view values for events. |
| 28 */ | 28 */ |
| 29 var EventPresenter = { | 29 var EventPresenter = { |
| 30 getSelectableItemColorAsString: function(item) { | 30 getSelectableItemColorAsString: function(item) { |
| 31 var colorId = item.colorId + this.getColorIdOffset_(item); | 31 var colorId = item.colorId + this.getColorIdOffset_(item); |
| 32 return colorsAsStrings[colorId]; | 32 return colorsAsStrings[colorId]; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 opt_alphaMultiplier) { | 73 opt_alphaMultiplier) { |
| 74 var event = {selectionState: selectionState}; | 74 var event = {selectionState: selectionState}; |
| 75 var c = colors[colorId + this.getColorIdOffset_(event)]; | 75 var c = colors[colorId + this.getColorIdOffset_(event)]; |
| 76 return c.toStringWithAlphaOverride( | 76 return c.toStringWithAlphaOverride( |
| 77 opt_alphaMultiplier !== undefined ? opt_alphaMultiplier : 1.0); | 77 opt_alphaMultiplier !== undefined ? opt_alphaMultiplier : 1.0); |
| 78 }, | 78 }, |
| 79 | 79 |
| 80 getBarSnapshotColor: function(snapshot, offset) { | 80 getBarSnapshotColor: function(snapshot, offset) { |
| 81 var colorId = | 81 var colorId = |
| 82 (snapshot.objectInstance.colorId + offset) % | 82 (snapshot.objectInstance.colorId + offset) % |
| 83 numBaseColors; | 83 numColorsPerVariant; |
| 84 colorId += this.getColorIdOffset_(snapshot); | 84 colorId += this.getColorIdOffset_(snapshot); |
| 85 return colors[colorId].toStringWithAlphaOverride(1.0); | 85 return colors[colorId].toStringWithAlphaOverride(1.0); |
| 86 } | 86 } |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 return { | 89 return { |
| 90 EventPresenter: EventPresenter | 90 EventPresenter: EventPresenter |
| 91 }; | 91 }; |
| 92 }); | 92 }); |
| 93 </script> | 93 </script> |
| OLD | NEW |