source: cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/api/drag.js.html @ 5259

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/api/drag.js.html@5259
Revision 5259, 114.3 KB checked in by domlowe, 11 years ago (diff)

adding yui javascript

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4        <title>API: dd   drag.js  (YUI Library)</title>
5        <link rel="stylesheet" type="text/css" href="assets/api.css">
6    <script type="text/javascript" src="assets/api-js"></script>
7    <script type="text/javascript" src="assets/ac-js"></script>
8</head>
9
10<body id="yahoo-com">
11
12<div id="doc3" class="yui-t2">
13
14        <div id="hd">
15        <a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
16        <h3>dd&nbsp; <span class="subtitle">3.0.0pr1</span></h3>
17        <p>
18        <a href="./index.html">Yahoo! UI Library</a> 
19            &gt; <a href="./module_dd.html">dd</a>
20               
21                 &gt; drag.js (source view)
22            </p>
23
24
25        </div>
26
27        <div id="bd">
28                <div id="yui-main">
29                        <div class="yui-b">
30            <form name="yui-classopts-form">
31    <span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
32    <span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
33    <span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
34            </form>
35
36                    <div id="srcout">
37                        <style>
38                            #doc3 #classopts { display:none; }
39                        </style>
40<div class="highlight" ><pre>    <span class="c">/**</span>
41<span class="c">     * The Drag &amp; Drop Utility allows you to create a draggable interface efficiently, buffering you from browser-level abnormalities and enabling you to focus on the interesting logic surrounding your particular implementation. This component enables you to create a variety of standard draggable objects with just a few lines of code and then, using its extensive API, add your own specific implementation logic.</span>
42<span class="c">     * @module dd</span>
43<span class="c">     * @submodule dd-drag</span>
44<span class="c">     */</span>     
45    <span class="c">/**</span>
46<span class="c">     * This class provides the ability to drag a Node.</span>
47<span class="c">     * @class Drag</span>
48<span class="c">     * @extends Base</span>
49<span class="c">     * @constructor</span>
50<span class="c">     */</span>
51
52    <span class="k">var</span> <span class="nx">DDM</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">DD</span><span class="o">.</span><span class="nx">DDM</span><span class="o">,</span>
53        <span class="nx">NODE</span> <span class="o">=</span> <span class="s1">&#39;node&#39;</span><span class="o">,</span>
54        <span class="nx">DRAG_NODE</span> <span class="o">=</span> <span class="s1">&#39;dragNode&#39;</span><span class="o">,</span>
55        <span class="nx">OFFSET_HEIGHT</span> <span class="o">=</span> <span class="s1">&#39;offsetHeight&#39;</span><span class="o">,</span>
56        <span class="nx">OFFSET_WIDTH</span> <span class="o">=</span> <span class="s1">&#39;offsetWidth&#39;</span><span class="o">,</span>       
57        <span class="nx">MOUSE_UP</span> <span class="o">=</span> <span class="s1">&#39;mouseup&#39;</span><span class="o">,</span>
58        <span class="nx">MOUSE_DOWN</span> <span class="o">=</span> <span class="s1">&#39;mousedown&#39;</span><span class="o">,</span>
59        <span class="c">/**</span>
60<span class="c">        * @event drag:mouseDown</span>
61<span class="c">        * @description Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers.</span>
62<span class="c">        * @preventable _handleMouseDown</span>
63<span class="c">        * @param {Event} ev The mousedown event.</span>
64<span class="c">        * @bubbles DDM</span>
65<span class="c">        * @type Event.Custom</span>
66<span class="c">        */</span>
67        <span class="nx">EV_MOUSE_DOWN</span> <span class="o">=</span> <span class="s1">&#39;drag:mouseDown&#39;</span><span class="o">,</span>
68        <span class="c">/**</span>
69<span class="c">        * @event drag:afterMouseDown</span>
70<span class="c">        * @description Fires after the mousedown event has been cleared.</span>
71<span class="c">        * @param {Event} ev The mousedown event.</span>
72<span class="c">        * @bubbles DDM</span>
73<span class="c">        * @type Event.Custom</span>
74<span class="c">        */</span>
75        <span class="nx">EV_AFTER_MOUSE_DOWN</span> <span class="o">=</span> <span class="s1">&#39;drag:afterMouseDown&#39;</span><span class="o">,</span>
76        <span class="c">/**</span>
77<span class="c">        * @event drag:removeHandle</span>
78<span class="c">        * @description Fires after a handle is removed.</span>
79<span class="c">        * @bubbles DDM</span>
80<span class="c">        * @type Event.Custom</span>
81<span class="c">        */</span>
82        <span class="nx">EV_REMOVE_HANDLE</span> <span class="o">=</span> <span class="s1">&#39;drag:removeHandle&#39;</span><span class="o">,</span>
83        <span class="c">/**</span>
84<span class="c">        * @event drag:addHandle</span>
85<span class="c">        * @description Fires after a handle is added.</span>
86<span class="c">        * @bubbles DDM</span>
87<span class="c">        * @type Event.Custom</span>
88<span class="c">        */</span>
89        <span class="nx">EV_ADD_HANDLE</span> <span class="o">=</span> <span class="s1">&#39;drag:addHandle&#39;</span><span class="o">,</span>
90        <span class="c">/**</span>
91<span class="c">        * @event drag:removeInvalid</span>
92<span class="c">        * @description Fires after an invalid selector is removed.</span>
93<span class="c">        * @bubbles DDM</span>
94<span class="c">        * @type Event.Custom</span>
95<span class="c">        */</span>
96        <span class="nx">EV_REMOVE_INVALID</span> <span class="o">=</span> <span class="s1">&#39;drag:removeInvalid&#39;</span><span class="o">,</span>
97        <span class="c">/**</span>
98<span class="c">        * @event drag:addInvalid</span>
99<span class="c">        * @description Fires after an invalid selector is added.</span>
100<span class="c">        * @bubbles DDM</span>
101<span class="c">        * @type Event.Custom</span>
102<span class="c">        */</span>
103        <span class="nx">EV_ADD_INVALID</span> <span class="o">=</span> <span class="s1">&#39;drag:addInvalid&#39;</span><span class="o">,</span>
104        <span class="c">/**</span>
105<span class="c">        * @event drag:start</span>
106<span class="c">        * @description Fires at the start of a drag operation.</span>
107<span class="c">        * @bubbles DDM</span>
108<span class="c">        * @type Event.Custom</span>
109<span class="c">        */</span>
110        <span class="nx">EV_START</span> <span class="o">=</span> <span class="s1">&#39;drag:start&#39;</span><span class="o">,</span>
111        <span class="c">/**</span>
112<span class="c">        * @event drag:end</span>
113<span class="c">        * @description Fires at the end of a drag operation.</span>
114<span class="c">        * @bubbles DDM</span>
115<span class="c">        * @type Event.Custom</span>
116<span class="c">        */</span>
117        <span class="nx">EV_END</span> <span class="o">=</span> <span class="s1">&#39;drag:end&#39;</span><span class="o">,</span>
118        <span class="c">/**</span>
119<span class="c">        * @event drag:drag</span>
120<span class="c">        * @description Fires every mousemove during a drag operation.</span>
121<span class="c">        * @bubbles DDM</span>
122<span class="c">        * @type Event.Custom</span>
123<span class="c">        */</span>
124        <span class="nx">EV_DRAG</span> <span class="o">=</span> <span class="s1">&#39;drag:drag&#39;</span><span class="o">;</span>
125
126
127        <span class="c">/**</span>
128<span class="c">        * @event drag:over</span>
129<span class="c">        * @description Fires when this node is over a Drop Target. (Fired from dd-drop)</span>
130<span class="c">        * @bubbles DDM</span>
131<span class="c">        * @type Event.Custom</span>
132<span class="c">        */</span>
133        <span class="c">/**</span>
134<span class="c">        * @event drag:enter</span>
135<span class="c">        * @description Fires when this node enters a Drop Target. (Fired from dd-drop)</span>
136<span class="c">        * @bubbles DDM</span>
137<span class="c">        * @type Event.Custom</span>
138<span class="c">        */</span>
139        <span class="c">/**</span>
140<span class="c">        * @event drag:exit</span>
141<span class="c">        * @description Fires when this node exits a Drop Target. (Fired from dd-drop)</span>
142<span class="c">        * @bubbles DDM</span>
143<span class="c">        * @type Event.Custom</span>
144<span class="c">        */</span>
145        <span class="c">/**</span>
146<span class="c">        * @event drag:drophit</span>
147<span class="c">        * @description Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop)</span>
148<span class="c">        * @bubbles DDM</span>
149<span class="c">        * @type Event.Custom</span>
150<span class="c">        */</span>
151        <span class="c">/**</span>
152<span class="c">        * @event drag:dropmiss</span>
153<span class="c">        * @description Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop)</span>
154<span class="c">        * @bubbles DDM</span>
155<span class="c">        * @type Event.Custom</span>
156<span class="c">        */</span>
157   
158    <span class="k">var</span> <span class="nx">Drag</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
159        <span class="nx">Drag</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">constructor</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
160
161        <span class="nx">DDM</span><span class="o">.</span><span class="nx">_regDrag</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
162    <span class="o">};</span>
163    <span class="nx">Drag</span><span class="o">.</span><span class="nx">NAME</span> <span class="o">=</span> <span class="s1">&#39;drag&#39;</span><span class="o">;</span>
164
165    <span class="nx">Drag</span><span class="o">.</span><span class="nx">ATTRS</span> <span class="o">=</span> <span class="o">{</span>
166        <span class="c">/**</span>
167<span class="c">        * @attribute node</span>
168<span class="c">        * @description Y.Node instanace to use as the element to initiate a drag operation</span>
169<span class="c">        * @type Node</span>
170<span class="c">        */</span>
171        <span class="nx">node</span><span class="o">:</span> <span class="o">{</span>
172            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
173                <span class="k">var</span> <span class="nx">n</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Node</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
174                <span class="k">if</span> <span class="o">(!</span><span class="nx">n</span><span class="o">)</span> <span class="o">{</span>
175                    <span class="nx">Y</span><span class="o">.</span><span class="nx">fail</span><span class="o">(</span><span class="s1">&#39;DD.Drag: Invalid Node Given: &#39;</span> <span class="o">+</span> <span class="nx">node</span><span class="o">);</span>
176                <span class="o">}</span>
177                <span class="k">return</span> <span class="nx">n</span><span class="o">;</span>
178            <span class="o">}</span>
179        <span class="o">},</span>
180        <span class="c">/**</span>
181<span class="c">        * @attribute dragNode</span>
182<span class="c">        * @description Y.Node instanace to use as the draggable element, defaults to node</span>
183<span class="c">        * @type Node</span>
184<span class="c">        */</span>
185        <span class="nx">dragNode</span><span class="o">:</span> <span class="o">{</span>
186            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
187                <span class="k">var</span> <span class="nx">n</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Node</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
188                <span class="k">if</span> <span class="o">(!</span><span class="nx">n</span><span class="o">)</span> <span class="o">{</span>
189                    <span class="nx">Y</span><span class="o">.</span><span class="nx">fail</span><span class="o">(</span><span class="s1">&#39;DD.Drag: Invalid dragNode Given: &#39;</span> <span class="o">+</span> <span class="nx">node</span><span class="o">);</span>
190                <span class="o">}</span>
191                <span class="k">return</span> <span class="nx">n</span><span class="o">;</span>
192            <span class="o">}</span>
193        <span class="o">},</span>
194        <span class="c">/**</span>
195<span class="c">        * @attribute offsetNode</span>
196<span class="c">        * @description Offset the drag element by the difference in cursor position: default true</span>
197<span class="c">        * @type Boolean</span>
198<span class="c">        */</span>
199        <span class="nx">offsetNode</span><span class="o">:</span> <span class="o">{</span>
200            <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
201        <span class="o">},</span>
202        <span class="c">/**</span>
203<span class="c">        * @attribute clickPixelThresh</span>
204<span class="c">        * @description The number of pixels to move to start a drag operation, default is 3.</span>
205<span class="c">        * @type Number</span>
206<span class="c">        */</span>
207        <span class="nx">clickPixelThresh</span><span class="o">:</span> <span class="o">{</span>
208            <span class="nx">value</span><span class="o">:</span> <span class="nx">DDM</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;clickPixelThresh&#39;</span><span class="o">)</span>
209        <span class="o">},</span>
210        <span class="c">/**</span>
211<span class="c">        * @attribute clickTimeThresh</span>
212<span class="c">        * @description The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.</span>
213<span class="c">        * @type Number</span>
214<span class="c">        */</span>
215        <span class="nx">clickTimeThresh</span><span class="o">:</span> <span class="o">{</span>
216            <span class="nx">value</span><span class="o">:</span> <span class="nx">DDM</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;clickTimeThresh&#39;</span><span class="o">)</span>
217        <span class="o">},</span>
218        <span class="c">/**</span>
219<span class="c">        * @attribute lock</span>
220<span class="c">        * @description Set to lock this drag element so that it can&#39;t be dragged: default false.</span>
221<span class="c">        * @type Boolean</span>
222<span class="c">        */</span>
223        <span class="nx">lock</span><span class="o">:</span> <span class="o">{</span>
224            <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
225            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">lock</span><span class="o">)</span> <span class="o">{</span>
226                <span class="k">if</span> <span class="o">(</span><span class="nx">lock</span><span class="o">)</span> <span class="o">{</span>
227                    <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">CSS_PREFIX</span> <span class="o">+</span> <span class="s1">&#39;-locked&#39;</span><span class="o">);</span>
228                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
229                    <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">CSS_PREFIX</span> <span class="o">+</span> <span class="s1">&#39;-locked&#39;</span><span class="o">);</span>
230                <span class="o">}</span>
231            <span class="o">}</span>
232        <span class="o">},</span>
233        <span class="c">/**</span>
234<span class="c">        * @attribute data</span>
235<span class="c">        * @description A payload holder to store arbitrary data about this drag object, can be used to store any value.</span>
236<span class="c">        * @type Mixed</span>
237<span class="c">        */</span>
238        <span class="nx">data</span><span class="o">:</span> <span class="o">{</span>
239            <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span>
240        <span class="o">},</span>
241        <span class="c">/**</span>
242<span class="c">        * @attribute move</span>
243<span class="c">        * @description If this is false, the drag element will not move with the cursor: default true. Can be used to &quot;resize&quot; the element.</span>
244<span class="c">        * @type Boolean</span>
245<span class="c">        */</span>
246        <span class="nx">move</span><span class="o">:</span> <span class="o">{</span>
247            <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
248        <span class="o">},</span>
249        <span class="c">/**</span>
250<span class="c">        * @attribute useShim</span>
251<span class="c">        * @description Use the protective shim on all drag operations: default true. Only works with dd-ddm, not dd-ddm-base.</span>
252<span class="c">        * @type Boolean</span>
253<span class="c">        */</span>
254        <span class="nx">useShim</span><span class="o">:</span> <span class="o">{</span>
255            <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
256        <span class="o">},</span>
257        <span class="c">/**</span>
258<span class="c">        * @attribute activeHandle</span>
259<span class="c">        * @description This config option is set by Drag to inform you of which handle fired the drag event (in the case that there are several handles): default false.</span>
260<span class="c">        * @type Node</span>
261<span class="c">        */</span>
262        <span class="nx">activeHandle</span><span class="o">:</span> <span class="o">{</span>
263            <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span>
264        <span class="o">},</span>
265        <span class="c">/**</span>
266<span class="c">        * @attribute primaryButtonOnly</span>
267<span class="c">        * @description By default a drag operation will only begin if the mousedown occurred with the primary mouse button. Setting this to false will allow for all mousedown events to trigger a drag.</span>
268<span class="c">        * @type Boolean</span>
269<span class="c">        */</span>
270        <span class="nx">primaryButtonOnly</span><span class="o">:</span> <span class="o">{</span>
271            <span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
272        <span class="o">},</span>
273        <span class="c">/**</span>
274<span class="c">        * @attribute dragging</span>
275<span class="c">        * @description This attribute is not meant to be used by the implementor, it is meant to be used as an Event tracker so you can listen for it to change.</span>
276<span class="c">        * @type Boolean</span>
277<span class="c">        */</span>
278        <span class="nx">dragging</span><span class="o">:</span> <span class="o">{</span>
279            <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span>
280        <span class="o">},</span>
281        <span class="c">/**</span>
282<span class="c">        * @attribute target</span>
283<span class="c">        * @description This attribute only works if the dd-drop module has been loaded. It will make this node a drop target as well as draggable.</span>
284<span class="c">        * @type Boolean</span>
285<span class="c">        */</span>
286        <span class="nx">target</span><span class="o">:</span> <span class="o">{</span>
287            <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
288            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">config</span><span class="o">)</span> <span class="o">{</span>
289                <span class="k">this</span><span class="o">.</span><span class="nx">_handleTarget</span><span class="o">(</span><span class="nx">config</span><span class="o">);</span>
290            <span class="o">}</span>
291        <span class="o">},</span>
292        <span class="c">/**</span>
293<span class="c">        * @attribute dragMode</span>
294<span class="c">        * @description This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of this Drag instance.</span>
295<span class="c">        * @type String</span>
296<span class="c">        */</span>
297        <span class="nx">dragMode</span><span class="o">:</span> <span class="o">{</span>
298            <span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
299            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">mode</span><span class="o">)</span> <span class="o">{</span>
300                <span class="k">return</span> <span class="nx">DDM</span><span class="o">.</span><span class="nx">_setDragMode</span><span class="o">(</span><span class="nx">mode</span><span class="o">);</span>
301            <span class="o">}</span>
302        <span class="o">},</span>
303        <span class="c">/**</span>
304<span class="c">        * @attribute groups</span>
305<span class="c">        * @description Array of groups to add this drag into.</span>
306<span class="c">        * @type Array</span>
307<span class="c">        */</span>
308        <span class="nx">groups</span><span class="o">:</span> <span class="o">{</span>
309            <span class="nx">value</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;default&#39;</span><span class="o">],</span>
310            <span class="nx">get</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
311                <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_groups</span><span class="o">)</span> <span class="o">{</span>
312                    <span class="k">this</span><span class="o">.</span><span class="nx">_groups</span> <span class="o">=</span> <span class="o">{};</span>
313                <span class="o">}</span>
314                <span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="o">[];</span>
315                <span class="nx">Y</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_groups</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">k</span><span class="o">)</span> <span class="o">{</span>
316                    <span class="nx">ret</span><span class="o">[</span><span class="nx">ret</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">k</span><span class="o">;</span>
317                <span class="o">});</span>
318                <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
319            <span class="o">},</span>
320            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">g</span><span class="o">)</span> <span class="o">{</span>
321                <span class="k">this</span><span class="o">.</span><span class="nx">_groups</span> <span class="o">=</span> <span class="o">{};</span>
322                <span class="nx">Y</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="nx">g</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">k</span><span class="o">)</span> <span class="o">{</span>
323                    <span class="k">this</span><span class="o">.</span><span class="nx">_groups</span><span class="o">[</span><span class="nx">v</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
324                <span class="o">},</span> <span class="k">this</span><span class="o">);</span>
325            <span class="o">}</span>
326        <span class="o">},</span>
327        <span class="c">/**</span>
328<span class="c">        * @attribute handles</span>
329<span class="c">        * @description Array of valid handles to add. Adding something here will set all handles, even if previously added with addHandle</span>
330<span class="c">        * @type Array</span>
331<span class="c">        */</span>
332        <span class="nx">handles</span><span class="o">:</span> <span class="o">{</span>
333            <span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
334            <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">g</span><span class="o">)</span> <span class="o">{</span>
335                <span class="k">if</span> <span class="o">(</span><span class="nx">g</span><span class="o">)</span> <span class="o">{</span>
336                    <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span> <span class="o">=</span> <span class="o">{};</span>
337                    <span class="nx">Y</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="nx">g</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">k</span><span class="o">)</span> <span class="o">{</span>
338                        <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">[</span><span class="nx">v</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
339                    <span class="o">},</span> <span class="k">this</span><span class="o">);</span>
340                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
341                    <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
342                <span class="o">}</span>
343                <span class="k">return</span> <span class="nx">g</span><span class="o">;</span>
344            <span class="o">}</span>
345        <span class="o">}</span>
346    <span class="o">};</span>
347
348    <span class="nx">Y</span><span class="o">.</span><span class="nx">extend</span><span class="o">(</span><span class="nx">Drag</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Base</span><span class="o">,</span> <span class="o">{</span>
349        <span class="c">/**</span>
350<span class="c">        * @method addToGroup</span>
351<span class="c">        * @description Add this Drag instance to a group, this should be used for on-the-fly group additions.</span>
352<span class="c">        * @param {String} g The group to add this Drag Instance to.</span>
353<span class="c">        * @return {Self}</span>
354<span class="c">        * @chainable</span>
355<span class="c">        */</span>
356        <span class="nx">addToGroup</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">g</span><span class="o">)</span> <span class="o">{</span>
357            <span class="k">this</span><span class="o">.</span><span class="nx">_groups</span><span class="o">[</span><span class="nx">g</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
358            <span class="nx">DDM</span><span class="o">.</span><span class="nx">_activateTargets</span><span class="o">();</span>
359            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
360        <span class="o">},</span>
361        <span class="c">/**</span>
362<span class="c">        * @method removeFromGroup</span>
363<span class="c">        * @description Remove this Drag instance from a group, this should be used for on-the-fly group removals.</span>
364<span class="c">        * @param {String} g The group to remove this Drag Instance from.</span>
365<span class="c">        * @return {Self}</span>
366<span class="c">        * @chainable</span>
367<span class="c">        */</span>
368        <span class="nx">removeFromGroup</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">g</span><span class="o">)</span> <span class="o">{</span>
369            <span class="nx">delete</span> <span class="k">this</span><span class="o">.</span><span class="nx">_groups</span><span class="o">[</span><span class="nx">g</span><span class="o">];</span>
370            <span class="nx">DDM</span><span class="o">.</span><span class="nx">_activateTargets</span><span class="o">();</span>
371            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
372        <span class="o">},</span>
373        <span class="c">/**</span>
374<span class="c">        * @property target</span>
375<span class="c">        * @description This will be a reference to the Drop instance associated with this drag if the target: true config attribute is set..</span>
376<span class="c">        * @type {Object}</span>
377<span class="c">        */</span>
378        <span class="nx">target</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
379        <span class="c">/**</span>
380<span class="c">        * @private</span>
381<span class="c">        * @method _handleTarget</span>
382<span class="c">        * @description Attribute handler for the target config attribute.</span>
383<span class="c">        * @param {Boolean/Object}</span>
384<span class="c">        * @return {Boolean/Object}</span>
385<span class="c">        */</span>
386        <span class="nx">_handleTarget</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">config</span><span class="o">)</span> <span class="o">{</span>
387            <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">DD</span><span class="o">.</span><span class="nx">Drop</span><span class="o">)</span> <span class="o">{</span>
388                <span class="k">if</span> <span class="o">(</span><span class="nx">config</span> <span class="o">===</span> <span class="kc">false</span><span class="o">)</span> <span class="o">{</span>
389                    <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">target</span><span class="o">)</span> <span class="o">{</span>
390                        <span class="nx">DDM</span><span class="o">.</span><span class="nx">_unregTarget</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">target</span><span class="o">);</span>
391                        <span class="k">this</span><span class="o">.</span><span class="nx">target</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
392                    <span class="o">}</span>
393                    <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
394                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
395                    <span class="k">if</span> <span class="o">(!</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">config</span><span class="o">))</span> <span class="o">{</span>
396                        <span class="nx">config</span> <span class="o">=</span> <span class="o">{};</span>
397                    <span class="o">}</span>
398                    <span class="nx">config</span><span class="o">.</span><span class="nx">node</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">);</span>
399                    <span class="k">this</span><span class="o">.</span><span class="nx">target</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">DD</span><span class="o">.</span><span class="nx">Drop</span><span class="o">(</span><span class="nx">config</span><span class="o">);</span>
400                <span class="o">}</span>
401            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
402                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
403            <span class="o">}</span>
404        <span class="o">},</span>
405        <span class="c">/**</span>
406<span class="c">        * @private</span>
407<span class="c">        * @property _groups</span>
408<span class="c">        * @description Storage Array for the groups this drag belongs to.</span>
409<span class="c">        * @type {Array}</span>
410<span class="c">        */</span>
411        <span class="nx">_groups</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
412        <span class="c">/**</span>
413<span class="c">        * @private</span>
414<span class="c">        * @method _createEvents</span>
415<span class="c">        * @description This method creates all the events for this Event Target and publishes them so we get Event Bubbling.</span>
416<span class="c">        */</span>
417        <span class="nx">_createEvents</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
418           
419            <span class="k">this</span><span class="o">.</span><span class="nx">publish</span><span class="o">(</span><span class="nx">EV_MOUSE_DOWN</span><span class="o">,</span> <span class="o">{</span>
420                <span class="nx">defaultFn</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseDown</span><span class="o">,</span>
421                <span class="nx">queuable</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
422                <span class="nx">emitFacade</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
423                <span class="nx">bubbles</span><span class="o">:</span> <span class="kc">true</span>
424            <span class="o">});</span>
425           
426            <span class="k">var</span> <span class="nx">ev</span> <span class="o">=</span> <span class="o">[</span>
427                <span class="nx">EV_AFTER_MOUSE_DOWN</span><span class="o">,</span>
428                <span class="nx">EV_REMOVE_HANDLE</span><span class="o">,</span>
429                <span class="nx">EV_ADD_HANDLE</span><span class="o">,</span>
430                <span class="nx">EV_REMOVE_INVALID</span><span class="o">,</span>
431                <span class="nx">EV_ADD_INVALID</span><span class="o">,</span>
432                <span class="nx">EV_START</span><span class="o">,</span>
433                <span class="nx">EV_END</span><span class="o">,</span>
434                <span class="nx">EV_DRAG</span><span class="o">,</span>
435                <span class="s1">&#39;drag:drophit&#39;</span><span class="o">,</span>
436                <span class="s1">&#39;drag:dropmiss&#39;</span><span class="o">,</span>
437                <span class="s1">&#39;drag:over&#39;</span><span class="o">,</span>
438                <span class="s1">&#39;drag:enter&#39;</span><span class="o">,</span>
439                <span class="s1">&#39;drag:exit&#39;</span>
440            <span class="o">];</span>
441           
442            <span class="nx">Y</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="nx">ev</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="nx">k</span><span class="o">)</span> <span class="o">{</span>
443                <span class="k">this</span><span class="o">.</span><span class="nx">publish</span><span class="o">(</span><span class="nx">v</span><span class="o">,</span> <span class="o">{</span>
444                    <span class="nx">type</span><span class="o">:</span> <span class="nx">v</span><span class="o">,</span>
445                    <span class="nx">emitFacade</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
446                    <span class="nx">bubbles</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
447                    <span class="nx">preventable</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
448                    <span class="nx">queuable</span><span class="o">:</span> <span class="kc">true</span>
449                <span class="o">});</span>
450            <span class="o">},</span> <span class="k">this</span><span class="o">);</span>
451            <span class="k">this</span><span class="o">.</span><span class="nx">addTarget</span><span class="o">(</span><span class="nx">DDM</span><span class="o">);</span>
452           
453           
454        <span class="o">},</span>
455        <span class="c">/**</span>
456<span class="c">        * @private</span>
457<span class="c">        * @property _ev_md</span>
458<span class="c">        * @description A private reference to the mousedown DOM event</span>
459<span class="c">        * @type {Event}</span>
460<span class="c">        */</span>
461        <span class="nx">_ev_md</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
462        <span class="c">/**</span>
463<span class="c">        * @private</span>
464<span class="c">        * @property _startTime</span>
465<span class="c">        * @description The getTime of the mousedown event. Not used, just here in case someone wants/needs to use it.</span>
466<span class="c">        * @type Date</span>
467<span class="c">        */</span>
468        <span class="nx">_startTime</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
469        <span class="c">/**</span>
470<span class="c">        * @private</span>
471<span class="c">        * @property _endTime</span>
472<span class="c">        * @description The getTime of the mouseup event. Not used, just here in case someone wants/needs to use it.</span>
473<span class="c">        * @type Date</span>
474<span class="c">        */</span>
475        <span class="nx">_endTime</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
476        <span class="c">/**</span>
477<span class="c">        * @private</span>
478<span class="c">        * @property _handles</span>
479<span class="c">        * @description A private hash of the valid drag handles</span>
480<span class="c">        * @type {Object}</span>
481<span class="c">        */</span>
482        <span class="nx">_handles</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
483        <span class="c">/**</span>
484<span class="c">        * @private</span>
485<span class="c">        * @property _invalids</span>
486<span class="c">        * @description A private hash of the invalid selector strings</span>
487<span class="c">        * @type {Object}</span>
488<span class="c">        */</span>
489        <span class="nx">_invalids</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
490        <span class="c">/**</span>
491<span class="c">        * @private</span>
492<span class="c">        * @property _invalidsDefault</span>
493<span class="c">        * @description A private hash of the default invalid selector strings: {&#39;textarea&#39;: true, &#39;input&#39;: true, &#39;a&#39;: true, &#39;button&#39;: true}</span>
494<span class="c">        * @type {Object}</span>
495<span class="c">        */</span>
496        <span class="nx">_invalidsDefault</span><span class="o">:</span> <span class="o">{</span><span class="s1">&#39;textarea&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span> <span class="s1">&#39;input&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span> <span class="s1">&#39;a&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span> <span class="s1">&#39;button&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">},</span>
497        <span class="c">/**</span>
498<span class="c">        * @private</span>
499<span class="c">        * @property _dragThreshMet</span>
500<span class="c">        * @description Private flag to see if the drag threshhold was met</span>
501<span class="c">        * @type {Boolean}</span>
502<span class="c">        */</span>
503        <span class="nx">_dragThreshMet</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
504        <span class="c">/**</span>
505<span class="c">        * @private</span>
506<span class="c">        * @property _fromTimeout</span>
507<span class="c">        * @description Flag to determine if the drag operation came from a timeout</span>
508<span class="c">        * @type {Boolean}</span>
509<span class="c">        */</span>
510        <span class="nx">_fromTimeout</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
511        <span class="c">/**</span>
512<span class="c">        * @private</span>
513<span class="c">        * @property _clickTimeout</span>
514<span class="c">        * @description Holder for the setTimeout call</span>
515<span class="c">        * @type {Boolean}</span>
516<span class="c">        */</span>
517        <span class="nx">_clickTimeout</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
518        <span class="c">/**</span>
519<span class="c">        * @property deltaXY</span>
520<span class="c">        * @description The offset of the mouse position to the element&#39;s position</span>
521<span class="c">        * @type {Array}</span>
522<span class="c">        */</span>
523        <span class="nx">deltaXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
524        <span class="c">/**</span>
525<span class="c">        * @property startXY</span>
526<span class="c">        * @description The initial mouse position</span>
527<span class="c">        * @type {Array}</span>
528<span class="c">        */</span>
529        <span class="nx">startXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
530        <span class="c">/**</span>
531<span class="c">        * @property nodeXY</span>
532<span class="c">        * @description The initial element position</span>
533<span class="c">        * @type {Array}</span>
534<span class="c">        */</span>
535        <span class="nx">nodeXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
536        <span class="c">/**</span>
537<span class="c">        * @property lastXY</span>
538<span class="c">        * @description The position of the element as it&#39;s moving (for offset calculations)</span>
539<span class="c">        * @type {Array}</span>
540<span class="c">        */</span>
541        <span class="nx">lastXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
542        <span class="c">/**</span>
543<span class="c">        * @property mouseXY</span>
544<span class="c">        * @description The XY coords of the mousemove</span>
545<span class="c">        * @type {Array}</span>
546<span class="c">        */</span>
547        <span class="nx">mouseXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
548        <span class="c">/**</span>
549<span class="c">        * @property region</span>
550<span class="c">        * @description A region object associated with this drag, used for checking regions while dragging.</span>
551<span class="c">        * @type Object</span>
552<span class="c">        */</span>
553        <span class="nx">region</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>       
554        <span class="c">/**</span>
555<span class="c">        * @private</span>
556<span class="c">        * @method _handleMouseUp</span>
557<span class="c">        * @description Handler for the mouseup DOM event</span>
558<span class="c">        * @param {Event}</span>
559<span class="c">        */</span>
560        <span class="nx">_handleMouseUp</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">ev</span><span class="o">)</span> <span class="o">{</span>
561            <span class="k">this</span><span class="o">.</span><span class="nx">_fixIEMouseUp</span><span class="o">();</span>
562            <span class="k">if</span> <span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">activeDrag</span><span class="o">)</span> <span class="o">{</span>
563                <span class="nx">DDM</span><span class="o">.</span><span class="nx">_end</span><span class="o">();</span>
564            <span class="o">}</span>
565        <span class="o">},</span>
566        <span class="c">/** </span>
567<span class="c">        * @private</span>
568<span class="c">        * @method _ieSelectFix</span>
569<span class="c">        * @description The function we use as the onselectstart handler when we start a drag in Internet Explorer</span>
570<span class="c">        */</span>
571        <span class="nx">_ieSelectFix</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
572            <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
573        <span class="o">},</span>
574        <span class="c">/** </span>
575<span class="c">        * @private</span>
576<span class="c">        * @property _ieSelectBack</span>
577<span class="c">        * @description We will hold a copy of the current &quot;onselectstart&quot; method on this property, and reset it after we are done using it.</span>
578<span class="c">        */</span>
579        <span class="nx">_ieSelectBack</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
580        <span class="c">/**</span>
581<span class="c">        * @private</span>
582<span class="c">        * @method _fixIEMouseDown</span>
583<span class="c">        * @description This method copies the onselectstart listner on the document to the _ieSelectFix property</span>
584<span class="c">        */</span>
585        <span class="nx">_fixIEMouseDown</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
586            <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">{</span>
587                <span class="k">this</span><span class="o">.</span><span class="nx">_ieSelectBack</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">config</span><span class="o">.</span><span class="nx">doc</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">onselectstart</span><span class="o">;</span>
588                <span class="nx">Y</span><span class="o">.</span><span class="nx">config</span><span class="o">.</span><span class="nx">doc</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">onselectstart</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_ieSelectFix</span><span class="o">;</span>
589            <span class="o">}</span>           
590        <span class="o">},</span>
591        <span class="c">/**</span>
592<span class="c">        * @private</span>
593<span class="c">        * @method _fixIEMouseUp</span>
594<span class="c">        * @description This method copies the _ieSelectFix property back to the onselectstart listner on the document.</span>
595<span class="c">        */</span>
596        <span class="nx">_fixIEMouseUp</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
597            <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">{</span>
598                <span class="nx">Y</span><span class="o">.</span><span class="nx">config</span><span class="o">.</span><span class="nx">doc</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">onselectstart</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_ieSelectBack</span><span class="o">;</span>
599            <span class="o">}</span>           
600        <span class="o">},</span>
601        <span class="c">/**</span>
602<span class="c">        * @private</span>
603<span class="c">        * @method _handleMouseDownEvent</span>
604<span class="c">        * @description Handler for the mousedown DOM event</span>
605<span class="c">        * @param {Event}</span>
606<span class="c">        */</span>
607        <span class="nx">_handleMouseDownEvent</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">ev</span><span class="o">)</span> <span class="o">{</span>
608            <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_MOUSE_DOWN</span><span class="o">,</span> <span class="o">{</span> <span class="nx">ev</span><span class="o">:</span> <span class="nx">ev</span> <span class="o">});</span>
609        <span class="o">},</span>
610        <span class="c">/**</span>
611<span class="c">        * @private</span>
612<span class="c">        * @method _handleMouseDown</span>
613<span class="c">        * @description Handler for the mousedown DOM event</span>
614<span class="c">        * @param {Event}</span>
615<span class="c">        */</span>
616        <span class="nx">_handleMouseDown</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">e</span><span class="o">)</span> <span class="o">{</span>
617            <span class="k">var</span> <span class="nx">ev</span> <span class="o">=</span> <span class="nx">e</span><span class="o">.</span><span class="nx">ev</span><span class="o">;</span>
618            <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;_handleMouseDown&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
619            <span class="k">this</span><span class="o">.</span><span class="nx">_dragThreshMet</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
620            <span class="k">this</span><span class="o">.</span><span class="nx">_ev_md</span> <span class="o">=</span> <span class="nx">ev</span><span class="o">;</span>
621           
622            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;primaryButtonOnly&#39;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">button</span> <span class="o">&gt;</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>
623                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Mousedown was not produced by the primary button&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
624                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
625            <span class="o">}</span>
626            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">validClick</span><span class="o">(</span><span class="nx">ev</span><span class="o">))</span> <span class="o">{</span>
627                <span class="k">this</span><span class="o">.</span><span class="nx">_fixIEMouseDown</span><span class="o">();</span>
628                <span class="nx">ev</span><span class="o">.</span><span class="nx">halt</span><span class="o">();</span>
629                <span class="k">this</span><span class="o">.</span><span class="nx">_setStartPosition</span><span class="o">([</span><span class="nx">ev</span><span class="o">.</span><span class="nx">pageX</span><span class="o">,</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">pageY</span><span class="o">]);</span>
630
631                <span class="nx">DDM</span><span class="o">.</span><span class="nx">activeDrag</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
632
633                <span class="k">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
634                <span class="k">this</span><span class="o">.</span><span class="nx">_clickTimeout</span> <span class="o">=</span> <span class="nx">setTimeout</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
635                    <span class="nx">self</span><span class="o">.</span><span class="nx">_timeoutCheck</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="nx">self</span><span class="o">);</span>
636                <span class="o">},</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;clickTimeThresh&#39;</span><span class="o">));</span>
637            <span class="o">}</span>
638            <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_AFTER_MOUSE_DOWN</span><span class="o">,</span> <span class="o">{</span> <span class="nx">ev</span><span class="o">:</span> <span class="nx">ev</span> <span class="o">});</span>
639        <span class="o">},</span>
640        <span class="c">/**</span>
641<span class="c">        * @method validClick</span>
642<span class="c">        * @description Method first checks to see if we have handles, if so it validates the click against the handle. Then if it finds a valid handle, it checks it against the invalid handles list. Returns true if a good handle was used, false otherwise.</span>
643<span class="c">        * @param {Event}</span>
644<span class="c">        * @return {Boolean}</span>
645<span class="c">        */</span>
646        <span class="nx">validClick</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">ev</span><span class="o">)</span> <span class="o">{</span>
647            <span class="k">var</span> <span class="nx">r</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
648            <span class="nx">tar</span> <span class="o">=</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">target</span><span class="o">,</span>
649            <span class="nx">hTest</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
650            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">)</span> <span class="o">{</span>
651                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;validClick: We have handles&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
652                <span class="nx">Y</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="nx">n</span><span class="o">)</span> <span class="o">{</span>
653                    <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">n</span><span class="o">))</span> <span class="o">{</span>
654                        <span class="c">//Am I this or am I inside this</span>
655<span class="c"></span>                        <span class="k">if</span> <span class="o">(</span><span class="nx">tar</span><span class="o">.</span><span class="nx">test</span><span class="o">(</span><span class="nx">n</span> <span class="o">+</span> <span class="s1">&#39;, &#39;</span> <span class="o">+</span> <span class="nx">n</span> <span class="o">+</span> <span class="s1">&#39; *&#39;</span><span class="o">))</span> <span class="o">{</span>
656                            <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Valid Selector found: &#39;</span> <span class="o">+</span> <span class="nx">n</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
657                            <span class="nx">hTest</span> <span class="o">=</span> <span class="nx">n</span><span class="o">;</span>
658                            <span class="nx">r</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
659                        <span class="o">}</span>
660                    <span class="o">}</span>
661                <span class="o">});</span>
662            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
663                <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">contains</span><span class="o">(</span><span class="nx">tar</span><span class="o">)</span> <span class="o">||</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">compareTo</span><span class="o">(</span><span class="nx">tar</span><span class="o">))</span> <span class="o">{</span>
664                    <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;validClick: We have a valid click&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
665                    <span class="nx">r</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
666                <span class="o">}</span>
667            <span class="o">}</span>
668            <span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
669                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;validClick: Check invalid selectors&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
670                <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_invalids</span><span class="o">)</span> <span class="o">{</span>
671                    <span class="nx">Y</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_invalids</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="nx">n</span><span class="o">)</span> <span class="o">{</span>
672                        <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">n</span><span class="o">))</span> <span class="o">{</span>
673                            <span class="c">//Am I this or am I inside this</span>
674<span class="c"></span>                            <span class="k">if</span> <span class="o">(</span><span class="nx">tar</span><span class="o">.</span><span class="nx">test</span><span class="o">(</span><span class="nx">n</span> <span class="o">+</span> <span class="s1">&#39;, &#39;</span> <span class="o">+</span> <span class="nx">n</span> <span class="o">+</span> <span class="s1">&#39; *&#39;</span><span class="o">))</span> <span class="o">{</span>
675                                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Invalid Selector found: (&#39;</span> <span class="o">+</span> <span class="o">(</span><span class="nx">n</span> <span class="o">+</span> <span class="s1">&#39;, &#39;</span> <span class="o">+</span> <span class="nx">n</span> <span class="o">+</span> <span class="s1">&#39; *&#39;</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;)&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
676                                <span class="nx">r</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
677                            <span class="o">}</span>
678                        <span class="o">}</span>
679                    <span class="o">});</span>
680                <span class="o">}</span>
681            <span class="o">}</span>
682            <span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
683                <span class="k">if</span> <span class="o">(</span><span class="nx">hTest</span><span class="o">)</span> <span class="o">{</span>
684                    <span class="k">var</span> <span class="nx">els</span> <span class="o">=</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">currentTarget</span><span class="o">.</span><span class="nx">queryAll</span><span class="o">(</span><span class="nx">hTest</span><span class="o">);</span>
685                    <span class="nx">els</span><span class="o">.</span><span class="nx">each</span><span class="o">(</span><span class="k">function</span><span class="o">(</span><span class="nx">n</span><span class="o">,</span> <span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
686                        <span class="k">if</span> <span class="o">(</span><span class="nx">n</span><span class="o">.</span><span class="nx">contains</span><span class="o">(</span><span class="nx">tar</span><span class="o">)</span> <span class="o">||</span> <span class="nx">n</span><span class="o">.</span><span class="nx">compareTo</span><span class="o">(</span><span class="nx">tar</span><span class="o">))</span> <span class="o">{</span>
687                            <span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s1">&#39;activeHandle&#39;</span><span class="o">,</span> <span class="nx">els</span><span class="o">.</span><span class="nx">item</span><span class="o">(</span><span class="nx">i</span><span class="o">));</span>
688                        <span class="o">}</span>
689                    <span class="o">},</span> <span class="k">this</span><span class="o">);</span>
690                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
691                    <span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s1">&#39;activeHandle&#39;</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">));</span>
692                <span class="o">}</span>
693            <span class="o">}</span>
694            <span class="k">return</span> <span class="nx">r</span><span class="o">;</span>
695        <span class="o">},</span>
696        <span class="c">/**</span>
697<span class="c">        * @private</span>
698<span class="c">        * @method _setStartPosition</span>
699<span class="c">        * @description Sets the current position of the Element and calculates the offset</span>
700<span class="c">        * @param {Array} xy The XY coords to set the position to.</span>
701<span class="c">        */</span>
702        <span class="nx">_setStartPosition</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">xy</span><span class="o">)</span> <span class="o">{</span>
703            <span class="k">this</span><span class="o">.</span><span class="nx">startXY</span> <span class="o">=</span> <span class="nx">xy</span><span class="o">;</span>
704           
705            <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">getXY</span><span class="o">();</span>
706            <span class="k">this</span><span class="o">.</span><span class="nx">lastXY</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">;</span>
707
708            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;offsetNode&#39;</span><span class="o">))</span> <span class="o">{</span>
709                <span class="k">this</span><span class="o">.</span><span class="nx">deltaXY</span> <span class="o">=</span> <span class="o">[(</span><span class="k">this</span><span class="o">.</span><span class="nx">startXY</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">[</span><span class="m">0</span><span class="o">]),</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">startXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">[</span><span class="m">1</span><span class="o">])];</span>
710            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
711                <span class="k">this</span><span class="o">.</span><span class="nx">deltaXY</span> <span class="o">=</span> <span class="o">[</span><span class="m">0</span><span class="o">,</span> <span class="m">0</span><span class="o">];</span>
712            <span class="o">}</span>
713        <span class="o">},</span>
714        <span class="c">/**</span>
715<span class="c">        * @private</span>
716<span class="c">        * @method _timeoutCheck</span>
717<span class="c">        * @description The method passed to setTimeout to determine if the clickTimeThreshold was met.</span>
718<span class="c">        */</span>
719        <span class="nx">_timeoutCheck</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
720            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;lock&#39;</span><span class="o">))</span> <span class="o">{</span>
721                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;timeout threshold met&quot;</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;dd-drag&quot;</span><span class="o">);</span>
722                <span class="k">this</span><span class="o">.</span><span class="nx">_fromTimeout</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
723                <span class="k">this</span><span class="o">.</span><span class="nx">_dragThreshMet</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
724                <span class="k">this</span><span class="o">.</span><span class="nx">start</span><span class="o">();</span>
725                <span class="k">this</span><span class="o">.</span><span class="nx">_moveNode</span><span class="o">([</span><span class="k">this</span><span class="o">.</span><span class="nx">_ev_md</span><span class="o">.</span><span class="nx">pageX</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_ev_md</span><span class="o">.</span><span class="nx">pageY</span><span class="o">],</span> <span class="kc">true</span><span class="o">);</span>
726            <span class="o">}</span>
727        <span class="o">},</span>
728        <span class="c">/**</span>
729<span class="c">        * @method removeHandle</span>
730<span class="c">        * @description Remove a Selector added by addHandle</span>
731<span class="c">        * @param {String} str The selector for the handle to be removed. </span>
732<span class="c">        * @return {Self}</span>
733<span class="c">        * @chainable</span>
734<span class="c">        */</span>
735        <span class="nx">removeHandle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">str</span><span class="o">)</span> <span class="o">{</span>
736            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">[</span><span class="nx">str</span><span class="o">])</span> <span class="o">{</span>
737                <span class="nx">delete</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">[</span><span class="nx">str</span><span class="o">];</span>
738                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_REMOVE_HANDLE</span><span class="o">,</span> <span class="o">{</span> <span class="nx">handle</span><span class="o">:</span> <span class="nx">str</span> <span class="o">});</span>
739            <span class="o">}</span>
740            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
741        <span class="o">},</span>
742        <span class="c">/**</span>
743<span class="c">        * @method addHandle</span>
744<span class="c">        * @description Add a handle to a drag element. Drag only initiates when a mousedown happens on this element.</span>
745<span class="c">        * @param {String} str The selector to test for a valid handle. Must be a child of the element.</span>
746<span class="c">        * @return {Self}</span>
747<span class="c">        * @chainable</span>
748<span class="c">        */</span>
749        <span class="nx">addHandle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">str</span><span class="o">)</span> <span class="o">{</span>
750            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">)</span> <span class="o">{</span>
751                <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span> <span class="o">=</span> <span class="o">{};</span>
752            <span class="o">}</span>
753            <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">str</span><span class="o">))</span> <span class="o">{</span>
754                <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">[</span><span class="nx">str</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
755                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_ADD_HANDLE</span><span class="o">,</span> <span class="o">{</span> <span class="nx">handle</span><span class="o">:</span> <span class="nx">str</span> <span class="o">});</span>
756            <span class="o">}</span>
757            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
758        <span class="o">},</span>
759        <span class="c">/**</span>
760<span class="c">        * @method removeInvalid</span>
761<span class="c">        * @description Remove an invalid handle added by addInvalid</span>
762<span class="c">        * @param {String} str The invalid handle to remove from the internal list.</span>
763<span class="c">        * @return {Self}</span>
764<span class="c">        * @chainable</span>
765<span class="c">        */</span>
766        <span class="nx">removeInvalid</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">str</span><span class="o">)</span> <span class="o">{</span>
767            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_invalids</span><span class="o">[</span><span class="nx">str</span><span class="o">])</span> <span class="o">{</span>
768                <span class="nx">delete</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handles</span><span class="o">[</span><span class="nx">str</span><span class="o">];</span>
769                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_REMOVE_INVALID</span><span class="o">,</span> <span class="o">{</span> <span class="nx">handle</span><span class="o">:</span> <span class="nx">str</span> <span class="o">});</span>
770            <span class="o">}</span>
771            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
772        <span class="o">},</span>
773        <span class="c">/**</span>
774<span class="c">        * @method addInvalid</span>
775<span class="c">        * @description Add a selector string to test the handle against. If the test passes the drag operation will not continue.</span>
776<span class="c">        * @param {String} str The selector to test against to determine if this is an invalid drag handle.</span>
777<span class="c">        * @return {Self}</span>
778<span class="c">        * @chainable</span>
779<span class="c">        */</span>
780        <span class="nx">addInvalid</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">str</span><span class="o">)</span> <span class="o">{</span>
781            <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">str</span><span class="o">))</span> <span class="o">{</span>
782                <span class="k">this</span><span class="o">.</span><span class="nx">_invalids</span><span class="o">[</span><span class="nx">str</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
783                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_ADD_INVALID</span><span class="o">,</span> <span class="o">{</span> <span class="nx">handle</span><span class="o">:</span> <span class="nx">str</span> <span class="o">});</span>
784            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
785                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Selector needs to be a string..&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
786            <span class="o">}</span>
787            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
788        <span class="o">},</span>
789        <span class="c">/**</span>
790<span class="c">        * @private</span>
791<span class="c">        * @method initializer</span>
792<span class="c">        * @description Internal init handler</span>
793<span class="c">        */</span>
794        <span class="nx">initializer</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
795            <span class="c">//TODO give the node instance a copy of this object</span>
796<span class="c"></span>            <span class="c">//Not supported in PR1 due to Y.Node.get calling a new under the hood.</span>
797<span class="c"></span>            <span class="c">//this.get(NODE).dd = this;</span>
798<span class="c"></span>
799            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;id&#39;</span><span class="o">))</span> <span class="o">{</span>
800                <span class="k">var</span> <span class="nx">id</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">stamp</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">));</span>
801                <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">set</span><span class="o">(</span><span class="s1">&#39;id&#39;</span><span class="o">,</span> <span class="nx">id</span><span class="o">);</span>
802            <span class="o">}</span>
803           
804
805            <span class="k">this</span><span class="o">.</span><span class="nx">_invalids</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_invalidsDefault</span><span class="o">;</span>
806
807            <span class="k">this</span><span class="o">.</span><span class="nx">_createEvents</span><span class="o">();</span>
808           
809            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">DRAG_NODE</span><span class="o">))</span> <span class="o">{</span>
810                <span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="nx">DRAG_NODE</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">));</span>
811            <span class="o">}</span>
812            <span class="k">this</span><span class="o">.</span><span class="nx">_prep</span><span class="o">();</span>
813            <span class="k">this</span><span class="o">.</span><span class="nx">_dragThreshMet</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
814        <span class="o">},</span>
815        <span class="c">/**</span>
816<span class="c">        * @private</span>
817<span class="c">        * @method _prep</span>
818<span class="c">        * @description Attach event listners and add classname</span>
819<span class="c">        */</span>
820        <span class="nx">_prep</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
821            <span class="k">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">);</span>
822            <span class="nx">node</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">CSS_PREFIX</span> <span class="o">+</span> <span class="s1">&#39;-draggable&#39;</span><span class="o">);</span>
823            <span class="nx">node</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">MOUSE_DOWN</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseDownEvent</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
824            <span class="nx">node</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">MOUSE_UP</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseUp</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
825        <span class="o">},</span>
826        <span class="c">/**</span>
827<span class="c">        * @private</span>
828<span class="c">        * @method _unprep</span>
829<span class="c">        * @description Detach event listners and remove classname</span>
830<span class="c">        */</span>
831        <span class="nx">_unprep</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
832            <span class="k">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">);</span>
833            <span class="nx">node</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">CSS_PREFIX</span> <span class="o">+</span> <span class="s1">&#39;-draggable&#39;</span><span class="o">);</span>
834            <span class="nx">node</span><span class="o">.</span><span class="nx">detach</span><span class="o">(</span><span class="nx">MOUSE_DOWN</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseDownEvent</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
835            <span class="nx">node</span><span class="o">.</span><span class="nx">detach</span><span class="o">(</span><span class="nx">MOUSE_UP</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseUp</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
836        <span class="o">},</span>
837        <span class="c">/**</span>
838<span class="c">        * @method start</span>
839<span class="c">        * @description Starts the drag operation</span>
840<span class="c">        * @return {Self}</span>
841<span class="c">        * @chainable</span>
842<span class="c">        */</span>
843        <span class="nx">start</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
844            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;lock&#39;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;dragging&#39;</span><span class="o">))</span> <span class="o">{</span>
845                <span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s1">&#39;dragging&#39;</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
846                <span class="nx">DDM</span><span class="o">.</span><span class="nx">_start</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">deltaXY</span><span class="o">,</span> <span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="nx">OFFSET_HEIGHT</span><span class="o">),</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="nx">OFFSET_WIDTH</span><span class="o">)]);</span>
847                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;startDrag&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
848                <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">CSS_PREFIX</span> <span class="o">+</span> <span class="s1">&#39;-dragging&#39;</span><span class="o">);</span>
849                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_START</span><span class="o">,</span> <span class="o">{</span> <span class="nx">pageX</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> <span class="nx">pageY</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">});</span>
850                <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">DRAG_NODE</span><span class="o">).</span><span class="nx">on</span><span class="o">(</span><span class="nx">MOUSE_UP</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseUp</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
851                <span class="k">var</span> <span class="nx">xy</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">;</span>
852
853                <span class="k">this</span><span class="o">.</span><span class="nx">_startTime</span> <span class="o">=</span> <span class="o">(</span><span class="k">new</span> <span class="nb">Date</span><span class="o">()).</span><span class="nx">getTime</span><span class="o">();</span>
854               
855                <span class="k">this</span><span class="o">.</span><span class="nx">region</span> <span class="o">=</span> <span class="o">{</span>
856                    <span class="s1">&#39;0&#39;</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> 
857                    <span class="s1">&#39;1&#39;</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">],</span>
858                    <span class="nx">area</span><span class="o">:</span> <span class="m">0</span><span class="o">,</span>
859                    <span class="nx">top</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">],</span>
860                    <span class="nx">right</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="nx">OFFSET_WIDTH</span><span class="o">),</span>
861                    <span class="nx">bottom</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="nx">OFFSET_HEIGHT</span><span class="o">),</span>
862                    <span class="nx">left</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span>
863                <span class="o">};</span>
864               
865            <span class="o">}</span>
866            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
867        <span class="o">},</span>
868        <span class="c">/**</span>
869<span class="c">        * @method end</span>
870<span class="c">        * @description Ends the drag operation</span>
871<span class="c">        * @return {Self}</span>
872<span class="c">        * @chainable</span>
873<span class="c">        */</span>
874        <span class="nx">end</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
875            <span class="k">this</span><span class="o">.</span><span class="nx">_endTime</span> <span class="o">=</span> <span class="o">(</span><span class="k">new</span> <span class="nb">Date</span><span class="o">()).</span><span class="nx">getTime</span><span class="o">();</span>
876            <span class="nx">clearTimeout</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_clickTimeout</span><span class="o">);</span>
877            <span class="k">this</span><span class="o">.</span><span class="nx">_dragThreshMet</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
878            <span class="k">this</span><span class="o">.</span><span class="nx">_fromTimeout</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
879            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;lock&#39;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;dragging&#39;</span><span class="o">))</span> <span class="o">{</span>
880                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;endDrag&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
881                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_END</span><span class="o">,</span> <span class="o">{</span> <span class="nx">pageX</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">lastXY</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> <span class="nx">pageY</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">lastXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">});</span>
882            <span class="o">}</span>
883            <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">DDM</span><span class="o">.</span><span class="nx">CSS_PREFIX</span> <span class="o">+</span> <span class="s1">&#39;-dragging&#39;</span><span class="o">);</span>
884            <span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s1">&#39;dragging&#39;</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>
885            <span class="k">this</span><span class="o">.</span><span class="nx">deltaXY</span> <span class="o">=</span> <span class="o">[</span><span class="m">0</span><span class="o">,</span> <span class="m">0</span><span class="o">];</span>
886            <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">DRAG_NODE</span><span class="o">).</span><span class="nx">detach</span><span class="o">(</span><span class="nx">MOUSE_UP</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_handleMouseUp</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
887
888            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
889        <span class="o">},</span>
890        <span class="c">/**</span>
891<span class="c">        * @private</span>
892<span class="c">        * @method _align</span>
893<span class="c">        * @description Calculates the offsets and set&#39;s the XY that the element will move to.</span>
894<span class="c">        * @param {Array} xy The xy coords to align with.</span>
895<span class="c">        * @return Array</span>
896<span class="c">        * @type {Array}</span>
897<span class="c">        */</span>
898        <span class="nx">_align</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">xy</span><span class="o">)</span> <span class="o">{</span>
899            <span class="k">return</span> <span class="o">[</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">deltaXY</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">deltaXY</span><span class="o">[</span><span class="m">1</span><span class="o">]];</span>
900        <span class="o">},</span>
901        <span class="c">/**</span>
902<span class="c">        * @private</span>
903<span class="c">        * @method _moveNode</span>
904<span class="c">        * @description This method performs the actual element move.</span>
905<span class="c">        * @param {Array} eXY The XY to move the element to, usually comes from the mousemove DOM event.</span>
906<span class="c">        * @param {Boolean} noFire If true, the drag:drag event will not fire.</span>
907<span class="c">        */</span>
908        <span class="nx">_moveNode</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">eXY</span><span class="o">,</span> <span class="nx">noFire</span><span class="o">)</span> <span class="o">{</span>
909            <span class="k">var</span> <span class="nx">xy</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_align</span><span class="o">(</span><span class="nx">eXY</span><span class="o">),</span> <span class="nx">diffXY</span> <span class="o">=</span> <span class="o">[],</span> <span class="nx">diffXY2</span> <span class="o">=</span> <span class="o">[];</span>
910
911            <span class="nx">diffXY</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">=</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">lastXY</span><span class="o">[</span><span class="m">0</span><span class="o">]);</span>
912            <span class="nx">diffXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">=</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">lastXY</span><span class="o">[</span><span class="m">1</span><span class="o">]);</span>
913
914            <span class="nx">diffXY2</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">=</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">[</span><span class="m">0</span><span class="o">]);</span>
915            <span class="nx">diffXY2</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">=</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">[</span><span class="m">1</span><span class="o">]);</span>
916
917            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;move&#39;</span><span class="o">))</span> <span class="o">{</span>
918                <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">UA</span><span class="o">.</span><span class="nx">opera</span><span class="o">)</span> <span class="o">{</span>
919                    <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">DRAG_NODE</span><span class="o">).</span><span class="nx">setXY</span><span class="o">(</span><span class="nx">xy</span><span class="o">);</span>
920                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
921                    <span class="nx">DDM</span><span class="o">.</span><span class="nx">setXY</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">DRAG_NODE</span><span class="o">),</span> <span class="nx">diffXY</span><span class="o">);</span>
922                <span class="o">}</span>
923            <span class="o">}</span>
924
925            <span class="k">this</span><span class="o">.</span><span class="nx">region</span> <span class="o">=</span> <span class="o">{</span>
926                <span class="s1">&#39;0&#39;</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> 
927                <span class="s1">&#39;1&#39;</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">],</span>
928                <span class="nx">area</span><span class="o">:</span> <span class="m">0</span><span class="o">,</span>
929                <span class="nx">top</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">],</span>
930                <span class="nx">right</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="nx">OFFSET_WIDTH</span><span class="o">),</span>
931                <span class="nx">bottom</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">NODE</span><span class="o">).</span><span class="nx">get</span><span class="o">(</span><span class="nx">OFFSET_HEIGHT</span><span class="o">),</span>
932                <span class="nx">left</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span>
933            <span class="o">};</span>
934
935            <span class="k">var</span> <span class="nx">startXY</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">nodeXY</span><span class="o">;</span>
936            <span class="k">if</span> <span class="o">(!</span><span class="nx">noFire</span><span class="o">)</span> <span class="o">{</span>
937                <span class="k">this</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">EV_DRAG</span><span class="o">,</span> <span class="o">{</span>
938                    <span class="nx">pageX</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
939                    <span class="nx">pageY</span><span class="o">:</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">],</span>
940                    <span class="nx">info</span><span class="o">:</span> <span class="o">{</span>
941                        <span class="nx">start</span><span class="o">:</span> <span class="nx">startXY</span><span class="o">,</span>
942                        <span class="nx">xy</span><span class="o">:</span> <span class="nx">xy</span><span class="o">,</span>
943                        <span class="nx">delta</span><span class="o">:</span> <span class="nx">diffXY</span><span class="o">,</span>
944                        <span class="nx">offset</span><span class="o">:</span> <span class="nx">diffXY2</span>
945                    <span class="o">}</span> 
946                <span class="o">});</span>
947            <span class="o">}</span>
948           
949            <span class="k">this</span><span class="o">.</span><span class="nx">lastXY</span> <span class="o">=</span> <span class="nx">xy</span><span class="o">;</span>
950        <span class="o">},</span>
951        <span class="c">/**</span>
952<span class="c">        * @private</span>
953<span class="c">        * @method _move</span>
954<span class="c">        * @description Fired from DragDropMgr (DDM) on mousemove.</span>
955<span class="c">        * @param {Event} ev The mousemove DOM event</span>
956<span class="c">        */</span>
957        <span class="nx">_move</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">ev</span><span class="o">)</span> <span class="o">{</span>
958            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;lock&#39;</span><span class="o">))</span> <span class="o">{</span>
959                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Drag Locked&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
960                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
961            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
962                <span class="k">this</span><span class="o">.</span><span class="nx">mouseXY</span> <span class="o">=</span> <span class="o">[</span><span class="nx">ev</span><span class="o">.</span><span class="nx">pageX</span><span class="o">,</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">pageY</span><span class="o">];</span>
963                <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_dragThreshMet</span><span class="o">)</span> <span class="o">{</span>
964                    <span class="k">var</span> <span class="nx">diffX</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">abs</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">startXY</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">pageX</span><span class="o">);</span>
965                    <span class="k">var</span> <span class="nx">diffY</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">abs</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">startXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">pageY</span><span class="o">);</span>
966                    <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;diffX: &quot;</span> <span class="o">+</span> <span class="nx">diffX</span> <span class="o">+</span> <span class="s2">&quot;, diffY: &quot;</span> <span class="o">+</span> <span class="nx">diffY</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
967                    <span class="k">if</span> <span class="o">(</span><span class="nx">diffX</span> <span class="o">&gt;</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;clickPixelThresh&#39;</span><span class="o">)</span> <span class="o">||</span> <span class="nx">diffY</span> <span class="o">&gt;</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;clickPixelThresh&#39;</span><span class="o">))</span> <span class="o">{</span>
968                        <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;pixel threshold met&quot;</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;dd-drag&quot;</span><span class="o">);</span>
969                        <span class="k">this</span><span class="o">.</span><span class="nx">_dragThreshMet</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
970                        <span class="k">this</span><span class="o">.</span><span class="nx">start</span><span class="o">();</span>
971                        <span class="k">this</span><span class="o">.</span><span class="nx">_moveNode</span><span class="o">([</span><span class="nx">ev</span><span class="o">.</span><span class="nx">pageX</span><span class="o">,</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">pageY</span><span class="o">]);</span>
972                    <span class="o">}</span>
973               
974                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
975                    <span class="nx">clearTimeout</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_clickTimeout</span><span class="o">);</span>
976                    <span class="k">this</span><span class="o">.</span><span class="nx">_moveNode</span><span class="o">([</span><span class="nx">ev</span><span class="o">.</span><span class="nx">pageX</span><span class="o">,</span> <span class="nx">ev</span><span class="o">.</span><span class="nx">pageY</span><span class="o">]);</span>
977                <span class="o">}</span>
978            <span class="o">}</span>
979        <span class="o">},</span>
980        <span class="c">/**</span>
981<span class="c">        * @method stopDrag</span>
982<span class="c">        * @description Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.</span>
983<span class="c">        * @return {Self}</span>
984<span class="c">        * @chainable</span>
985<span class="c">        */</span>
986        <span class="nx">stopDrag</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
987            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;dragging&#39;</span><span class="o">))</span> <span class="o">{</span>
988                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;stopDrag called&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-drag&#39;</span><span class="o">);</span>
989                <span class="nx">DDM</span><span class="o">.</span><span class="nx">_end</span><span class="o">();</span>
990            <span class="o">}</span>
991            <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
992        <span class="o">},</span>
993        <span class="c">/**</span>
994<span class="c">        * @private</span>
995<span class="c">        * @method destructor</span>
996<span class="c">        * @description Lifecycle destructor, unreg the drag from the DDM and remove listeners</span>
997<span class="c">        */</span>
998        <span class="nx">destructor</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
999            <span class="nx">DDM</span><span class="o">.</span><span class="nx">_unregDrag</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
1000
1001            <span class="k">this</span><span class="o">.</span><span class="nx">_unprep</span><span class="o">();</span>
1002            <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">target</span><span class="o">)</span> <span class="o">{</span>
1003                <span class="k">this</span><span class="o">.</span><span class="nx">target</span><span class="o">.</span><span class="nx">destroy</span><span class="o">();</span>
1004            <span class="o">}</span>
1005        <span class="o">}</span>
1006    <span class="o">});</span>
1007    <span class="nx">Y</span><span class="o">.</span><span class="nx">namespace</span><span class="o">(</span><span class="s1">&#39;DD&#39;</span><span class="o">);</span>   
1008    <span class="nx">Y</span><span class="o">.</span><span class="nx">DD</span><span class="o">.</span><span class="nx">Drag</span> <span class="o">=</span> <span class="nx">Drag</span><span class="o">;</span>
1009</pre></div>
1010                    </div>
1011                        </div>
1012                </div>
1013                <div class="yui-b">
1014            <div class="nav">
1015
1016                    <div class="module">
1017                        <h4>Modules</h4>
1018                        <ul class="content">
1019
1020                                <li class=""><a href="module_anim.html">anim</a></li>
1021
1022                                <li class=""><a href="module_attribute.html">attribute</a></li>
1023
1024                                <li class=""><a href="module_base.html">base</a></li>
1025
1026                                <li class=""><a href="module_cookie.html">cookie</a></li>
1027
1028                                <li class="selected"><a href="module_dd.html">dd</a></li>
1029
1030                                <li class=""><a href="module_dd-plugin.html">dd-plugin</a></li>
1031
1032                                <li class=""><a href="module_dom.html">dom</a></li>
1033
1034                                <li class=""><a href="module_dump.html">dump</a></li>
1035
1036                                <li class=""><a href="module_event.html">event</a></li>
1037
1038                                <li class=""><a href="module_io.html">io</a></li>
1039
1040                                <li class=""><a href="module_json.html">json</a></li>
1041
1042                                <li class=""><a href="module_node.html">node</a></li>
1043
1044                                <li class=""><a href="module_oop.html">oop</a></li>
1045
1046                                <li class=""><a href="module_queue.html">queue</a></li>
1047
1048                                <li class=""><a href="module_substitute.html">substitute</a></li>
1049
1050                                <li class=""><a href="module_yui.html">yui</a></li>
1051                        </ul>
1052                    </div>
1053
1054                    <div class="module">
1055                        <h4>Classes</h4>
1056                        <ul class="content">
1057                                <li class=""><a href="DDM.html">DDM</a></li>
1058                                <li class=""><a href="Drag.html">Drag</a></li>
1059                                <li class=""><a href="DragConstained.html">DragConstained</a></li>
1060                                <li class=""><a href="Drop.html">Drop</a></li>
1061                                <li class=""><a href="Proxy.html">Proxy</a></li>
1062                        </ul>
1063                    </div>
1064
1065                    <div class="module">
1066                        <h4>Files</h4>
1067                        <ul class="content">       
1068                                <li class=""><a href="constrain.js.html">constrain.js</a></li>
1069                                <li class=""><a href="ddm-base.js.html">ddm-base.js</a></li>
1070                                <li class=""><a href="ddm-drop.js.html">ddm-drop.js</a></li>
1071                                <li class=""><a href="ddm.js.html">ddm.js</a></li>
1072                                <li class="selected"><a href="drag.js.html">drag.js</a></li>
1073                                <li class=""><a href="drop.js.html">drop.js</a></li>
1074                                <li class=""><a href="proxy.js.html">proxy.js</a></li>
1075                        </ul>
1076                    </div>
1077
1078
1079
1080
1081
1082            </div>
1083                </div>
1084        </div>
1085        <div id="ft">
1086        <hr />
1087        Copyright &copy; 2008 Yahoo! Inc. All rights reserved.
1088        </div>
1089</div>
1090</body>
1091</html>
Note: See TracBrowser for help on using the repository browser.