OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.exportPath('options'); | 5 cr.exportPath('options'); |
6 | 6 |
7 /** | 7 /** |
8 * @typedef {{ | 8 * @typedef {{ |
9 * availableColorProfiles: Array.<{profileId: number, name: string}>, | 9 * availableColorProfiles: Array.<{profileId: number, name: string}>, |
10 * colorProfile: number, | 10 * colorProfile: number, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 * @private | 267 * @private |
268 */ | 268 */ |
269 onMouseDown_: function(e) { | 269 onMouseDown_: function(e) { |
270 if (this.mirroring_) | 270 if (this.mirroring_) |
271 return true; | 271 return true; |
272 | 272 |
273 if (e.button != 0) | 273 if (e.button != 0) |
274 return true; | 274 return true; |
275 | 275 |
276 e.preventDefault(); | 276 e.preventDefault(); |
277 return this.startDragging_(e.target, {x: e.pageX, y: e.pageY}); | 277 var target = assertInstanceof(e.target, HTMLElement); |
| 278 return this.startDragging_(target, {x: e.pageX, y: e.pageY}); |
278 }, | 279 }, |
279 | 280 |
280 /** | 281 /** |
281 * Touch start handler for dragging display rectangle. | 282 * Touch start handler for dragging display rectangle. |
282 * @param {Event} e The touch start event. | 283 * @param {Event} e The touch start event. |
283 * @private | 284 * @private |
284 */ | 285 */ |
285 onTouchStart_: function(e) { | 286 onTouchStart_: function(e) { |
286 if (this.mirroring_) | 287 if (this.mirroring_) |
287 return true; | 288 return true; |
288 | 289 |
289 if (e.touches.length != 1) | 290 if (e.touches.length != 1) |
290 return false; | 291 return false; |
291 | 292 |
292 e.preventDefault(); | 293 e.preventDefault(); |
293 var touch = e.touches[0]; | 294 var touch = e.touches[0]; |
294 this.lastTouchLocation_ = {x: touch.pageX, y: touch.pageY}; | 295 this.lastTouchLocation_ = {x: touch.pageX, y: touch.pageY}; |
295 return this.startDragging_(e.target, this.lastTouchLocation_); | 296 var target = assertInstanceof(e.target, HTMLElement); |
| 297 return this.startDragging_(target, this.lastTouchLocation_); |
296 }, | 298 }, |
297 | 299 |
298 /** | 300 /** |
299 * Collects the current data and sends it to Chrome. | 301 * Collects the current data and sends it to Chrome. |
300 * @private | 302 * @private |
301 */ | 303 */ |
302 applyResult_: function() { | 304 applyResult_: function() { |
303 // Offset is calculated from top or left edge. | 305 // Offset is calculated from top or left edge. |
304 var primary = this.primaryDisplay_; | 306 var primary = this.primaryDisplay_; |
305 var secondary = this.secondaryDisplay_; | 307 var secondary = this.secondaryDisplay_; |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 mirroring, displays, layout, offset) { | 911 mirroring, displays, layout, offset) { |
910 DisplayOptions.getInstance().onDisplayChanged_( | 912 DisplayOptions.getInstance().onDisplayChanged_( |
911 mirroring, displays, layout, offset); | 913 mirroring, displays, layout, offset); |
912 }; | 914 }; |
913 | 915 |
914 // Export | 916 // Export |
915 return { | 917 return { |
916 DisplayOptions: DisplayOptions | 918 DisplayOptions: DisplayOptions |
917 }; | 919 }; |
918 }); | 920 }); |
OLD | NEW |