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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 this._overviewCalculator = new UI.TimelineOverviewCalculator(); | 42 this._overviewCalculator = new UI.TimelineOverviewCalculator(); |
43 this._overviewGrid = new UI.OverviewGrid(prefix); | 43 this._overviewGrid = new UI.OverviewGrid(prefix); |
44 this.element.appendChild(this._overviewGrid.element); | 44 this.element.appendChild(this._overviewGrid.element); |
45 this._cursorArea = this._overviewGrid.element.createChild('div', 'overview-g
rid-cursor-area'); | 45 this._cursorArea = this._overviewGrid.element.createChild('div', 'overview-g
rid-cursor-area'); |
46 this._cursorElement = this._overviewGrid.element.createChild('div', 'overvie
w-grid-cursor-position'); | 46 this._cursorElement = this._overviewGrid.element.createChild('div', 'overvie
w-grid-cursor-position'); |
47 this._cursorArea.addEventListener('mousemove', this._onMouseMove.bind(this),
true); | 47 this._cursorArea.addEventListener('mousemove', this._onMouseMove.bind(this),
true); |
48 this._cursorArea.addEventListener('mouseleave', this._hideCursor.bind(this),
true); | 48 this._cursorArea.addEventListener('mouseleave', this._hideCursor.bind(this),
true); |
49 | 49 |
50 this._overviewGrid.setResizeEnabled(false); | 50 this._overviewGrid.setResizeEnabled(false); |
51 this._overviewGrid.addEventListener(UI.OverviewGrid.Events.WindowChanged, th
is._onWindowChanged, this); | 51 this._overviewGrid.addEventListener(UI.OverviewGrid.Events.WindowChanged, th
is._onWindowChanged, this); |
52 this._overviewGrid.setClickHandler(this._onClick.bind(this)); | 52 this._overviewGrid.addEventListener(UI.OverviewGrid.Events.Click, this._onCl
ick, this); |
53 this._overviewControls = []; | 53 this._overviewControls = []; |
54 this._markers = new Map(); | 54 this._markers = new Map(); |
55 | 55 |
56 this._popoverHelper = new UI.PopoverHelper(this._cursorArea); | 56 this._popoverHelper = new UI.PopoverHelper(this._cursorArea); |
57 this._popoverHelper.initializeCallbacks( | 57 this._popoverHelper.initializeCallbacks( |
58 this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._o
nHidePopover.bind(this)); | 58 this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._o
nHidePopover.bind(this)); |
59 this._popoverHelper.setTimeout(0); | 59 this._popoverHelper.setTimeout(0); |
60 | 60 |
61 this._updateThrottler = new Common.Throttler(100); | 61 this._updateThrottler = new Common.Throttler(100); |
62 | 62 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 this._cursorEnabled = false; | 257 this._cursorEnabled = false; |
258 this._hideCursor(); | 258 this._hideCursor(); |
259 this._markers = new Map(); | 259 this._markers = new Map(); |
260 for (var i = 0; i < this._overviewControls.length; ++i) | 260 for (var i = 0; i < this._overviewControls.length; ++i) |
261 this._overviewControls[i].reset(); | 261 this._overviewControls[i].reset(); |
262 this._popoverHelper.hidePopover(); | 262 this._popoverHelper.hidePopover(); |
263 this._update(); | 263 this._update(); |
264 } | 264 } |
265 | 265 |
266 /** | 266 /** |
267 * @param {!Event} event | 267 * @param {!Common.Event} event |
268 * @return {boolean} | |
269 */ | 268 */ |
270 _onClick(event) { | 269 _onClick(event) { |
| 270 var domEvent = /** @type {!Event} */ (event.data); |
271 for (var overviewControl of this._overviewControls) { | 271 for (var overviewControl of this._overviewControls) { |
272 if (overviewControl.onClick(event)) | 272 if (overviewControl.onClick(domEvent)) { |
273 return true; | 273 event.preventDefault(); |
| 274 return; |
| 275 } |
274 } | 276 } |
275 return false; | |
276 } | 277 } |
277 | 278 |
278 /** | 279 /** |
279 * @param {!Common.Event} event | 280 * @param {!Common.Event} event |
280 */ | 281 */ |
281 _onWindowChanged(event) { | 282 _onWindowChanged(event) { |
282 if (this._muteOnWindowChanged) | 283 if (this._muteOnWindowChanged) |
283 return; | 284 return; |
284 // Always use first control as a time converter. | 285 // Always use first control as a time converter. |
285 if (!this._overviewControls.length) | 286 if (!this._overviewControls.length) |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 left: haveRecords && startTime ? Math.min((startTime - absoluteMin) / time
Span, 1) : 0, | 590 left: haveRecords && startTime ? Math.min((startTime - absoluteMin) / time
Span, 1) : 0, |
590 right: haveRecords && endTime < Infinity ? (endTime - absoluteMin) / timeS
pan : 1 | 591 right: haveRecords && endTime < Infinity ? (endTime - absoluteMin) / timeS
pan : 1 |
591 }; | 592 }; |
592 } | 593 } |
593 | 594 |
594 resetCanvas() { | 595 resetCanvas() { |
595 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 596 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
596 this._canvas.height = this.element.clientHeight * window.devicePixelRatio; | 597 this._canvas.height = this.element.clientHeight * window.devicePixelRatio; |
597 } | 598 } |
598 }; | 599 }; |
OLD | NEW |