1<!DOCTYPE html>
2<!--
3Copyright (c) 2015 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/tracing/ui/annotations/annotation_view.html">
9
10<script>
11'use strict';
12
13tr.exportTo('tr.ui.annotations', function() {
14  /**
15   * A view that draws a vertical line on the timeline at a specific timestamp.
16   * @extends {AnnotationView}
17   * @constructor
18   */
19  function XMarkerAnnotationView(viewport, annotation) {
20    this.viewport_ = viewport;
21    this.annotation_ = annotation;
22  }
23
24  XMarkerAnnotationView.prototype = {
25    __proto__: tr.ui.annotations.AnnotationView.prototype,
26
27    draw: function(ctx) {
28      var dt = this.viewport_.currentDisplayTransform;
29      var viewX = dt.xWorldToView(this.annotation_.timestamp);
30
31      ctx.beginPath();
32      tr.ui.b.drawLine(ctx, viewX, 0, viewX, ctx.canvas.height);
33      ctx.strokeStyle = this.annotation_.strokeStyle;
34      ctx.stroke();
35    }
36  };
37
38  return {
39    XMarkerAnnotationView: XMarkerAnnotationView
40  };
41});
42</script>
43