OLD | NEW |
| (Empty) |
1 // Copyright 2011 (c) The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview Implement the mouse drag wrapper class, Dragger, that | |
7 * produces simple mouse-dragged events. These work like mouse-moved events, | |
8 * only they are sent while a mouse button is down (that is, when the mouse is | |
9 * being dragged). | |
10 */ | |
11 | |
12 goog.provide('uikit.events.Dragger'); | |
13 | |
14 goog.require('goog.fx.Dragger'); | |
15 | |
16 /** | |
17 * Constructor for the Dragger object. This is a subclass of goog.fx.Dragger | |
18 * that overrides defaultAction() to do nothing, so that the drag event is | |
19 * simply sent onto its target, instead of moving its target. Overriding the | |
20 * defaultAction() method to do nothing implements a simple mouse-drag event. | |
21 * @param {?Object} opt_element Generate mouse-drag events using this element. | |
22 * The default element is the document. | |
23 * @constructor | |
24 * @extends {goog.fx.Dragger} | |
25 */ | |
26 uikit.events.Dragger = function(opt_element) { | |
27 goog.fx.Dragger.call(this, opt_element || document); | |
28 }; | |
29 goog.inherits(uikit.events.Dragger, goog.fx.Dragger); | |
30 | |
31 /** | |
32 * Override defaultAction() to do nothing. Instead, the target listens for | |
33 * DRAG events and reacts to them by rolling the trackball. | |
34 * @param {number} x X-coordinate for target element. | |
35 * @param {number} y Y-coordinate for target element. | |
36 * @override | |
37 */ | |
38 uikit.events.Dragger.prototype.defaultAction = function(x, y) { | |
39 // Do nothing. This overrides the default implementation that changes the | |
40 // position style properties of the target. | |
41 }; | |
OLD | NEW |