Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @param {string} prefix | 33 * @param {string} prefix |
| 34 */ | 34 */ |
| 35 WebInspector.OverviewGrid = function(prefix) | 35 WebInspector.OverviewGrid = function(prefix) |
| 36 { | 36 { |
| 37 this.element = createElement("div"); | 37 this.element = createElement("div"); |
| 38 this.element.id = prefix + "-overview-container"; | 38 this.element.id = prefix + "-overview-container"; |
| 39 this._enabled = false; | |
|
caseq
2015/06/17 17:19:03
Is this still used?
| |
| 39 | 40 |
| 40 this._grid = new WebInspector.TimelineGrid(); | 41 this._grid = new WebInspector.TimelineGrid(); |
| 41 this._grid.element.id = prefix + "-overview-grid"; | 42 this._grid.element.id = prefix + "-overview-grid"; |
| 42 this._grid.setScrollTop(0); | 43 this._grid.setScrollTop(0); |
| 43 | |
| 44 this.element.appendChild(this._grid.element); | 44 this.element.appendChild(this._grid.element); |
| 45 | 45 |
| 46 this._window = new WebInspector.OverviewGrid.Window(this.element, this._grid .dividersLabelBarElement); | 46 this._window = new WebInspector.OverviewGrid.Window(this.element, this._grid .dividersLabelBarElement); |
| 47 } | 47 } |
| 48 | 48 |
| 49 WebInspector.OverviewGrid.prototype = { | 49 WebInspector.OverviewGrid.prototype = { |
| 50 /** | 50 /** |
| 51 * @return {number} | 51 * @return {number} |
| 52 */ | 52 */ |
| 53 clientWidth: function() | 53 clientWidth: function() |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |