1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <title>API: dragdrop DDProxy.js (YUI Library)
</title>
5 <link rel=
"stylesheet" type=
"text/css" href=
"assets/api.css">
9 <div id=
"doc3" class=
"yui-t2">
12 <h1>Yahoo! UI Library
</h1>
13 <h3>Drag and Drop
<span class=
"subtitle">2.2.0</span></h3>
15 <a href=
"./index.html">Yahoo! UI Library
</a>
16 > <a href=
"./module_dragdrop.html">dragdrop
</a>
18 > DDProxy.js (source view)
27 <div class=
"highlight" ><pre><span class=
"c">/**
</span>
28 <span class=
"c"> * A DragDrop implementation that inserts an empty, bordered div into
</span>
29 <span class=
"c"> * the document that follows the cursor during drag operations. At the time of
</span>
30 <span class=
"c"> * the click, the frame div is resized to the dimensions of the linked html
</span>
31 <span class=
"c"> * element, and moved to the exact location of the linked element.
</span>
32 <span class=
"c"> *
</span>
33 <span class=
"c"> * References to the
"frame
" element refer to the single proxy element that
</span>
34 <span class=
"c"> * was created to be dragged in place of all DDProxy elements on the
</span>
35 <span class=
"c"> * page.
</span>
36 <span class=
"c"> *
</span>
37 <span class=
"c"> * @class DDProxy
</span>
38 <span class=
"c"> * @extends YAHOO.util.DD
</span>
39 <span class=
"c"> * @constructor
</span>
40 <span class=
"c"> * @param {String} id the id of the linked html element
</span>
41 <span class=
"c"> * @param {String} sGroup the group of related DragDrop objects
</span>
42 <span class=
"c"> * @param {object} config an object containing configurable attributes
</span>
43 <span class=
"c"> * Valid properties for DDProxy in addition to those in DragDrop:
</span>
44 <span class=
"c"> * resizeFrame, centerFrame, dragElId
</span>
45 <span class=
"c"> */
</span>
46 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DDProxy
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">id
</span><span class=
"o">,
</span> <span class=
"nx">sGroup
</span><span class=
"o">,
</span> <span class=
"nx">config
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
47 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nx">id
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
48 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">init
</span><span class=
"o">(
</span><span class=
"nx">id
</span><span class=
"o">,
</span> <span class=
"nx">sGroup
</span><span class=
"o">,
</span> <span class=
"nx">config
</span><span class=
"o">);
</span>
49 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">initFrame
</span><span class=
"o">();
</span>
50 <span class=
"o">}
</span>
51 <span class=
"o">};
</span>
53 <span class=
"c">/**
</span>
54 <span class=
"c"> * The default drag frame div id
</span>
55 <span class=
"c"> * @property YAHOO.util.DDProxy.dragElId
</span>
56 <span class=
"c"> * @type String
</span>
57 <span class=
"c"> * @static
</span>
58 <span class=
"c"> */
</span>
59 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DDProxy
</span><span class=
"o">.
</span><span class=
"nx">dragElId
</span> <span class=
"o">=
</span> <span class=
"s2">"ygddfdiv
"</span><span class=
"o">;
</span>
61 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">extend
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DDProxy
</span><span class=
"o">,
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DD
</span><span class=
"o">,
</span> <span class=
"o">{
</span>
63 <span class=
"c">/**
</span>
64 <span class=
"c"> * By default we resize the drag frame to be the same size as the element
</span>
65 <span class=
"c"> * we want to drag (this is to get the frame effect). We can turn it off
</span>
66 <span class=
"c"> * if we want a different behavior.
</span>
67 <span class=
"c"> * @property resizeFrame
</span>
68 <span class=
"c"> * @type boolean
</span>
69 <span class=
"c"> */
</span>
70 <span class=
"nx">resizeFrame
</span><span class=
"o">:
</span> <span class=
"kc">true
</span><span class=
"o">,
</span>
72 <span class=
"c">/**
</span>
73 <span class=
"c"> * By default the frame is positioned exactly where the drag element is, so
</span>
74 <span class=
"c"> * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if
</span>
75 <span class=
"c"> * you do not have constraints on the obj is to have the drag frame centered
</span>
76 <span class=
"c"> * around the cursor. Set centerFrame to true for this effect.
</span>
77 <span class=
"c"> * @property centerFrame
</span>
78 <span class=
"c"> * @type boolean
</span>
79 <span class=
"c"> */
</span>
80 <span class=
"nx">centerFrame
</span><span class=
"o">:
</span> <span class=
"kc">false
</span><span class=
"o">,
</span>
82 <span class=
"c">/**
</span>
83 <span class=
"c"> * Creates the proxy element if it does not yet exist
</span>
84 <span class=
"c"> * @method createFrame
</span>
85 <span class=
"c"> */
</span>
86 <span class=
"nx">createFrame
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
87 <span class=
"k">var
</span> <span class=
"nx">self
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">;
</span>
88 <span class=
"k">var
</span> <span class=
"nx">body
</span> <span class=
"o">=
</span> <span class=
"nb">document
</span><span class=
"o">.
</span><span class=
"nx">body
</span><span class=
"o">;
</span>
90 <span class=
"k">if
</span> <span class=
"o">(!
</span><span class=
"nx">body
</span> <span class=
"o">||
</span> <span class=
"o">!
</span><span class=
"nx">body
</span><span class=
"o">.
</span><span class=
"nx">firstChild
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
91 <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">createFrame
</span><span class=
"o">();
</span> <span class=
"o">},
</span> <span class=
"m">50</span> <span class=
"o">);
</span>
92 <span class=
"k">return
</span><span class=
"o">;
</span>
93 <span class=
"o">}
</span>
95 <span class=
"k">var
</span> <span class=
"nx">div
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">();
</span>
97 <span class=
"k">if
</span> <span class=
"o">(!
</span><span class=
"nx">div
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
98 <span class=
"nx">div
</span> <span class=
"o">=
</span> <span class=
"nb">document
</span><span class=
"o">.
</span><span class=
"nx">createElement
</span><span class=
"o">(
</span><span class=
"s2">"div
"</span><span class=
"o">);
</span>
99 <span class=
"nx">div
</span><span class=
"o">.
</span><span class=
"nx">id
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">dragElId
</span><span class=
"o">;
</span>
100 <span class=
"k">var
</span> <span class=
"nx">s
</span> <span class=
"o">=
</span> <span class=
"nx">div
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">;
</span>
102 <span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">position
</span> <span class=
"o">=
</span> <span class=
"s2">"absolute
"</span><span class=
"o">;
</span>
103 <span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">visibility
</span> <span class=
"o">=
</span> <span class=
"s2">"hidden
"</span><span class=
"o">;
</span>
104 <span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">cursor
</span> <span class=
"o">=
</span> <span class=
"s2">"move
"</span><span class=
"o">;
</span>
105 <span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">border
</span> <span class=
"o">=
</span> <span class=
"s2">"2px solid #aaa
"</span><span class=
"o">;
</span>
106 <span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">zIndex
</span> <span class=
"o">=
</span> <span class=
"m">999</span><span class=
"o">;
</span>
108 <span class=
"c">// appendChild can blow up IE if invoked prior to the window load event
</span>
109 <span class=
"c"></span> <span class=
"c">// while rendering a table. It is possible there are other scenarios
</span>
110 <span class=
"c"></span> <span class=
"c">// that would cause this to happen as well.
</span>
111 <span class=
"c"></span> <span class=
"nx">body
</span><span class=
"o">.
</span><span class=
"nx">insertBefore
</span><span class=
"o">(
</span><span class=
"nx">div
</span><span class=
"o">,
</span> <span class=
"nx">body
</span><span class=
"o">.
</span><span class=
"nx">firstChild
</span><span class=
"o">);
</span>
112 <span class=
"o">}
</span>
113 <span class=
"o">},
</span>
115 <span class=
"c">/**
</span>
116 <span class=
"c"> * Initialization for the drag frame element. Must be called in the
</span>
117 <span class=
"c"> * constructor of all subclasses
</span>
118 <span class=
"c"> * @method initFrame
</span>
119 <span class=
"c"> */
</span>
120 <span class=
"nx">initFrame
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
121 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">createFrame
</span><span class=
"o">();
</span>
122 <span class=
"o">},
</span>
124 <span class=
"nx">applyConfig
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
125 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">logger
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"DDProxy applyConfig
"</span><span class=
"o">);
</span>
126 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DDProxy
</span><span class=
"o">.
</span><span class=
"nx">superclass
</span><span class=
"o">.
</span><span class=
"nx">applyConfig
</span><span class=
"o">.
</span><span class=
"nx">call
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">);
</span>
128 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">resizeFrame
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">config
</span><span class=
"o">.
</span><span class=
"nx">resizeFrame
</span> <span class=
"o">!==
</span> <span class=
"kc">false
</span><span class=
"o">);
</span>
129 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">centerFrame
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">config
</span><span class=
"o">.
</span><span class=
"nx">centerFrame
</span><span class=
"o">);
</span>
130 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setDragElId
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">config
</span><span class=
"o">.
</span><span class=
"nx">dragElId
</span> <span class=
"o">||
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DDProxy
</span><span class=
"o">.
</span><span class=
"nx">dragElId
</span><span class=
"o">);
</span>
131 <span class=
"o">},
</span>
133 <span class=
"c">/**
</span>
134 <span class=
"c"> * Resizes the drag frame to the dimensions of the clicked object, positions
</span>
135 <span class=
"c"> * it over the object, and finally displays it
</span>
136 <span class=
"c"> * @method showFrame
</span>
137 <span class=
"c"> * @param {int} iPageX X click position
</span>
138 <span class=
"c"> * @param {int} iPageY Y click position
</span>
139 <span class=
"c"> * @private
</span>
140 <span class=
"c"> */
</span>
141 <span class=
"nx">showFrame
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">iPageX
</span><span class=
"o">,
</span> <span class=
"nx">iPageY
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
142 <span class=
"k">var
</span> <span class=
"nx">el
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getEl
</span><span class=
"o">();
</span>
143 <span class=
"k">var
</span> <span class=
"nx">dragEl
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">();
</span>
144 <span class=
"k">var
</span> <span class=
"nx">s
</span> <span class=
"o">=
</span> <span class=
"nx">dragEl
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">;
</span>
146 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_resizeProxy
</span><span class=
"o">();
</span>
148 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">centerFrame
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
149 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setDelta
</span><span class=
"o">(
</span> <span class=
"nb">Math
</span><span class=
"o">.
</span><span class=
"nx">round
</span><span class=
"o">(
</span><span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">width
</span><span class=
"o">,
</span> <span class=
"m">10</span><span class=
"o">)/
</span><span class=
"m">2</span><span class=
"o">),
</span>
150 <span class=
"nb">Math
</span><span class=
"o">.
</span><span class=
"nx">round
</span><span class=
"o">(
</span><span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">s
</span><span class=
"o">.
</span><span class=
"nx">height
</span><span class=
"o">,
</span> <span class=
"m">10</span><span class=
"o">)/
</span><span class=
"m">2</span><span class=
"o">)
</span> <span class=
"o">);
</span>
151 <span class=
"o">}
</span>
153 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setDragElPos
</span><span class=
"o">(
</span><span class=
"nx">iPageX
</span><span class=
"o">,
</span> <span class=
"nx">iPageY
</span><span class=
"o">);
</span>
155 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span><span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"visibility
"</span><span class=
"o">,
</span> <span class=
"s2">"visible
"</span><span class=
"o">);
</span>
156 <span class=
"o">},
</span>
158 <span class=
"c">/**
</span>
159 <span class=
"c"> * The proxy is automatically resized to the dimensions of the linked
</span>
160 <span class=
"c"> * element when a drag is initiated, unless resizeFrame is set to false
</span>
161 <span class=
"c"> * @method _resizeProxy
</span>
162 <span class=
"c"> * @private
</span>
163 <span class=
"c"> */
</span>
164 <span class=
"nx">_resizeProxy
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
165 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">resizeFrame
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
166 <span class=
"k">var
</span> <span class=
"nx">DOM
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">;
</span>
167 <span class=
"k">var
</span> <span class=
"nx">el
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getEl
</span><span class=
"o">();
</span>
168 <span class=
"k">var
</span> <span class=
"nx">dragEl
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">();
</span>
170 <span class=
"k">var
</span> <span class=
"nx">bt
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">getStyle
</span><span class=
"o">(
</span><span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"borderTopWidth
"</span> <span class=
"o">),
</span> <span class=
"m">10</span><span class=
"o">);
</span>
171 <span class=
"k">var
</span> <span class=
"nx">br
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">getStyle
</span><span class=
"o">(
</span><span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"borderRightWidth
"</span> <span class=
"o">),
</span> <span class=
"m">10</span><span class=
"o">);
</span>
172 <span class=
"k">var
</span> <span class=
"nx">bb
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">getStyle
</span><span class=
"o">(
</span><span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"borderBottomWidth
"</span> <span class=
"o">),
</span> <span class=
"m">10</span><span class=
"o">);
</span>
173 <span class=
"k">var
</span> <span class=
"nx">bl
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">getStyle
</span><span class=
"o">(
</span><span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"borderLeftWidth
"</span> <span class=
"o">),
</span> <span class=
"m">10</span><span class=
"o">);
</span>
175 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nb">isNaN
</span><span class=
"o">(
</span><span class=
"nx">bt
</span><span class=
"o">))
</span> <span class=
"o">{
</span> <span class=
"nx">bt
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span> <span class=
"o">}
</span>
176 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nb">isNaN
</span><span class=
"o">(
</span><span class=
"nx">br
</span><span class=
"o">))
</span> <span class=
"o">{
</span> <span class=
"nx">br
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span> <span class=
"o">}
</span>
177 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nb">isNaN
</span><span class=
"o">(
</span><span class=
"nx">bb
</span><span class=
"o">))
</span> <span class=
"o">{
</span> <span class=
"nx">bb
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span> <span class=
"o">}
</span>
178 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nb">isNaN
</span><span class=
"o">(
</span><span class=
"nx">bl
</span><span class=
"o">))
</span> <span class=
"o">{
</span> <span class=
"nx">bl
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span> <span class=
"o">}
</span>
180 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">logger
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"proxy size:
"</span> <span class=
"o">+
</span> <span class=
"nx">bt
</span> <span class=
"o">+
</span> <span class=
"s2">" "</span> <span class=
"o">+
</span> <span class=
"nx">br
</span> <span class=
"o">+
</span> <span class=
"s2">" "</span> <span class=
"o">+
</span> <span class=
"nx">bb
</span> <span class=
"o">+
</span> <span class=
"s2">" "</span> <span class=
"o">+
</span> <span class=
"nx">bl
</span><span class=
"o">);
</span>
182 <span class=
"k">var
</span> <span class=
"nx">newWidth
</span> <span class=
"o">=
</span> <span class=
"nb">Math
</span><span class=
"o">.
</span><span class=
"nx">max
</span><span class=
"o">(
</span><span class=
"m">0</span><span class=
"o">,
</span> <span class=
"nx">el
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span> <span class=
"o">-
</span> <span class=
"nx">br
</span> <span class=
"o">-
</span> <span class=
"nx">bl
</span><span class=
"o">);
</span>
183 <span class=
"k">var
</span> <span class=
"nx">newHeight
</span> <span class=
"o">=
</span> <span class=
"nb">Math
</span><span class=
"o">.
</span><span class=
"nx">max
</span><span class=
"o">(
</span><span class=
"m">0</span><span class=
"o">,
</span> <span class=
"nx">el
</span><span class=
"o">.
</span><span class=
"nx">offsetHeight
</span> <span class=
"o">-
</span> <span class=
"nx">bt
</span> <span class=
"o">-
</span> <span class=
"nx">bb
</span><span class=
"o">);
</span>
185 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">logger
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"Resizing proxy element
"</span><span class=
"o">);
</span>
187 <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span> <span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"width
"</span><span class=
"o">,
</span> <span class=
"nx">newWidth
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span> <span class=
"o">);
</span>
188 <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span> <span class=
"nx">dragEl
</span><span class=
"o">,
</span> <span class=
"s2">"height
"</span><span class=
"o">,
</span> <span class=
"nx">newHeight
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span> <span class=
"o">);
</span>
189 <span class=
"o">}
</span>
190 <span class=
"o">},
</span>
192 <span class=
"c">// overrides YAHOO.util.DragDrop
</span>
193 <span class=
"c"></span> <span class=
"nx">b4MouseDown
</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>
194 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setStartPosition
</span><span class=
"o">();
</span>
195 <span class=
"k">var
</span> <span class=
"nx">x
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Event
</span><span class=
"o">.
</span><span class=
"nx">getPageX
</span><span class=
"o">(
</span><span class=
"nx">e
</span><span class=
"o">);
</span>
196 <span class=
"k">var
</span> <span class=
"nx">y
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Event
</span><span class=
"o">.
</span><span class=
"nx">getPageY
</span><span class=
"o">(
</span><span class=
"nx">e
</span><span class=
"o">);
</span>
197 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">autoOffset
</span><span class=
"o">(
</span><span class=
"nx">x
</span><span class=
"o">,
</span> <span class=
"nx">y
</span><span class=
"o">);
</span>
198 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setDragElPos
</span><span class=
"o">(
</span><span class=
"nx">x
</span><span class=
"o">,
</span> <span class=
"nx">y
</span><span class=
"o">);
</span>
199 <span class=
"o">},
</span>
201 <span class=
"c">// overrides YAHOO.util.DragDrop
</span>
202 <span class=
"c"></span> <span class=
"nx">b4StartDrag
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">x
</span><span class=
"o">,
</span> <span class=
"nx">y
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
203 <span class=
"c">// show the drag frame
</span>
204 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">logger
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"start drag show frame, x:
"</span> <span class=
"o">+
</span> <span class=
"nx">x
</span> <span class=
"o">+
</span> <span class=
"s2">", y:
"</span> <span class=
"o">+
</span> <span class=
"nx">y
</span><span class=
"o">);
</span>
205 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">showFrame
</span><span class=
"o">(
</span><span class=
"nx">x
</span><span class=
"o">,
</span> <span class=
"nx">y
</span><span class=
"o">);
</span>
206 <span class=
"o">},
</span>
208 <span class=
"c">// overrides YAHOO.util.DragDrop
</span>
209 <span class=
"c"></span> <span class=
"nx">b4EndDrag
</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>
210 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">logger
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">id
</span> <span class=
"o">+
</span> <span class=
"s2">" b4EndDrag
"</span><span class=
"o">);
</span>
211 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">(),
</span> <span class=
"s2">"visibility
"</span><span class=
"o">,
</span> <span class=
"s2">"hidden
"</span><span class=
"o">);
</span>
212 <span class=
"o">},
</span>
214 <span class=
"c">// overrides YAHOO.util.DragDrop
</span>
215 <span class=
"c"></span> <span class=
"c">// By default we try to move the element to the last location of the frame.
</span>
216 <span class=
"c"></span> <span class=
"c">// This is so that the default behavior mirrors that of YAHOO.util.DD.
</span>
217 <span class=
"c"></span> <span class=
"nx">endDrag
</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>
218 <span class=
"k">var
</span> <span class=
"nx">DOM
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">;
</span>
219 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">logger
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">id
</span> <span class=
"o">+
</span> <span class=
"s2">" endDrag
"</span><span class=
"o">);
</span>
220 <span class=
"k">var
</span> <span class=
"nx">lel
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getEl
</span><span class=
"o">();
</span>
221 <span class=
"k">var
</span> <span class=
"nx">del
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">();
</span>
223 <span class=
"c">// Show the drag frame briefly so we can get its position
</span>
224 <span class=
"c"></span> <span class=
"c">// del.style.visibility =
"";
</span>
225 <span class=
"c"></span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span><span class=
"nx">del
</span><span class=
"o">,
</span> <span class=
"s2">"visibility
"</span><span class=
"o">,
</span> <span class=
"s2">""</span><span class=
"o">);
</span>
227 <span class=
"c">// Hide the linked element before the move to get around a Safari
</span>
228 <span class=
"c"></span> <span class=
"c">// rendering bug.
</span>
229 <span class=
"c"></span> <span class=
"c">//lel.style.visibility =
"hidden
";
</span>
230 <span class=
"c"></span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span><span class=
"nx">lel
</span><span class=
"o">,
</span> <span class=
"s2">"visibility
"</span><span class=
"o">,
</span> <span class=
"s2">"hidden
"</span><span class=
"o">);
</span>
231 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DDM
</span><span class=
"o">.
</span><span class=
"nx">moveToEl
</span><span class=
"o">(
</span><span class=
"nx">lel
</span><span class=
"o">,
</span> <span class=
"nx">del
</span><span class=
"o">);
</span>
232 <span class=
"c">//del.style.visibility =
"hidden
";
</span>
233 <span class=
"c"></span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span><span class=
"nx">del
</span><span class=
"o">,
</span> <span class=
"s2">"visibility
"</span><span class=
"o">,
</span> <span class=
"s2">"hidden
"</span><span class=
"o">);
</span>
234 <span class=
"c">//lel.style.visibility =
"";
</span>
235 <span class=
"c"></span> <span class=
"nx">DOM
</span><span class=
"o">.
</span><span class=
"nx">setStyle
</span><span class=
"o">(
</span><span class=
"nx">lel
</span><span class=
"o">,
</span> <span class=
"s2">"visibility
"</span><span class=
"o">,
</span> <span class=
"s2">""</span><span class=
"o">);
</span>
236 <span class=
"o">},
</span>
238 <span class=
"nx">toString
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
239 <span class=
"k">return
</span> <span class=
"o">(
</span><span class=
"s2">"DDProxy
"</span> <span class=
"o">+
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">id
</span><span class=
"o">);
</span>
240 <span class=
"o">}
</span>
242 <span class=
"o">});
</span>
254 <li class=
""><a href=
"module_animation.html">animation
</a></li>
256 <li class=
""><a href=
"module_autocomplete.html">autocomplete
</a></li>
258 <li class=
""><a href=
"module_button.html">button
</a></li>
260 <li class=
""><a href=
"module_calendar.html">calendar
</a></li>
262 <li class=
""><a href=
"module_connection.html">connection
</a></li>
264 <li class=
""><a href=
"module_container.html">container
</a></li>
266 <li class=
""><a href=
"module_datasource.html">datasource
</a></li>
268 <li class=
""><a href=
"module_datatable.html">datatable
</a></li>
270 <li class=
""><a href=
"module_dom.html">dom
</a></li>
272 <li class=
"selected"><a href=
"module_dragdrop.html">dragdrop
</a></li>
274 <li class=
""><a href=
"module_element.html">element
</a></li>
276 <li class=
""><a href=
"module_event.html">event
</a></li>
278 <li class=
""><a href=
"module_history.html">history
</a></li>
280 <li class=
""><a href=
"module_logger.html">logger
</a></li>
282 <li class=
""><a href=
"module_menu.html">menu
</a></li>
284 <li class=
""><a href=
"module_slider.html">slider
</a></li>
286 <li class=
""><a href=
"module_tabview.html">tabview
</a></li>
288 <li class=
""><a href=
"module_treeview.html">treeview
</a></li>
290 <li class=
""><a href=
"module_yahoo.html">yahoo
</a></li>
297 <li class=
""><a href=
"YAHOO.util.DD.html">YAHOO.util.DD
</a></li>
298 <li class=
""><a href=
"YAHOO.util.DDProxy.html">YAHOO.util.DDProxy
</a></li>
299 <li class=
""><a href=
"YAHOO.util.DDTarget.html">YAHOO.util.DDTarget
</a></li>
300 <li class=
""><a href=
"YAHOO.util.DragDrop.html">YAHOO.util.DragDrop
</a></li>
301 <li class=
""><a href=
"YAHOO.util.DragDropMgr.html">YAHOO.util.DragDropMgr
</a></li>
302 <li class=
""><a href=
"YAHOO.util.DragDropMgr.ElementWrapper.html">YAHOO.util.DragDropMgr.ElementWrapper
</a></li>
309 <li class=
""><a href=
"DD.js.html">DD.js
</a></li>
310 <li class=
"selected"><a href=
"DDProxy.js.html">DDProxy.js
</a></li>
311 <li class=
""><a href=
"DDTarget.js.html">DDTarget.js
</a></li>
312 <li class=
""><a href=
"DragDrop.js.html">DragDrop.js
</a></li>
313 <li class=
""><a href=
"DragDropMgr.js.html">DragDropMgr.js
</a></li>
326 Copyright
© 2007 Yahoo! Inc. All rights reserved.