| 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.addEventListener(UI.OverviewGrid.Events.Click, this._onCl
ick, this); | 52 this._overviewGrid.setClickHandler(this._onClick.bind(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 {!Common.Event} event | 267 * @param {!Event} event |
| 268 * @return {boolean} |
| 268 */ | 269 */ |
| 269 _onClick(event) { | 270 _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(domEvent)) { | 272 if (overviewControl.onClick(event)) |
| 273 event.preventDefault(); | 273 return true; |
| 274 return; | |
| 275 } | |
| 276 } | 274 } |
| 275 return false; |
| 277 } | 276 } |
| 278 | 277 |
| 279 /** | 278 /** |
| 280 * @param {!Common.Event} event | 279 * @param {!Common.Event} event |
| 281 */ | 280 */ |
| 282 _onWindowChanged(event) { | 281 _onWindowChanged(event) { |
| 283 if (this._muteOnWindowChanged) | 282 if (this._muteOnWindowChanged) |
| 284 return; | 283 return; |
| 285 // Always use first control as a time converter. | 284 // Always use first control as a time converter. |
| 286 if (!this._overviewControls.length) | 285 if (!this._overviewControls.length) |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 left: haveRecords && startTime ? Math.min((startTime - absoluteMin) / time
Span, 1) : 0, | 574 left: haveRecords && startTime ? Math.min((startTime - absoluteMin) / time
Span, 1) : 0, |
| 576 right: haveRecords && endTime < Infinity ? (endTime - absoluteMin) / timeS
pan : 1 | 575 right: haveRecords && endTime < Infinity ? (endTime - absoluteMin) / timeS
pan : 1 |
| 577 }; | 576 }; |
| 578 } | 577 } |
| 579 | 578 |
| 580 resetCanvas() { | 579 resetCanvas() { |
| 581 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 580 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
| 582 this._canvas.height = this.element.clientHeight * window.devicePixelRatio; | 581 this._canvas.height = this.element.clientHeight * window.devicePixelRatio; |
| 583 } | 582 } |
| 584 }; | 583 }; |
| OLD | NEW |