| 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/range.html"> | 8 <link rel="import" href="/tracing/base/math/range.html"> |
| 9 <link rel="import" href="/tracing/model/event_set.html"> | 9 <link rel="import" href="/tracing/model/event_set.html"> |
| 10 <link rel="import" href="/tracing/model/slice.html"> | 10 <link rel="import" href="/tracing/model/slice.html"> |
| 11 <link rel="import" href="/tracing/ui/base/ui.html"> | 11 <link rel="import" href="/tracing/ui/base/ui.html"> |
| 12 | 12 |
| 13 <script> | 13 <script> |
| 14 'use strict'; | 14 'use strict'; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * @fileoverview Provides the TimingTool class. | 17 * @fileoverview Provides the TimingTool class. |
| 18 */ | 18 */ |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 var pixWidth = dt.xViewVectorToWorld(1); | 265 var pixWidth = dt.xViewVectorToWorld(1); |
| 266 | 266 |
| 267 // Create result object with the mouse coordinates. | 267 // Create result object with the mouse coordinates. |
| 268 var result = { | 268 var result = { |
| 269 x: worldX, | 269 x: worldX, |
| 270 y: mouseY - modelTrackContainerRect.top, | 270 y: mouseY - modelTrackContainerRect.top, |
| 271 height: 0, | 271 height: 0, |
| 272 snapped: false | 272 snapped: false |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 var eventBounds = new tr.b.Range(); | 275 var eventBounds = new tr.b.math.Range(); |
| 276 for (var event of selection) { | 276 for (var event of selection) { |
| 277 var track = viewport.trackForEvent(event); | 277 var track = viewport.trackForEvent(event); |
| 278 var trackRect = track.getBoundingClientRect(); | 278 var trackRect = track.getBoundingClientRect(); |
| 279 | 279 |
| 280 eventBounds.reset(); | 280 eventBounds.reset(); |
| 281 event.addBoundsToRange(eventBounds); | 281 event.addBoundsToRange(eventBounds); |
| 282 var eventX; | 282 var eventX; |
| 283 if (Math.abs(eventBounds.min - worldX) < | 283 if (Math.abs(eventBounds.min - worldX) < |
| 284 Math.abs(eventBounds.max - worldX)) { | 284 Math.abs(eventBounds.max - worldX)) { |
| 285 eventX = eventBounds.min; | 285 eventX = eventBounds.min; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 311 | 311 |
| 312 return result; | 312 return result; |
| 313 } | 313 } |
| 314 }; | 314 }; |
| 315 | 315 |
| 316 return { | 316 return { |
| 317 TimingTool, | 317 TimingTool, |
| 318 }; | 318 }; |
| 319 }); | 319 }); |
| 320 </script> | 320 </script> |
| OLD | NEW |