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

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

Issue 1183483011: DevTools: Support popover on timeline overview. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: index-based -> frame-based 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 zoom: function(zoomFactor, referencePoint) 123 zoom: function(zoomFactor, referencePoint)
124 { 124 {
125 this._window._zoom(zoomFactor, referencePoint); 125 this._window._zoom(zoomFactor, referencePoint);
126 }, 126 },
127 127
128 /** 128 /**
129 * @param {boolean} enabled 129 * @param {boolean} enabled
130 */ 130 */
131 setResizeEnabled: function(enabled) 131 setResizeEnabled: function(enabled)
132 { 132 {
133 this._window.setEnabled(!!enabled); 133 this._window.setEnabled(enabled);
134 } 134 }
135 } 135 }
136 136
137 137
138 WebInspector.OverviewGrid.MinSelectableSize = 14; 138 WebInspector.OverviewGrid.MinSelectableSize = 14;
139 139
140 WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3; 140 WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3;
141 141
142 WebInspector.OverviewGrid.ResizerOffset = 3.5; // half pixel because offset valu es are not rounded but ceiled 142 WebInspector.OverviewGrid.ResizerOffset = 3.5; // half pixel because offset valu es are not rounded but ceiled
143 143
(...skipping 15 matching lines...) Expand all
159 this.windowRight = 1.0; 159 this.windowRight = 1.0;
160 160
161 this._parentElement.addEventListener("mousewheel", this._onMouseWheel.bind(t his), true); 161 this._parentElement.addEventListener("mousewheel", this._onMouseWheel.bind(t his), true);
162 this._parentElement.addEventListener("dblclick", this._resizeWindowMaximum.b ind(this), true); 162 this._parentElement.addEventListener("dblclick", this._resizeWindowMaximum.b ind(this), true);
163 163
164 this._overviewWindowElement = parentElement.createChild("div", "overview-gri d-window"); 164 this._overviewWindowElement = parentElement.createChild("div", "overview-gri d-window");
165 this._overviewWindowElement.appendChild(WebInspector.Widget.createStyleEleme nt("ui_lazy/overviewGrid.css")); 165 this._overviewWindowElement.appendChild(WebInspector.Widget.createStyleEleme nt("ui_lazy/overviewGrid.css"));
166 this._overviewWindowBordersElement = parentElement.createChild("div", "overv iew-grid-window-rulers"); 166 this._overviewWindowBordersElement = parentElement.createChild("div", "overv iew-grid-window-rulers");
167 parentElement.createChild("div", "overview-grid-dividers-background"); 167 parentElement.createChild("div", "overview-grid-dividers-background");
168 168
169 this._currentPositionElement = parentElement.createChild("div", "overview-gr id-current-position");
170 this._currentPositionArea = parentElement.createChild("div", "overview-grid- window-area");
171 this._currentPositionArea.addEventListener("mousemove", this._onMouseMove.bi nd(this), true);
172 this._currentPositionArea.addEventListener("mouseout", this._hideCurrentPosi tion.bind(this), true);
173
174 this._leftResizeElement = parentElement.createChild("div", "overview-grid-wi ndow-resizer"); 169 this._leftResizeElement = parentElement.createChild("div", "overview-grid-wi ndow-resizer");
175 this._leftResizeElement.style.left = 0; 170 this._leftResizeElement.style.left = 0;
176 WebInspector.installDragHandle(this._leftResizeElement, this._resizerElement StartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew- resize"); 171 WebInspector.installDragHandle(this._leftResizeElement, this._resizerElement StartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew- resize");
177 172
178 this._rightResizeElement = parentElement.createChild("div", "overview-grid-w indow-resizer overview-grid-window-resizer-right"); 173 this._rightResizeElement = parentElement.createChild("div", "overview-grid-w indow-resizer overview-grid-window-resizer-right");
179 this._rightResizeElement.style.right = 0; 174 this._rightResizeElement.style.right = 0;
180 WebInspector.installDragHandle(this._rightResizeElement, this._resizerElemen tStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "e w-resize"); 175 WebInspector.installDragHandle(this._rightResizeElement, this._resizerElemen tStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "e w-resize");
181 this.setEnabled(true); 176 this.setEnabled(true);
182 } 177 }
183 178
(...skipping 15 matching lines...) Expand all
199 this._leftResizeElement.style.left = "0%"; 194 this._leftResizeElement.style.left = "0%";
200 this._rightResizeElement.style.left = "100%"; 195 this._rightResizeElement.style.left = "100%";
201 this.setEnabled(true); 196 this.setEnabled(true);
202 }, 197 },
203 198
204 /** 199 /**
205 * @param {boolean} enabled 200 * @param {boolean} enabled
206 */ 201 */
207 setEnabled: function(enabled) 202 setEnabled: function(enabled)
208 { 203 {
209 enabled = !!enabled;
210 if (this._enabled === enabled)
211 return;
212 this._enabled = enabled; 204 this._enabled = enabled;
213 this._currentPositionArea.style.cursor = enabled ? "text" : "";
214 if (!enabled)
215 this._hideCurrentPosition();
216 },
217
218 _hideCurrentPosition: function()
219 {
220 this._currentPositionElement.style.visibility = "hidden";
221 }, 205 },
222 206
223 /** 207 /**
224 * @param {!Event} event
225 */
226 _onMouseMove: function(event)
227 {
228 if (!this._enabled)
229 return;
230 var x = event.offsetX + event.target.offsetLeft;
231 this._currentPositionElement.style.left = x + "px";
232 this._currentPositionElement.style.visibility = "visible";
233 },
234
235 /**
236 * @param {!Event} event 208 * @param {!Event} event
237 */ 209 */
238 _resizerElementStartDragging: function(event) 210 _resizerElementStartDragging: function(event)
239 { 211 {
240 if (!this._enabled) 212 if (!this._enabled)
241 return false; 213 return false;
242 this._resizerParentOffsetLeft = event.pageX - event.offsetX - event.targ et.offsetLeft; 214 this._resizerParentOffsetLeft = event.pageX - event.offsetX - event.targ et.offsetLeft;
243 event.preventDefault(); 215 event.preventDefault();
244 return true; 216 return true;
245 }, 217 },
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 position = Math.max(0, Math.min(position, this._width)); 466 position = Math.max(0, Math.min(position, this._width));
495 if (position < this._startPosition) { 467 if (position < this._startPosition) {
496 this._windowSelector.style.left = position + "px"; 468 this._windowSelector.style.left = position + "px";
497 this._windowSelector.style.right = this._width - this._startPosition + "px"; 469 this._windowSelector.style.right = this._width - this._startPosition + "px";
498 } else { 470 } else {
499 this._windowSelector.style.left = this._startPosition + "px"; 471 this._windowSelector.style.left = this._startPosition + "px";
500 this._windowSelector.style.right = this._width - position + "px"; 472 this._windowSelector.style.right = this._width - position + "px";
501 } 473 }
502 } 474 }
503 } 475 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/Popover.js ('k') | Source/devtools/front_end/ui_lazy/TimelineOverviewPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698