Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: Source/devtools/front_end/ui_lazy/TimelineOverviewPane.js

Issue 1193553003: DevTools: Tweaks to timeline overview popover (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/ui_lazy/overviewGrid.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.VBox} 33 * @extends {WebInspector.VBox}
34 * @param {string} prefix 34 * @param {string} prefix
35 */ 35 */
36 WebInspector.TimelineOverviewPane = function(prefix) 36 WebInspector.TimelineOverviewPane = function(prefix)
37 { 37 {
38 WebInspector.VBox.call(this); 38 WebInspector.VBox.call(this);
39 this.element.id = prefix + "-overview-pane"; 39 this.element.id = prefix + "-overview-pane";
40 40
41 this._currentPositionElement = this.element.createChild("div", "overview-gri d-current-position");
42 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); 41 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator();
43 this._overviewGrid = new WebInspector.OverviewGrid(prefix); 42 this._overviewGrid = new WebInspector.OverviewGrid(prefix);
44 this.element.appendChild(this._overviewGrid.element); 43 this.element.appendChild(this._overviewGrid.element);
45 this.element.addEventListener("mousemove", this._onMouseMove.bind(this), tru e); 44 this._cursorArea = this._overviewGrid.element.createChild("div", "overview-g rid-cursor-area");
46 this.element.addEventListener("mouseout", this._hideCurrentPosition.bind(thi s), true); 45 this._cursorElement = this._overviewGrid.element.createChild("div", "overvie w-grid-cursor-position");
46 this._cursorArea.addEventListener("mousemove", this._onMouseMove.bind(this), true);
47 this._cursorArea.addEventListener("mouseleave", this._hideCursor.bind(this), true);
47 48
48 this._overviewGrid.setResizeEnabled(false); 49 this._overviewGrid.setResizeEnabled(false);
49 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC hanged, this._onWindowChanged, this); 50 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC hanged, this._onWindowChanged, this);
50 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.Click, this._onClick, this); 51 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.Click, this._onClick, this);
51 this._overviewControls = []; 52 this._overviewControls = [];
52 this._markers = new Map(); 53 this._markers = new Map();
53 54
54 this._popoverHelper = new WebInspector.PopoverHelper(this.contentElement, th is._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopov er.bind(this)); 55 this._popoverHelper = new WebInspector.PopoverHelper(this._cursorArea, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this));
55 this._popoverHelper.setTimeout(0); 56 this._popoverHelper.setTimeout(0);
56 57
57 this._cursorEnabled = false; 58 this._cursorEnabled = false;
58 } 59 }
59 60
60 WebInspector.TimelineOverviewPane.Events = { 61 WebInspector.TimelineOverviewPane.Events = {
61 WindowChanged: "WindowChanged" 62 WindowChanged: "WindowChanged"
62 }; 63 };
63 64
64 WebInspector.TimelineOverviewPane.prototype = { 65 WebInspector.TimelineOverviewPane.prototype = {
65 /** 66 /**
66 * @param {!Element} element 67 * @param {!Element} element
67 * @param {!Event} event 68 * @param {!Event} event
68 * @return {!Element|!AnchorBox|undefined} 69 * @return {!Element|!AnchorBox|undefined}
69 */ 70 */
70 _getPopoverAnchor: function(element, event) 71 _getPopoverAnchor: function(element, event)
71 { 72 {
72 return this.element; 73 return this._cursorArea;
73 }, 74 },
74 75
75 /** 76 /**
76 * @param {!Element} anchor 77 * @param {!Element} anchor
77 * @param {!WebInspector.Popover} popover 78 * @param {!WebInspector.Popover} popover
78 */ 79 */
79 _showPopover: function(anchor, popover) 80 _showPopover: function(anchor, popover)
80 { 81 {
81 this._popover = popover; 82 this._popover = popover;
82 this._popoverContents = createElement("div"); 83 this._popoverContents = createElement("div");
83 if (!this._populatePopoverContents()) 84 if (!this._populatePopoverContents())
84 return; 85 return;
85 var content = new WebInspector.TimelineOverviewPane.PopoverContents(); 86 var content = new WebInspector.TimelineOverviewPane.PopoverContents();
86 content.contentElement.appendChild(this._popoverContents); 87 content.contentElement.appendChild(this._popoverContents);
87 popover.showView(content, this._currentPositionElement); 88 popover.showView(content, this._cursorElement);
88 }, 89 },
89 90
90 _onHidePopover: function() 91 _onHidePopover: function()
91 { 92 {
92 this._popover = null; 93 this._popover = null;
93 this._popoverContents = null; 94 this._popoverContents = null;
94 }, 95 },
95 96
96 /** 97 /**
97 * @param {!Event} event 98 * @param {!Event} event
98 */ 99 */
99 _onMouseMove: function(event) 100 _onMouseMove: function(event)
100 { 101 {
101 if (!this._cursorEnabled) 102 if (!this._cursorEnabled)
102 return; 103 return;
103 var x = event.offsetX + event.target.offsetLeft; 104 var x = event.offsetX + event.target.offsetLeft;
104 this._currentPositionElement.style.left = x + "px"; 105 this._cursorElement.style.left = x + "px";
105 this._currentPositionElement.style.visibility = "visible"; 106 this._cursorElement.style.visibility = "visible";
106 if (!this._popover) 107 if (!this._popover)
107 return; 108 return;
108 this._populatePopoverContents(); 109 this._populatePopoverContents();
109 this._popover.positionElement(this._currentPositionElement); 110 this._popover.positionElement(this._cursorElement);
110 }, 111 },
111 112
112 _populatePopoverContents: function() 113 _populatePopoverContents: function()
113 { 114 {
114 var cursor = this._currentPositionElement; 115 var x = this._cursorElement.offsetLeft;
115 var x = cursor.offsetLeft;
116 var elements = []; 116 var elements = [];
117 for (var control of this._overviewControls) { 117 for (var control of this._overviewControls) {
118 var element = control.popoverElement(x); 118 var element = control.popoverElement(x);
119 if (element) 119 if (element)
120 elements.push(element); 120 elements.push(element);
121 } 121 }
122 this._popoverContents.removeChildren(); 122 this._popoverContents.removeChildren();
123 if (!elements.length) 123 if (!elements.length)
124 return false; 124 return false;
125 elements.forEach(this._popoverContents.appendChild.bind(this._popoverCon tents)); 125 elements.forEach(this._popoverContents.appendChild.bind(this._popoverCon tents));
126 return true; 126 return true;
127 }, 127 },
128 128
129 _hideCurrentPosition: function() 129 _hideCursor: function()
130 { 130 {
131 this._currentPositionElement.style.visibility = "hidden"; 131 this._cursorElement.style.visibility = "hidden";
132 }, 132 },
133 133
134 /** 134 /**
135 * @override 135 * @override
136 */ 136 */
137 wasShown: function() 137 wasShown: function()
138 { 138 {
139 this.update(); 139 this.update();
140 }, 140 },
141 141
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 this._overviewGrid.addEventDividers(filteredMarkers.valuesArray()); 211 this._overviewGrid.addEventDividers(filteredMarkers.valuesArray());
212 }, 212 },
213 213
214 reset: function() 214 reset: function()
215 { 215 {
216 this._overviewCalculator.reset(); 216 this._overviewCalculator.reset();
217 this._overviewGrid.reset(); 217 this._overviewGrid.reset();
218 this._overviewGrid.setResizeEnabled(false); 218 this._overviewGrid.setResizeEnabled(false);
219 this._overviewGrid.updateDividers(this._overviewCalculator); 219 this._overviewGrid.updateDividers(this._overviewCalculator);
220 this._cursorEnabled = false; 220 this._cursorEnabled = false;
221 this._hideCurrentPosition(); 221 this._hideCursor();
222 this._markers = new Map(); 222 this._markers = new Map();
223 for (var i = 0; i < this._overviewControls.length; ++i) 223 for (var i = 0; i < this._overviewControls.length; ++i)
224 this._overviewControls[i].reset(); 224 this._overviewControls[i].reset();
225 this._popoverHelper.hidePopover(); 225 this._popoverHelper.hidePopover();
226 this.update(); 226 this.update();
227 }, 227 },
228 228
229 /** 229 /**
230 * @param {!WebInspector.Event} event 230 * @param {!WebInspector.Event} event
231 */ 231 */
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 }, 573 },
574 574
575 resetCanvas: function() 575 resetCanvas: function()
576 { 576 {
577 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; 577 this._canvas.width = this.element.clientWidth * window.devicePixelRatio;
578 this._canvas.height = this.element.clientHeight * window.devicePixelRati o; 578 this._canvas.height = this.element.clientHeight * window.devicePixelRati o;
579 }, 579 },
580 580
581 __proto__: WebInspector.VBox.prototype 581 __proto__: WebInspector.VBox.prototype
582 } 582 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ui_lazy/overviewGrid.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698