drag.js.html revision 4fcbec6145d16637205990699912fb90f6a3807c
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>API: dd drag.js (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/api.css">
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
<h3>dd&nbsp; <span class="subtitle">3.00PR1</span></h3>
<p>
<a href="/index.html">Yahoo! UI Library</a>
&gt; <a href="/module_dd.html">dd</a>
&gt; drag.js (source view)
</p>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form name="yui-classopts-form">
<span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
<span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
<span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
</form>
<div id="srcout">
<style>
#doc3 #classopts { display:none; }
</style>
<div class="highlight" ><pre> <span class="c">/**</span>
<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>
<span class="c"> * @module dd</span>
<span class="c"> * @submodule dd-drag</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * This class provides the ability to drag a Node.</span>
<span class="c"> * @class Drag</span>
<span class="c"> * @extends Base</span>
<span class="c"> * @constructor</span>
<span class="c"> */</span>
<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>
<span class="nx">NODE</span> <span class="o">=</span> <span class="s1">&#39;node&#39;</span><span class="o">,</span>
<span class="nx">DRAG_NODE</span> <span class="o">=</span> <span class="s1">&#39;dragNode&#39;</span><span class="o">,</span>
<span class="nx">OFFSET_HEIGHT</span> <span class="o">=</span> <span class="s1">&#39;offsetHeight&#39;</span><span class="o">,</span>
<span class="nx">OFFSET_WIDTH</span> <span class="o">=</span> <span class="s1">&#39;offsetWidth&#39;</span><span class="o">,</span>
<span class="nx">MOUSE_UP</span> <span class="o">=</span> <span class="s1">&#39;mouseup&#39;</span><span class="o">,</span>
<span class="nx">MOUSE_DOWN</span> <span class="o">=</span> <span class="s1">&#39;mousedown&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:mouseDown</span>
<span class="c"> * @description Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers.</span>
<span class="c"> * @preventable _handleMouseDown</span>
<span class="c"> * @param {Event} ev The mousedown event.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_MOUSE_DOWN</span> <span class="o">=</span> <span class="s1">&#39;drag:mouseDown&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:afterMouseDown</span>
<span class="c"> * @description Fires after the mousedown event has been cleared.</span>
<span class="c"> * @param {Event} ev The mousedown event.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_AFTER_MOUSE_DOWN</span> <span class="o">=</span> <span class="s1">&#39;drag:afterMouseDown&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:removeHandle</span>
<span class="c"> * @description Fires after a handle is removed.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_REMOVE_HANDLE</span> <span class="o">=</span> <span class="s1">&#39;drag:removeHandle&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:addHandle</span>
<span class="c"> * @description Fires after a handle is added.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_ADD_HANDLE</span> <span class="o">=</span> <span class="s1">&#39;drag:addHandle&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:removeInvalid</span>
<span class="c"> * @description Fires after an invalid selector is removed.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_REMOVE_INVALID</span> <span class="o">=</span> <span class="s1">&#39;drag:removeInvalid&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:addInvalid</span>
<span class="c"> * @description Fires after an invalid selector is added.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_ADD_INVALID</span> <span class="o">=</span> <span class="s1">&#39;drag:addInvalid&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:start</span>
<span class="c"> * @description Fires at the start of a drag operation.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_START</span> <span class="o">=</span> <span class="s1">&#39;drag:start&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:end</span>
<span class="c"> * @description Fires at the end of a drag operation.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_END</span> <span class="o">=</span> <span class="s1">&#39;drag:end&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event drag:drag</span>
<span class="c"> * @description Fires every mousemove during a drag operation.</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="nx">EV_DRAG</span> <span class="o">=</span> <span class="s1">&#39;drag:drag&#39;</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @event drag:over</span>
<span class="c"> * @description Fires when this node is over a Drop Target. (Fired from dd-drop)</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event drag:enter</span>
<span class="c"> * @description Fires when this node enters a Drop Target. (Fired from dd-drop)</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event drag:exit</span>
<span class="c"> * @description Fires when this node exits a Drop Target. (Fired from dd-drop)</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event drag:drophit</span>
<span class="c"> * @description Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop)</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event drag:dropmiss</span>
<span class="c"> * @description Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop)</span>
<span class="c"> * @bubbles DDM</span>
<span class="c"> * @type Event.Custom</span>
<span class="c"> */</span>
<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>
<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>
<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>
<span class="o">};</span>
<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>
<span class="nx">Drag</span><span class="o">.</span><span class="nx">ATTRS</span> <span class="o">=</span> <span class="o">{</span>
<span class="c">/**</span>
<span class="c"> * @attribute node</span>
<span class="c"> * @description Y.Node instanace to use as the element to initiate a drag operation</span>
<span class="c"> * @type Node</span>
<span class="c"> */</span>
<span class="nx">node</span><span class="o">:</span> <span class="o">{</span>
<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>
<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>
<span class="k">if</span> <span class="o">(!</span><span class="nx">n</span><span class="o">)</span> <span class="o">{</span>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">n</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute dragNode</span>
<span class="c"> * @description Y.Node instanace to use as the draggable element, defaults to node</span>
<span class="c"> * @type Node</span>
<span class="c"> */</span>
<span class="nx">dragNode</span><span class="o">:</span> <span class="o">{</span>
<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>
<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>
<span class="k">if</span> <span class="o">(!</span><span class="nx">n</span><span class="o">)</span> <span class="o">{</span>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">n</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute offsetNode</span>
<span class="c"> * @description Offset the drag element by the difference in cursor position: default true</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">offsetNode</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute clickPixelThresh</span>
<span class="c"> * @description The number of pixels to move to start a drag operation, default is 3.</span>
<span class="c"> * @type Number</span>
<span class="c"> */</span>
<span class="nx">clickPixelThresh</span><span class="o">:</span> <span class="o">{</span>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute clickTimeThresh</span>
<span class="c"> * @description The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.</span>
<span class="c"> * @type Number</span>
<span class="c"> */</span>
<span class="nx">clickTimeThresh</span><span class="o">:</span> <span class="o">{</span>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute lock</span>
<span class="c"> * @description Set to lock this drag element so that it can&#39;t be dragged: default false.</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">lock</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<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>
<span class="k">if</span> <span class="o">(</span><span class="nx">lock</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">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>
<span class="o">}</span> <span class="k">else</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">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>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute data</span>
<span class="c"> * @description A payload holder to store arbitrary data about this drag object, can be used to store any value.</span>
<span class="c"> * @type Mixed</span>
<span class="c"> */</span>
<span class="nx">data</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">false</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute move</span>
<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>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">move</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute useShim</span>
<span class="c"> * @description Use the protective shim on all drag operations: default true. Only works with dd-ddm, not dd-ddm-base.</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">useShim</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute activeHandle</span>
<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>
<span class="c"> * @type Node</span>
<span class="c"> */</span>
<span class="nx">activeHandle</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">false</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute primaryButtonOnly</span>
<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>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">primaryButtonOnly</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute dragging</span>
<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>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">dragging</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">false</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute target</span>
<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>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">target</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<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>
<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>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute dragMode</span>
<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>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">dragMode</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<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>
<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>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute groups</span>
<span class="c"> * @description Array of groups to add this drag into.</span>
<span class="c"> * @type Array</span>
<span class="c"> */</span>
<span class="nx">groups</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;default&#39;</span><span class="o">],</span>
<span class="nx">get</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">_groups</span> <span class="o">=</span> <span class="o">{};</span>
<span class="o">}</span>
<span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="o">[];</span>
<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>
<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>
<span class="o">});</span>
<span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
<span class="o">},</span>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">_groups</span> <span class="o">=</span> <span class="o">{};</span>
<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>
<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>
<span class="o">},</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @attribute handles</span>
<span class="c"> * @description Array of valid handles to add. Adding something here will set all handles, even if previously added with addHandle</span>
<span class="c"> * @type Array</span>
<span class="c"> */</span>
<span class="nx">handles</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<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>
<span class="k">if</span> <span class="o">(</span><span class="nx">g</span><span class="o">)</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>
<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>
<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>
<span class="o">},</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span> <span class="k">else</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="kc">null</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">g</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<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>
<span class="c">/**</span>
<span class="c"> * @method addToGroup</span>
<span class="c"> * @description Add this Drag instance to a group, this should be used for on-the-fly group additions.</span>
<span class="c"> * @param {String} g The group to add this Drag Instance to.</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<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>
<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>
<span class="nx">DDM</span><span class="o">.</span><span class="nx">_activateTargets</span><span class="o">();</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method removeFromGroup</span>
<span class="c"> * @description Remove this Drag instance from a group, this should be used for on-the-fly group removals.</span>
<span class="c"> * @param {String} g The group to remove this Drag Instance from.</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<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>
<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>
<span class="nx">DDM</span><span class="o">.</span><span class="nx">_activateTargets</span><span class="o">();</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @property target</span>
<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>
<span class="c"> * @type {Object}</span>
<span class="c"> */</span>
<span class="nx">target</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _handleTarget</span>
<span class="c"> * @description Attribute handler for the target config attribute.</span>
<span class="c"> * @param {Boolean/Object}</span>
<span class="c"> * @return {Boolean/Object}</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<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>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<span class="nx">config</span> <span class="o">=</span> <span class="o">{};</span>
<span class="o">}</span>
<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>
<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>
<span class="o">}</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _groups</span>
<span class="c"> * @description Storage Array for the groups this drag belongs to.</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<span class="nx">_groups</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _createEvents</span>
<span class="c"> * @description This method creates all the events for this Event Target and publishes them so we get Event Bubbling.</span>
<span class="c"> */</span>
<span class="nx">_createEvents</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<span class="nx">queuable</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
<span class="nx">emitFacade</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
<span class="nx">bubbles</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="k">var</span> <span class="nx">ev</span> <span class="o">=</span> <span class="o">[</span>
<span class="nx">EV_AFTER_MOUSE_DOWN</span><span class="o">,</span>
<span class="nx">EV_REMOVE_HANDLE</span><span class="o">,</span>
<span class="nx">EV_ADD_HANDLE</span><span class="o">,</span>
<span class="nx">EV_REMOVE_INVALID</span><span class="o">,</span>
<span class="nx">EV_ADD_INVALID</span><span class="o">,</span>
<span class="nx">EV_START</span><span class="o">,</span>
<span class="nx">EV_END</span><span class="o">,</span>
<span class="nx">EV_DRAG</span><span class="o">,</span>
<span class="s1">&#39;drag:drophit&#39;</span><span class="o">,</span>
<span class="s1">&#39;drag:dropmiss&#39;</span><span class="o">,</span>
<span class="s1">&#39;drag:over&#39;</span><span class="o">,</span>
<span class="s1">&#39;drag:enter&#39;</span><span class="o">,</span>
<span class="s1">&#39;drag:exit&#39;</span>
<span class="o">];</span>
<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>
<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>
<span class="nx">type</span><span class="o">:</span> <span class="nx">v</span><span class="o">,</span>
<span class="nx">emitFacade</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
<span class="nx">bubbles</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
<span class="nx">preventable</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<span class="nx">queuable</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="o">},</span> <span class="k">this</span><span class="o">);</span>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _ev_md</span>
<span class="c"> * @description A private reference to the mousedown DOM event</span>
<span class="c"> * @type {Event}</span>
<span class="c"> */</span>
<span class="nx">_ev_md</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _startTime</span>
<span class="c"> * @description The getTime of the mousedown event. Not used, just here in case someone wants/needs to use it.</span>
<span class="c"> * @type Date</span>
<span class="c"> */</span>
<span class="nx">_startTime</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _endTime</span>
<span class="c"> * @description The getTime of the mouseup event. Not used, just here in case someone wants/needs to use it.</span>
<span class="c"> * @type Date</span>
<span class="c"> */</span>
<span class="nx">_endTime</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _handles</span>
<span class="c"> * @description A private hash of the valid drag handles</span>
<span class="c"> * @type {Object}</span>
<span class="c"> */</span>
<span class="nx">_handles</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _invalids</span>
<span class="c"> * @description A private hash of the invalid selector strings</span>
<span class="c"> * @type {Object}</span>
<span class="c"> */</span>
<span class="nx">_invalids</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _invalidsDefault</span>
<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>
<span class="c"> * @type {Object}</span>
<span class="c"> */</span>
<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>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _dragThreshMet</span>
<span class="c"> * @description Private flag to see if the drag threshhold was met</span>
<span class="c"> * @type {Boolean}</span>
<span class="c"> */</span>
<span class="nx">_dragThreshMet</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _fromTimeout</span>
<span class="c"> * @description Flag to determine if the drag operation came from a timeout</span>
<span class="c"> * @type {Boolean}</span>
<span class="c"> */</span>
<span class="nx">_fromTimeout</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @property _clickTimeout</span>
<span class="c"> * @description Holder for the setTimeout call</span>
<span class="c"> * @type {Boolean}</span>
<span class="c"> */</span>
<span class="nx">_clickTimeout</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property deltaXY</span>
<span class="c"> * @description The offset of the mouse position to the element&#39;s position</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<span class="nx">deltaXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property startXY</span>
<span class="c"> * @description The initial mouse position</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<span class="nx">startXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property nodeXY</span>
<span class="c"> * @description The initial element position</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<span class="nx">nodeXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property lastXY</span>
<span class="c"> * @description The position of the element as it&#39;s moving (for offset calculations)</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<span class="nx">lastXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property mouseXY</span>
<span class="c"> * @description The XY coords of the mousemove</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<span class="nx">mouseXY</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property region</span>
<span class="c"> * @description A region object associated with this drag, used for checking regions while dragging.</span>
<span class="c"> * @type Object</span>
<span class="c"> */</span>
<span class="nx">region</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _handleMouseUp</span>
<span class="c"> * @description Handler for the mouseup DOM event</span>
<span class="c"> * @param {Event}</span>
<span class="c"> */</span>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">_fixIEMouseUp</span><span class="o">();</span>
<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>
<span class="nx">DDM</span><span class="o">.</span><span class="nx">_end</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/** </span>
<span class="c"> * @private</span>
<span class="c"> * @method _ieSelectFix</span>
<span class="c"> * @description The function we use as the onselectstart handler when we start a drag in Internet Explorer</span>
<span class="c"> */</span>
<span class="nx">_ieSelectFix</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/** </span>
<span class="c"> * @private</span>
<span class="c"> * @property _ieSelectBack</span>
<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>
<span class="c"> */</span>
<span class="nx">_ieSelectBack</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _fixIEMouseDown</span>
<span class="c"> * @description This method copies the onselectstart listner on the document to the _ieSelectFix property</span>
<span class="c"> */</span>
<span class="nx">_fixIEMouseDown</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<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>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _fixIEMouseUp</span>
<span class="c"> * @description This method copies the _ieSelectFix property back to the onselectstart listner on the document.</span>
<span class="c"> */</span>
<span class="nx">_fixIEMouseUp</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _handleMouseDownEvent</span>
<span class="c"> * @description Handler for the mousedown DOM event</span>
<span class="c"> * @param {Event}</span>
<span class="c"> */</span>
<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>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _handleMouseDown</span>
<span class="c"> * @description Handler for the mousedown DOM event</span>
<span class="c"> * @param {Event}</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">_fixIEMouseDown</span><span class="o">();</span>
<span class="nx">ev</span><span class="o">.</span><span class="nx">halt</span><span class="o">();</span>
<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>
<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>
<span class="k">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
<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>
<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>
<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>
<span class="o">}</span>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method validClick</span>
<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>
<span class="c"> * @param {Event}</span>
<span class="c"> * @return {Boolean}</span>
<span class="c"> */</span>
<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>
<span class="k">var</span> <span class="nx">r</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
<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>
<span class="nx">hTest</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<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>
<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>
<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>
<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>
<span class="c">//Am I this or am I inside this</span>
<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>
<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>
<span class="nx">hTest</span> <span class="o">=</span> <span class="nx">n</span><span class="o">;</span>
<span class="nx">r</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">});</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<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>
<span class="nx">r</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<span class="c">//Am I this or am I inside this</span>
<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>
<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>
<span class="nx">r</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">});</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">hTest</span><span class="o">)</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<span class="o">}</span>
<span class="o">},</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">r</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _setStartPosition</span>
<span class="c"> * @description Sets the current position of the Element and calculates the offset</span>
<span class="c"> * @param {Array} xy The XY coords to set the position to.</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<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>
<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>
<span class="o">}</span> <span class="k">else</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="m">0</span><span class="o">,</span> <span class="m">0</span><span class="o">];</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _timeoutCheck</span>
<span class="c"> * @description The method passed to setTimeout to determine if the clickTimeThreshold was met.</span>
<span class="c"> */</span>
<span class="nx">_timeoutCheck</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<span class="k">this</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">_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>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method removeHandle</span>
<span class="c"> * @description Remove a Selector added by addHandle</span>
<span class="c"> * @param {String} str The selector for the handle to be removed. </span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method addHandle</span>
<span class="c"> * @description Add a handle to a drag element. Drag only initiates when a mousedown happens on this element.</span>
<span class="c"> * @param {String} str The selector to test for a valid handle. Must be a child of the element.</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<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>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">_handles</span> <span class="o">=</span> <span class="o">{};</span>
<span class="o">}</span>
<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>
<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>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method removeInvalid</span>
<span class="c"> * @description Remove an invalid handle added by addInvalid</span>
<span class="c"> * @param {String} str The invalid handle to remove from the internal list.</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method addInvalid</span>
<span class="c"> * @description Add a selector string to test the handle against. If the test passes the drag operation will not continue.</span>
<span class="c"> * @param {String} str The selector to test against to determine if this is an invalid drag handle.</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<span class="o">}</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method initializer</span>
<span class="c"> * @description Internal init handler</span>
<span class="c"> */</span>
<span class="nx">initializer</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<span class="c">//TODO give the node instance a copy of this object</span>
<span class="c"></span> <span class="c">//Not supported in PR1 due to Y.Node.get calling a new under the hood.</span>
<span class="c"></span> <span class="c">//this.get(NODE).dd = this;</span>
<span class="c"></span>
<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>
<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>
<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>
<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">this</span><span class="o">.</span><span class="nx">_invalidsDefault</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_createEvents</span><span class="o">();</span>
<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>
<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>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_prep</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="kc">false</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _prep</span>
<span class="c"> * @description Attach event listners and add classname</span>
<span class="c"> */</span>
<span class="nx">_prep</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _unprep</span>
<span class="c"> * @description Detach event listners and remove classname</span>
<span class="c"> */</span>
<span class="nx">_unprep</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method start</span>
<span class="c"> * @description Starts the drag operation</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<span class="nx">start</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">region</span> <span class="o">=</span> <span class="o">{</span>
<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>
<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>
<span class="nx">area</span><span class="o">:</span> <span class="m">0</span><span class="o">,</span>
<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>
<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>
<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>
<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>
<span class="o">};</span>
<span class="o">}</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method end</span>
<span class="c"> * @description Ends the drag operation</span>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<span class="nx">end</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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">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>
<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>
<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>
<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>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _align</span>
<span class="c"> * @description Calculates the offsets and set&#39;s the XY that the element will move to.</span>
<span class="c"> * @param {Array} xy The xy coords to align with.</span>
<span class="c"> * @return Array</span>
<span class="c"> * @type {Array}</span>
<span class="c"> */</span>
<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>
<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>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _moveNode</span>
<span class="c"> * @description This method performs the actual element move.</span>
<span class="c"> * @param {Array} eXY The XY to move the element to, usually comes from the mousemove DOM event.</span>
<span class="c"> * @param {Boolean} noFire If true, the drag:drag event will not fire.</span>
<span class="c"> */</span>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">region</span> <span class="o">=</span> <span class="o">{</span>
<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>
<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>
<span class="nx">area</span><span class="o">:</span> <span class="m">0</span><span class="o">,</span>
<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>
<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>
<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>
<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>
<span class="o">};</span>
<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>
<span class="k">if</span> <span class="o">(!</span><span class="nx">noFire</span><span class="o">)</span> <span class="o">{</span>
<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>
<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>
<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>
<span class="nx">info</span><span class="o">:</span> <span class="o">{</span>
<span class="nx">start</span><span class="o">:</span> <span class="nx">startXY</span><span class="o">,</span>
<span class="nx">xy</span><span class="o">:</span> <span class="nx">xy</span><span class="o">,</span>
<span class="nx">delta</span><span class="o">:</span> <span class="nx">diffXY</span><span class="o">,</span>
<span class="nx">offset</span><span class="o">:</span> <span class="nx">diffXY2</span>
<span class="o">}</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="nx">xy</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method _move</span>
<span class="c"> * @description Fired from DragDropMgr (DDM) on mousemove.</span>
<span class="c"> * @param {Event} ev The mousemove DOM event</span>
<span class="c"> */</span>
<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>
<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>
<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>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<span class="k">this</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">_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>
<span class="o">}</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
<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>
<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>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method stopDrag</span>
<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>
<span class="c"> * @return {Self}</span>
<span class="c"> * @chainable</span>
<span class="c"> */</span>
<span class="nx">stopDrag</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<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>
<span class="nx">DDM</span><span class="o">.</span><span class="nx">_end</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">return</span> <span class="k">this</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @private</span>
<span class="c"> * @method destructor</span>
<span class="c"> * @description Lifecycle destructor, unreg the drag from the DDM and remove listeners</span>
<span class="c"> */</span>
<span class="nx">destructor</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<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>
<span class="k">this</span><span class="o">.</span><span class="nx">_unprep</span><span class="o">();</span>
<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>
<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>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">});</span>
<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>
<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>
</pre></div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_anim.html">anim</a></li>
<li class=""><a href="module_attribute.html">attribute</a></li>
<li class=""><a href="module_base.html">base</a></li>
<li class="selected"><a href="module_dd.html">dd</a></li>
<li class=""><a href="module_dd-plugin.html">dd-plugin</a></li>
<li class=""><a href="module_dump.html">dump</a></li>
<li class=""><a href="module_event.html">event</a></li>
<li class=""><a href="module_io.html">io</a></li>
<li class=""><a href="module_node.html">node</a></li>
<li class=""><a href="module_oop.html">oop</a></li>
<li class=""><a href="module_queue.html">queue</a></li>
<li class=""><a href="module_substitute.html">substitute</a></li>
<li class=""><a href="module_yui.html">yui</a></li>
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="DDM.html">DDM</a></li>
<li class=""><a href="Drag.html">Drag</a></li>
<li class=""><a href="DragConstained.html">DragConstained</a></li>
<li class=""><a href="Drop.html">Drop</a></li>
<li class=""><a href="Proxy.html">Proxy</a></li>
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="constrain.js.html">constrain.js</a></li>
<li class=""><a href="ddm-base.js.html">ddm-base.js</a></li>
<li class=""><a href="ddm-drop.js.html">ddm-drop.js</a></li>
<li class=""><a href="ddm.js.html">ddm.js</a></li>
<li class="selected"><a href="drag.js.html">drag.js</a></li>
<li class=""><a href="drop.js.html">drop.js</a></li>
<li class=""><a href="proxy.js.html">proxy.js</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright &copy; 2008 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>