| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 * @param {number} height | 53 * @param {number} height |
| 54 * @param {string} color | 54 * @param {string} color |
| 55 */ | 55 */ |
| 56 _renderBar(begin, end, position, height, color) { | 56 _renderBar(begin, end, position, height, color) { |
| 57 var x = begin; | 57 var x = begin; |
| 58 var width = end - begin; | 58 var width = end - begin; |
| 59 var ctx = this.context(); | 59 var ctx = this.context(); |
| 60 ctx.fillStyle = color; | 60 ctx.fillStyle = color; |
| 61 ctx.fillRect(x, position, width, height); | 61 ctx.fillRect(x, position, width, height); |
| 62 } | 62 } |
| 63 | |
| 64 /** | |
| 65 * @override | |
| 66 * @param {number} windowLeft | |
| 67 * @param {number} windowRight | |
| 68 * @return {!{startTime: number, endTime: number}} | |
| 69 */ | |
| 70 windowTimes(windowLeft, windowRight) { | |
| 71 var absoluteMin = this._model.minimumRecordTime(); | |
| 72 var timeSpan = this._model.maximumRecordTime() - absoluteMin; | |
| 73 return {startTime: absoluteMin + timeSpan * windowLeft, endTime: absoluteMin
+ timeSpan * windowRight}; | |
| 74 } | |
| 75 | |
| 76 /** | |
| 77 * @override | |
| 78 * @param {number} startTime | |
| 79 * @param {number} endTime | |
| 80 * @return {!{left: number, right: number}} | |
| 81 */ | |
| 82 windowBoundaries(startTime, endTime) { | |
| 83 var absoluteMin = this._model.minimumRecordTime(); | |
| 84 var timeSpan = this._model.maximumRecordTime() - absoluteMin; | |
| 85 var haveRecords = absoluteMin > 0; | |
| 86 return { | |
| 87 left: haveRecords && startTime ? Math.min((startTime - absoluteMin) / time
Span, 1) : 0, | |
| 88 right: haveRecords && endTime < Infinity ? (endTime - absoluteMin) / timeS
pan : 1 | |
| 89 }; | |
| 90 } | |
| 91 }; | 63 }; |
| 92 | 64 |
| 93 /** | 65 /** |
| 94 * @unrestricted | 66 * @unrestricted |
| 95 */ | 67 */ |
| 96 Timeline.TimelineEventOverviewInput = class extends Timeline.TimelineEventOvervi
ew { | 68 Timeline.TimelineEventOverviewInput = class extends Timeline.TimelineEventOvervi
ew { |
| 97 /** | 69 /** |
| 98 * @param {!TimelineModel.TimelineModel} model | 70 * @param {!TimelineModel.TimelineModel} model |
| 99 */ | 71 */ |
| 100 constructor(model) { | 72 constructor(model) { |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 counters[group] = this._quantDuration; | 709 counters[group] = this._quantDuration; |
| 738 this._callback(counters); | 710 this._callback(counters); |
| 739 interval -= this._quantDuration; | 711 interval -= this._quantDuration; |
| 740 } | 712 } |
| 741 this._counters = []; | 713 this._counters = []; |
| 742 this._counters[group] = interval; | 714 this._counters[group] = interval; |
| 743 this._lastTime = time; | 715 this._lastTime = time; |
| 744 this._remainder = this._quantDuration - interval; | 716 this._remainder = this._quantDuration - interval; |
| 745 } | 717 } |
| 746 }; | 718 }; |
| OLD | NEW |