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 26 matching lines...) Expand all Loading... |
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 | 39 |
40 this._grid = new WebInspector.TimelineGrid(); | 40 this._grid = new WebInspector.TimelineGrid(); |
41 this._grid.element.id = prefix + "-overview-grid"; | 41 this._grid.element.id = prefix + "-overview-grid"; |
42 this._grid.setScrollTop(0); | 42 this._grid.setScrollTop(0); |
43 | 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() |
54 { | 54 { |
55 return this.element.clientWidth; | 55 return this.element.clientWidth; |
56 }, | 56 }, |
57 | 57 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 this._window._zoom(zoomFactor, referencePoint); | 126 this._window._zoom(zoomFactor, referencePoint); |
127 }, | 127 }, |
128 | 128 |
129 /** | 129 /** |
130 * @param {boolean} enabled | 130 * @param {boolean} enabled |
131 */ | 131 */ |
132 setResizeEnabled: function(enabled) | 132 setResizeEnabled: function(enabled) |
133 { | 133 { |
134 this._window.setEnabled(enabled); | 134 this._window.setEnabled(enabled); |
135 } | 135 } |
136 } | 136 }; |
137 | 137 |
138 | 138 |
139 WebInspector.OverviewGrid.MinSelectableSize = 14; | 139 WebInspector.OverviewGrid.MinSelectableSize = 14; |
140 | 140 |
141 WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3; | 141 WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3; |
142 | 142 |
143 WebInspector.OverviewGrid.ResizerOffset = 3.5; // half pixel because offset valu
es are not rounded but ceiled | 143 WebInspector.OverviewGrid.ResizerOffset = 3.5; // half pixel because offset valu
es are not rounded but ceiled |
144 | 144 |
145 /** | 145 /** |
146 * @constructor | 146 * @constructor |
(...skipping 14 matching lines...) Expand all Loading... |
161 WebInspector.appendStyle(this._parentElement, "ui_lazy/overviewGrid.css"); | 161 WebInspector.appendStyle(this._parentElement, "ui_lazy/overviewGrid.css"); |
162 | 162 |
163 this._leftResizeElement = parentElement.createChild("div", "overview-grid-wi
ndow-resizer"); | 163 this._leftResizeElement = parentElement.createChild("div", "overview-grid-wi
ndow-resizer"); |
164 WebInspector.installDragHandle(this._leftResizeElement, this._resizerElement
StartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew-
resize"); | 164 WebInspector.installDragHandle(this._leftResizeElement, this._resizerElement
StartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew-
resize"); |
165 this._rightResizeElement = parentElement.createChild("div", "overview-grid-w
indow-resizer"); | 165 this._rightResizeElement = parentElement.createChild("div", "overview-grid-w
indow-resizer"); |
166 WebInspector.installDragHandle(this._rightResizeElement, this._resizerElemen
tStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "e
w-resize"); | 166 WebInspector.installDragHandle(this._rightResizeElement, this._resizerElemen
tStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "e
w-resize"); |
167 | 167 |
168 this._leftCurtainElement = parentElement.createChild("div", "window-curtain-
left"); | 168 this._leftCurtainElement = parentElement.createChild("div", "window-curtain-
left"); |
169 this._rightCurtainElement = parentElement.createChild("div", "window-curtain
-right"); | 169 this._rightCurtainElement = parentElement.createChild("div", "window-curtain
-right"); |
170 this.reset(); | 170 this.reset(); |
171 } | 171 }; |
172 | 172 |
173 /** @enum {symbol} */ | 173 /** @enum {symbol} */ |
174 WebInspector.OverviewGrid.Events = { | 174 WebInspector.OverviewGrid.Events = { |
175 WindowChanged: Symbol("WindowChanged"), | 175 WindowChanged: Symbol("WindowChanged"), |
176 Click: Symbol("Click") | 176 Click: Symbol("Click") |
177 } | 177 }; |
178 | 178 |
179 WebInspector.OverviewGrid.Window.prototype = { | 179 WebInspector.OverviewGrid.Window.prototype = { |
180 reset: function() | 180 reset: function() |
181 { | 181 { |
182 this.windowLeft = 0.0; | 182 this.windowLeft = 0.0; |
183 this.windowRight = 1.0; | 183 this.windowRight = 1.0; |
184 this.setEnabled(true); | 184 this.setEnabled(true); |
185 this._updateCurtains(); | 185 this._updateCurtains(); |
186 }, | 186 }, |
187 | 187 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 420 } |
421 left = reference + (left - reference) * factor; | 421 left = reference + (left - reference) * factor; |
422 left = Number.constrain(left, 0, 1 - newWindowSize); | 422 left = Number.constrain(left, 0, 1 - newWindowSize); |
423 | 423 |
424 right = reference + (right - reference) * factor; | 424 right = reference + (right - reference) * factor; |
425 right = Number.constrain(right, newWindowSize, 1); | 425 right = Number.constrain(right, newWindowSize, 1); |
426 this._setWindow(left, right); | 426 this._setWindow(left, right); |
427 }, | 427 }, |
428 | 428 |
429 __proto__: WebInspector.Object.prototype | 429 __proto__: WebInspector.Object.prototype |
430 } | 430 }; |
431 | 431 |
432 /** | 432 /** |
433 * @constructor | 433 * @constructor |
434 */ | 434 */ |
435 WebInspector.OverviewGrid.WindowSelector = function(parent, position) | 435 WebInspector.OverviewGrid.WindowSelector = function(parent, position) |
436 { | 436 { |
437 this._startPosition = position; | 437 this._startPosition = position; |
438 this._width = parent.offsetWidth; | 438 this._width = parent.offsetWidth; |
439 this._windowSelector = createElement("div"); | 439 this._windowSelector = createElement("div"); |
440 this._windowSelector.className = "overview-grid-window-selector"; | 440 this._windowSelector.className = "overview-grid-window-selector"; |
441 this._windowSelector.style.left = this._startPosition + "px"; | 441 this._windowSelector.style.left = this._startPosition + "px"; |
442 this._windowSelector.style.right = this._width - this._startPosition + "px"; | 442 this._windowSelector.style.right = this._width - this._startPosition + "px"; |
443 parent.appendChild(this._windowSelector); | 443 parent.appendChild(this._windowSelector); |
444 } | 444 }; |
445 | 445 |
446 WebInspector.OverviewGrid.WindowSelector.prototype = { | 446 WebInspector.OverviewGrid.WindowSelector.prototype = { |
447 _close: function(position) | 447 _close: function(position) |
448 { | 448 { |
449 position = Math.max(0, Math.min(position, this._width)); | 449 position = Math.max(0, Math.min(position, this._width)); |
450 this._windowSelector.remove(); | 450 this._windowSelector.remove(); |
451 return this._startPosition < position ? {start: this._startPosition, end
: position} : {start: position, end: this._startPosition}; | 451 return this._startPosition < position ? {start: this._startPosition, end
: position} : {start: position, end: this._startPosition}; |
452 }, | 452 }, |
453 | 453 |
454 _updatePosition: function(position) | 454 _updatePosition: function(position) |
455 { | 455 { |
456 position = Math.max(0, Math.min(position, this._width)); | 456 position = Math.max(0, Math.min(position, this._width)); |
457 if (position < this._startPosition) { | 457 if (position < this._startPosition) { |
458 this._windowSelector.style.left = position + "px"; | 458 this._windowSelector.style.left = position + "px"; |
459 this._windowSelector.style.right = this._width - this._startPosition
+ "px"; | 459 this._windowSelector.style.right = this._width - this._startPosition
+ "px"; |
460 } else { | 460 } else { |
461 this._windowSelector.style.left = this._startPosition + "px"; | 461 this._windowSelector.style.left = this._startPosition + "px"; |
462 this._windowSelector.style.right = this._width - position + "px"; | 462 this._windowSelector.style.right = this._width - position + "px"; |
463 } | 463 } |
464 } | 464 } |
465 } | 465 }; |
OLD | NEW |