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

Side by Side Diff: Source/devtools/front_end/ui/ResizerWidget.js

Issue 312813002: DevTools: [Responsive design] shift-drag resize widget for more precise dragging (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove pseudodoc comments Created 6 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 // 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",
21 ResizeUpdate: "ResizeUpdate", // Data: {{startPosition: number, currentPosi tion: number}}. 21 ResizeUpdate: "ResizeUpdate",
22 ResizeEnd: "ResizeEnd" // No data. 22 ResizeEnd: "ResizeEnd"
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;
32 }, 32 },
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698