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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 }, | 245 }, |
246 | 246 |
247 /** | 247 /** |
248 * @param {!Event} event | 248 * @param {!Event} event |
249 * @return {boolean} | 249 * @return {boolean} |
250 */ | 250 */ |
251 _startWindowSelectorDragging: function(event) | 251 _startWindowSelectorDragging: function(event) |
252 { | 252 { |
253 if (!this._enabled) | 253 if (!this._enabled) |
254 return false; | 254 return false; |
255 this._offsetLeft = event.pageX - event.offsetX; | 255 this._offsetLeft = this._parentElement.totalOffsetLeft(); |
256 var position = event.pageX - this._offsetLeft; | 256 var position = event.x - this._offsetLeft; |
257 this._overviewWindowSelector = new WebInspector.OverviewGrid.WindowSelec
tor(this._parentElement, position); | 257 this._overviewWindowSelector = new WebInspector.OverviewGrid.WindowSelec
tor(this._parentElement, position); |
258 return true; | 258 return true; |
259 }, | 259 }, |
260 | 260 |
261 /** | 261 /** |
262 * @param {!Event} event | 262 * @param {!Event} event |
263 */ | 263 */ |
264 _windowSelectorDragging: function(event) | 264 _windowSelectorDragging: function(event) |
265 { | 265 { |
266 this._overviewWindowSelector._updatePosition(event.pageX - this._offsetL
eft); | 266 this._overviewWindowSelector._updatePosition(event.x - this._offsetLeft)
; |
267 event.preventDefault(); | 267 event.preventDefault(); |
268 }, | 268 }, |
269 | 269 |
270 /** | 270 /** |
271 * @param {!Event} event | 271 * @param {!Event} event |
272 */ | 272 */ |
273 _endWindowSelectorDragging: function(event) | 273 _endWindowSelectorDragging: function(event) |
274 { | 274 { |
275 var window = this._overviewWindowSelector._close(event.pageX - this._off
setLeft); | 275 var window = this._overviewWindowSelector._close(event.x - this._offsetL
eft); |
276 delete this._overviewWindowSelector; | 276 delete this._overviewWindowSelector; |
277 if (window.end === window.start) { // Click, not drag. | 277 if (window.end === window.start) { // Click, not drag. |
278 var middle = window.end; | 278 var middle = window.end; |
279 window.start = Math.max(0, middle - WebInspector.OverviewGrid.MinSel
ectableSize / 2); | 279 window.start = Math.max(0, middle - WebInspector.OverviewGrid.MinSel
ectableSize / 2); |
280 window.end = Math.min(this._parentElement.clientWidth, middle + WebI
nspector.OverviewGrid.MinSelectableSize / 2); | 280 window.end = Math.min(this._parentElement.clientWidth, middle + WebI
nspector.OverviewGrid.MinSelectableSize / 2); |
281 } else if (window.end - window.start < WebInspector.OverviewGrid.MinSele
ctableSize) { | 281 } else if (window.end - window.start < WebInspector.OverviewGrid.MinSele
ctableSize) { |
282 if (this._parentElement.clientWidth - window.end > WebInspector.Over
viewGrid.MinSelectableSize) | 282 if (this._parentElement.clientWidth - window.end > WebInspector.Over
viewGrid.MinSelectableSize) |
283 window.end = window.start + WebInspector.OverviewGrid.MinSelecta
bleSize; | 283 window.end = window.start + WebInspector.OverviewGrid.MinSelecta
bleSize; |
284 else | 284 else |
285 window.start = window.end - WebInspector.OverviewGrid.MinSelecta
bleSize; | 285 window.start = window.end - WebInspector.OverviewGrid.MinSelecta
bleSize; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 position = Math.max(0, Math.min(position, this._width)); | 471 position = Math.max(0, Math.min(position, this._width)); |
472 if (position < this._startPosition) { | 472 if (position < this._startPosition) { |
473 this._windowSelector.style.left = position + "px"; | 473 this._windowSelector.style.left = position + "px"; |
474 this._windowSelector.style.right = this._width - this._startPosition
+ "px"; | 474 this._windowSelector.style.right = this._width - this._startPosition
+ "px"; |
475 } else { | 475 } else { |
476 this._windowSelector.style.left = this._startPosition + "px"; | 476 this._windowSelector.style.left = this._startPosition + "px"; |
477 this._windowSelector.style.right = this._width - position + "px"; | 477 this._windowSelector.style.right = this._width - position + "px"; |
478 } | 478 } |
479 } | 479 } |
480 } | 480 } |
OLD | NEW |