Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
| 8 */ | 8 */ |
| 9 WebInspector.ResizerWidget = function() | 9 WebInspector.ResizerWidget = function() |
| 10 { | 10 { |
| 11 WebInspector.Object.call(this); | 11 WebInspector.Object.call(this); |
| 12 | 12 |
| 13 this._isEnabled = true; | 13 this._isEnabled = true; |
| 14 this._isVertical = true; | 14 this._isVertical = true; |
| 15 this._elements = []; | 15 this._elements = []; |
| 16 this._installDragOnMouseDownBound = this._installDragOnMouseDown.bind(this); | 16 this._installDragOnMouseDownBound = this._installDragOnMouseDown.bind(this); |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 WebInspector.ResizerWidget.Events = { | 19 WebInspector.ResizerWidget.Events = { |
| 20 ResizeStart: "ResizeStart", // Data: {{startPosition: number, currentPositi on: number}}. | 20 ResizeStart: "ResizeStart", // Data: {{startPosition: number, currentPositi on: number}}. |
| 21 ResizeUpdate: "ResizeUpdate", // Data: {{startPosition: number, currentPosi tion: number}}. | 21 ResizeUpdate: "ResizeUpdate", // Data: {{startPosition: number, currentPosi tion: number}}. |
|
dgozman
2014/06/04 09:05:24
Please update this.
lushnikov
2014/06/04 09:14:38
Removed these comments.
| |
| 22 ResizeEnd: "ResizeEnd" // No data. | 22 ResizeEnd: "ResizeEnd" // No data. |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 WebInspector.ResizerWidget.prototype = { | 25 WebInspector.ResizerWidget.prototype = { |
| 26 /** | 26 /** |
| 27 * @return {boolean} | 27 * @return {boolean} |
| 28 */ | 28 */ |
| 29 isEnabled: function() | 29 isEnabled: function() |
| 30 { | 30 { |
| 31 return this._isEnabled; | 31 return this._isEnabled; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 * @return {boolean} | 131 * @return {boolean} |
| 132 */ | 132 */ |
| 133 _drag: function(event) | 133 _drag: function(event) |
| 134 { | 134 { |
| 135 if (!this._isEnabled) { | 135 if (!this._isEnabled) { |
| 136 this._dragEnd(event); | 136 this._dragEnd(event); |
| 137 return true; // Cancel drag. | 137 return true; // Cancel drag. |
| 138 } | 138 } |
| 139 | 139 |
| 140 var position = this._isVertical ? event.pageY : event.pageX; | 140 var position = this._isVertical ? event.pageY : event.pageX; |
| 141 this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeUp date, { startPosition: this._startPosition, currentPosition: position }); | 141 this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeUp date, { startPosition: this._startPosition, currentPosition: position, shiftKey: event.shiftKey }); |
| 142 event.preventDefault(); | 142 event.preventDefault(); |
| 143 return false; // Continue drag. | 143 return false; // Continue drag. |
| 144 }, | 144 }, |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @param {!MouseEvent} event | 147 * @param {!MouseEvent} event |
| 148 */ | 148 */ |
| 149 _dragEnd: function(event) | 149 _dragEnd: function(event) |
| 150 { | 150 { |
| 151 this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeEn d); | 151 this.dispatchEventToListeners(WebInspector.ResizerWidget.Events.ResizeEn d); |
| 152 delete this._startPosition; | 152 delete this._startPosition; |
| 153 }, | 153 }, |
| 154 | 154 |
| 155 __proto__: WebInspector.Object.prototype | 155 __proto__: WebInspector.Object.prototype |
| 156 }; | 156 }; |
| OLD | NEW |