OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 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/utils.html"> | 8 <link rel="import" href="/tracing/base/utils.html"> |
9 | 9 |
10 <script> | 10 <script> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 eq &= Math.abs(this.panY - that.panY) < 0.001; | 50 eq &= Math.abs(this.panY - that.panY) < 0.001; |
51 eq &= Math.abs(this.scaleX - that.scaleX) < 0.001; | 51 eq &= Math.abs(this.scaleX - that.scaleX) < 0.001; |
52 return !!eq; | 52 return !!eq; |
53 }, | 53 }, |
54 | 54 |
55 incrementPanXInViewUnits: function(xDeltaView) { | 55 incrementPanXInViewUnits: function(xDeltaView) { |
56 this.panX += this.xViewVectorToWorld(xDeltaView); | 56 this.panX += this.xViewVectorToWorld(xDeltaView); |
57 }, | 57 }, |
58 | 58 |
59 xPanWorldPosToViewPos: function(worldX, viewX, viewWidth) { | 59 xPanWorldPosToViewPos: function(worldX, viewX, viewWidth) { |
60 if (typeof viewX == 'string') { | 60 if (typeof viewX === 'string') { |
61 if (viewX === 'left') { | 61 if (viewX === 'left') { |
62 viewX = 0; | 62 viewX = 0; |
63 } else if (viewX === 'center') { | 63 } else if (viewX === 'center') { |
64 viewX = viewWidth / 2; | 64 viewX = viewWidth / 2; |
65 } else if (viewX === 'right') { | 65 } else if (viewX === 'right') { |
66 viewX = viewWidth - 1; | 66 viewX = viewWidth - 1; |
67 } else { | 67 } else { |
68 throw new Error('viewX must be left|center|right or number.'); | 68 throw new Error('viewX must be left|center|right or number.'); |
69 } | 69 } |
70 } | 70 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 applyTransformToCanvas: function(ctx) { | 109 applyTransformToCanvas: function(ctx) { |
110 ctx.transform(this.scaleX, 0, 0, 1, this.panX * this.scaleX, 0); | 110 ctx.transform(this.scaleX, 0, 0, 1, this.panX * this.scaleX, 0); |
111 } | 111 } |
112 }; | 112 }; |
113 | 113 |
114 return { | 114 return { |
115 TimelineDisplayTransform: TimelineDisplayTransform | 115 TimelineDisplayTransform: TimelineDisplayTransform |
116 }; | 116 }; |
117 }); | 117 }); |
118 </script> | 118 </script> |
OLD | NEW |