annotate pylons_app/public/js/yui/resize/resize-debug.js @ 457:644795a4e8d2

Code cleanups, made js rollup file, some preparation for .egg creation
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 04 Sep 2010 15:20:06 +0200
parents 564e40829f80
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1 /*
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
3 Code licensed under the BSD License:
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
4 http://developer.yahoo.net/yui/license.txt
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
5 version: 2.8.0r4
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
6 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
7 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
8 * @description <p>Makes an element resizable</p>
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
9 * @namespace YAHOO.util
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
10 * @requires yahoo, dom, dragdrop, element, event
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
11 * @optional animation
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
12 * @module resize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
13 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
14 (function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
15 var D = YAHOO.util.Dom,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
16 Event = YAHOO.util.Event,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
17 Lang = YAHOO.lang;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
18
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
19 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
20 * @constructor
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
21 * @class Resize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
22 * @extends YAHOO.util.Element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
23 * @description <p>Makes an element resizable</p>
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
24 * @param {String/HTMLElement} el The element to make resizable.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
25 * @param {Object} attrs Object liternal containing configuration parameters.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
26 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
27
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
28 var Resize = function(el, config) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
29 YAHOO.log('Creating Resize Object', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
30 var oConfig = {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
31 element: el,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
32 attributes: config || {}
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
33 };
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
34
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
35 Resize.superclass.constructor.call(this, oConfig.element, oConfig.attributes);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
36 };
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
37
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
38 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
39 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
40 * @static
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
41 * @property _instances
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
42 * @description Internal hash table for all resize instances
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
43 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
44 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
45 Resize._instances = {};
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
46 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
47 * @static
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
48 * @method getResizeById
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
49 * @description Get's a resize object by the HTML id of the element associated with the Resize object.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
50 * @return {Object} The Resize Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
51 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
52 Resize.getResizeById = function(id) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
53 if (Resize._instances[id]) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
54 return Resize._instances[id];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
55 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
56 YAHOO.log('No Instance Found', 'error', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
57 return false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
58 };
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
59
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
60 YAHOO.extend(Resize, YAHOO.util.Element, {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
61 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
62 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
63 * @property CSS_RESIZE
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
64 * @description Base CSS class name
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
65 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
66 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
67 CSS_RESIZE: 'yui-resize',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
68 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
69 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
70 * @property CSS_DRAG
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
71 * @description Class name added when dragging is enabled
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
72 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
73 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
74 CSS_DRAG: 'yui-draggable',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
75 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
76 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
77 * @property CSS_HOVER
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
78 * @description Class name used for hover only handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
79 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
80 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
81 CSS_HOVER: 'yui-resize-hover',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
82 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
83 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
84 * @property CSS_PROXY
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
85 * @description Class name given to the proxy element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
86 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
87 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
88 CSS_PROXY: 'yui-resize-proxy',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
89 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
90 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
91 * @property CSS_WRAP
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
92 * @description Class name given to the wrap element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
93 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
94 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
95 CSS_WRAP: 'yui-resize-wrap',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
96 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
97 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
98 * @property CSS_KNOB
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
99 * @description Class name used to make the knob style handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
100 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
101 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
102 CSS_KNOB: 'yui-resize-knob',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
103 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
104 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
105 * @property CSS_HIDDEN
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
106 * @description Class name given to the wrap element to make all handles hidden
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
107 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
108 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
109 CSS_HIDDEN: 'yui-resize-hidden',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
110 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
111 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
112 * @property CSS_HANDLE
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
113 * @description Class name given to all handles, used as a base for single handle names as well.. Handle "t" will get this.CSS_HANDLE + '-t' as well as this.CSS_HANDLE
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
114 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
115 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
116 CSS_HANDLE: 'yui-resize-handle',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
117 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
118 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
119 * @property CSS_STATUS
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
120 * @description Class name given to the status element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
121 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
122 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
123 CSS_STATUS: 'yui-resize-status',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
124 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
125 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
126 * @property CSS_GHOST
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
127 * @description Class name given to the wrap element when the ghost property is active
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
128 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
129 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
130 CSS_GHOST: 'yui-resize-ghost',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
131 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
132 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
133 * @property CSS_RESIZING
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
134 * @description Class name given to the wrap element when a resize action is taking place.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
135 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
136 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
137 CSS_RESIZING: 'yui-resize-resizing',
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
138 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
139 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
140 * @property _resizeEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
141 * @description The mouse event used to resize with
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
142 * @type Event
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
143 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
144 _resizeEvent: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
145 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
146 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
147 * @property dd
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
148 * @description The <a href="YAHOO.util.DragDrop.html">YAHOO.util.DragDrop</a> instance used if draggable is true
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
149 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
150 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
151 dd: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
152 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
153 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
154 * @property browser
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
155 * @description A copy of the YAHOO.env.ua property
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
156 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
157 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
158 browser: YAHOO.env.ua,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
159 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
160 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
161 * @property _locked
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
162 * @description A flag to show if the resize is locked
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
163 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
164 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
165 _locked: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
166 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
167 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
168 * @property _positioned
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
169 * @description A flag to show if the element is absolutely positioned
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
170 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
171 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
172 _positioned: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
173 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
174 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
175 * @property _dds
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
176 * @description An Object containing references to all of the <a href="YAHOO.util.DragDrop.html">YAHOO.util.DragDrop</a> instances used for the resize handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
177 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
178 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
179 _dds: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
180 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
181 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
182 * @property _wrap
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
183 * @description The HTML reference of the element wrapper
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
184 * @type HTMLElement
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
185 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
186 _wrap: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
187 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
188 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
189 * @property _proxy
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
190 * @description The HTML reference of the element proxy
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
191 * @type HTMLElement
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
192 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
193 _proxy: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
194 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
195 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
196 * @property _handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
197 * @description An object containing references to all of the resize handles.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
198 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
199 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
200 _handles: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
201 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
202 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
203 * @property _currentHandle
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
204 * @description The string identifier of the currently active handle. e.g. 'r', 'br', 'tl'
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
205 * @type String
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
206 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
207 _currentHandle: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
208 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
209 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
210 * @property _currentDD
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
211 * @description A link to the currently active DD object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
212 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
213 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
214 _currentDD: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
215 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
216 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
217 * @property _cache
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
218 * @description An lookup table containing key information for the element being resized. e.g. height, width, x position, y position, etc..
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
219 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
220 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
221 _cache: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
222 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
223 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
224 * @property _active
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
225 * @description Flag to show if the resize is active. Used for events.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
226 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
227 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
228 _active: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
229 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
230 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
231 * @method _createProxy
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
232 * @description Creates the proxy element if the proxy config is true
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
233 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
234 _createProxy: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
235 if (this.get('proxy')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
236 YAHOO.log('Creating the Proxy Element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
237 this._proxy = document.createElement('div');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
238 this._proxy.className = this.CSS_PROXY;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
239 this._proxy.style.height = this.get('element').clientHeight + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
240 this._proxy.style.width = this.get('element').clientWidth + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
241 this._wrap.parentNode.appendChild(this._proxy);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
242 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
243 YAHOO.log('No proxy element, turn off animate config option', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
244 this.set('animate', false);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
245 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
246 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
247 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
248 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
249 * @method _createWrap
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
250 * @description Creates the wrap element if the wrap config is true. It will auto wrap the following element types: img, textarea, input, iframe, select
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
251 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
252 _createWrap: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
253 YAHOO.log('Create the wrap element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
254 this._positioned = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
255 //Force wrap for elements that can't have children
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
256 if (this.get('wrap') === false) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
257 switch (this.get('element').tagName.toLowerCase()) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
258 case 'img':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
259 case 'textarea':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
260 case 'input':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
261 case 'iframe':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
262 case 'select':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
263 YAHOO.log('Auto-wrapping the element (' + this.get('element').tagName.toLowerCase() + ')', 'warn', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
264 this.set('wrap', true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
265 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
266 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
267 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
268 if (this.get('wrap') === true) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
269 YAHOO.log('Creating the wrap element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
270 this._wrap = document.createElement('div');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
271 this._wrap.id = this.get('element').id + '_wrap';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
272 this._wrap.className = this.CSS_WRAP;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
273 if (this.get('element').tagName.toLowerCase() == 'textarea') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
274 D.addClass(this._wrap, 'yui-resize-textarea');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
275 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
276 D.setStyle(this._wrap, 'width', this.get('width') + 'px');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
277 D.setStyle(this._wrap, 'height', this.get('height') + 'px');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
278 D.setStyle(this._wrap, 'z-index', this.getStyle('z-index'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
279 this.setStyle('z-index', 0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
280 var pos = D.getStyle(this.get('element'), 'position');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
281 D.setStyle(this._wrap, 'position', ((pos == 'static') ? 'relative' : pos));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
282 D.setStyle(this._wrap, 'top', D.getStyle(this.get('element'), 'top'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
283 D.setStyle(this._wrap, 'left', D.getStyle(this.get('element'), 'left'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
284 if (D.getStyle(this.get('element'), 'position') == 'absolute') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
285 this._positioned = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
286 YAHOO.log('The element is positioned absolute', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
287 D.setStyle(this.get('element'), 'position', 'relative');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
288 D.setStyle(this.get('element'), 'top', '0');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
289 D.setStyle(this.get('element'), 'left', '0');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
290 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
291 var par = this.get('element').parentNode;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
292 par.replaceChild(this._wrap, this.get('element'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
293 this._wrap.appendChild(this.get('element'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
294 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
295 this._wrap = this.get('element');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
296 if (D.getStyle(this._wrap, 'position') == 'absolute') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
297 this._positioned = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
298 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
299 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
300 if (this.get('draggable')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
301 this._setupDragDrop();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
302 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
303 if (this.get('hover')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
304 D.addClass(this._wrap, this.CSS_HOVER);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
305 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
306 if (this.get('knobHandles')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
307 D.addClass(this._wrap, this.CSS_KNOB);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
308 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
309 if (this.get('hiddenHandles')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
310 D.addClass(this._wrap, this.CSS_HIDDEN);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
311 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
312 D.addClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
313 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
314 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
315 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
316 * @method _setupDragDrop
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
317 * @description Setup the <a href="YAHOO.util.DragDrop.html">YAHOO.util.DragDrop</a> instance on the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
318 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
319 _setupDragDrop: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
320 YAHOO.log('Setting up the dragdrop instance on the element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
321 D.addClass(this._wrap, this.CSS_DRAG);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
322 this.dd = new YAHOO.util.DD(this._wrap, this.get('id') + '-resize', { dragOnly: true, useShim: this.get('useShim') });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
323 this.dd.on('dragEvent', function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
324 this.fireEvent('dragEvent', arguments);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
325 }, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
326 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
327 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
328 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
329 * @method _createHandles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
330 * @description Creates the handles as specified in the config
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
331 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
332 _createHandles: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
333 YAHOO.log('Creating the handles', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
334 this._handles = {};
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
335 this._dds = {};
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
336 var h = this.get('handles');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
337 for (var i = 0; i < h.length; i++) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
338 YAHOO.log('Creating handle position: ' + h[i], 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
339 this._handles[h[i]] = document.createElement('div');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
340 this._handles[h[i]].id = D.generateId(this._handles[h[i]]);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
341 this._handles[h[i]].className = this.CSS_HANDLE + ' ' + this.CSS_HANDLE + '-' + h[i];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
342 var k = document.createElement('div');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
343 k.className = this.CSS_HANDLE + '-inner-' + h[i];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
344 this._handles[h[i]].appendChild(k);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
345 this._wrap.appendChild(this._handles[h[i]]);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
346 Event.on(this._handles[h[i]], 'mouseover', this._handleMouseOver, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
347 Event.on(this._handles[h[i]], 'mouseout', this._handleMouseOut, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
348 this._dds[h[i]] = new YAHOO.util.DragDrop(this._handles[h[i]], this.get('id') + '-handle-' + h, { useShim: this.get('useShim') });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
349 this._dds[h[i]].setPadding(15, 15, 15, 15);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
350 this._dds[h[i]].on('startDragEvent', this._handleStartDrag, this._dds[h[i]], this);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
351 this._dds[h[i]].on('mouseDownEvent', this._handleMouseDown, this._dds[h[i]], this);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
352 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
353 YAHOO.log('Creating the Status box', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
354 this._status = document.createElement('span');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
355 this._status.className = this.CSS_STATUS;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
356 document.body.insertBefore(this._status, document.body.firstChild);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
357 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
358 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
359 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
360 * @method _ieSelectFix
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
361 * @description The function we use as the onselectstart handler when we start a drag in Internet Explorer
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
362 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
363 _ieSelectFix: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
364 return false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
365 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
366 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
367 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
368 * @property _ieSelectBack
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
369 * @description We will hold a copy of the current "onselectstart" method on this property, and reset it after we are done using it.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
370 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
371 _ieSelectBack: null,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
372 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
373 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
374 * @method _setAutoRatio
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
375 * @param {Event} ev A mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
376 * @description This method checks to see if the "autoRatio" config is set. If it is, we will check to see if the "Shift Key" is pressed. If so, we will set the config ratio to true.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
377 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
378 _setAutoRatio: function(ev) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
379 if (this.get('autoRatio')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
380 YAHOO.log('Setting up AutoRatio', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
381 if (ev && ev.shiftKey) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
382 //Shift Pressed
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
383 YAHOO.log('Shift key presses, turning on ratio', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
384 this.set('ratio', true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
385 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
386 YAHOO.log('Resetting ratio back to default', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
387 this.set('ratio', this._configs.ratio._initialConfig.value);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
388 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
389 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
390 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
391 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
392 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
393 * @method _handleMouseDown
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
394 * @param {Event} ev A mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
395 * @description This method preps the autoRatio on MouseDown.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
396 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
397 _handleMouseDown: function(ev) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
398 if (this._locked) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
399 YAHOO.log('Resize Locked', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
400 return false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
401 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
402 if (D.getStyle(this._wrap, 'position') == 'absolute') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
403 this._positioned = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
404 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
405 if (ev) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
406 this._setAutoRatio(ev);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
407 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
408 if (this.browser.ie) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
409 this._ieSelectBack = document.body.onselectstart;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
410 document.body.onselectstart = this._ieSelectFix;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
411 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
412 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
413 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
414 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
415 * @method _handleMouseOver
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
416 * @param {Event} ev A mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
417 * @description Adds CSS class names to the handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
418 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
419 _handleMouseOver: function(ev) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
420 if (this._locked) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
421 YAHOO.log('Resize Locked', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
422 return false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
423 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
424 D.removeClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
425
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
426 if (this.get('hover')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
427 D.removeClass(this._wrap, this.CSS_HOVER);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
428 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
429 var tar = Event.getTarget(ev);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
430 if (!D.hasClass(tar, this.CSS_HANDLE)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
431 tar = tar.parentNode;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
432 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
433 if (D.hasClass(tar, this.CSS_HANDLE) && !this._active) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
434 D.addClass(tar, this.CSS_HANDLE + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
435 for (var i in this._handles) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
436 if (Lang.hasOwnProperty(this._handles, i)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
437 if (this._handles[i] == tar) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
438 D.addClass(tar, this.CSS_HANDLE + '-' + i + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
439 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
440 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
441 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
442 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
443 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
444
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
445 D.addClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
446 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
447 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
448 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
449 * @method _handleMouseOut
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
450 * @param {Event} ev A mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
451 * @description Removes CSS class names to the handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
452 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
453 _handleMouseOut: function(ev) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
454 D.removeClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
455 if (this.get('hover') && !this._active) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
456 D.addClass(this._wrap, this.CSS_HOVER);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
457 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
458 var tar = Event.getTarget(ev);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
459 if (!D.hasClass(tar, this.CSS_HANDLE)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
460 tar = tar.parentNode;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
461 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
462 if (D.hasClass(tar, this.CSS_HANDLE) && !this._active) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
463 D.removeClass(tar, this.CSS_HANDLE + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
464 for (var i in this._handles) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
465 if (Lang.hasOwnProperty(this._handles, i)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
466 if (this._handles[i] == tar) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
467 D.removeClass(tar, this.CSS_HANDLE + '-' + i + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
468 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
469 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
470 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
471 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
472 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
473 D.addClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
474 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
475 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
476 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
477 * @method _handleStartDrag
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
478 * @param {Object} args The args passed from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
479 * @param {Object} dd The <a href="YAHOO.util.DragDrop.html">YAHOO.util.DragDrop</a> object we are working with.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
480 * @description Resizes the proxy, sets up the <a href="YAHOO.util.DragDrop.html">YAHOO.util.DragDrop</a> handlers, updates the status div and preps the cache
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
481 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
482 _handleStartDrag: function(args, dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
483 YAHOO.log('startDrag', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
484 var tar = dd.getDragEl();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
485 if (D.hasClass(tar, this.CSS_HANDLE)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
486 if (D.getStyle(this._wrap, 'position') == 'absolute') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
487 this._positioned = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
488 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
489 this._active = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
490 this._currentDD = dd;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
491 if (this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
492 YAHOO.log('Activate proxy element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
493 this._proxy.style.visibility = 'visible';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
494 this._proxy.style.zIndex = '1000';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
495 this._proxy.style.height = this.get('element').clientHeight + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
496 this._proxy.style.width = this.get('element').clientWidth + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
497 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
498
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
499 for (var i in this._handles) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
500 if (Lang.hasOwnProperty(this._handles, i)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
501 if (this._handles[i] == tar) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
502 this._currentHandle = i;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
503 var handle = '_handle_for_' + i;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
504 D.addClass(tar, this.CSS_HANDLE + '-' + i + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
505 dd.on('dragEvent', this[handle], this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
506 dd.on('mouseUpEvent', this._handleMouseUp, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
507 YAHOO.log('Adding DragEvents to: ' + i, 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
508 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
509 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
510 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
511 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
512
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
513
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
514 D.addClass(tar, this.CSS_HANDLE + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
515
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
516 if (this.get('proxy')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
517 YAHOO.log('Posiiton Proxy Element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
518 var xy = D.getXY(this.get('element'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
519 D.setXY(this._proxy, xy);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
520 if (this.get('ghost')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
521 YAHOO.log('Add Ghost Class', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
522 this.addClass(this.CSS_GHOST);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
523 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
524 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
525 D.addClass(this._wrap, this.CSS_RESIZING);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
526 this._setCache();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
527 this._updateStatus(this._cache.height, this._cache.width, this._cache.top, this._cache.left);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
528 YAHOO.log('Firing startResize Event', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
529 this.fireEvent('startResize', { type: 'startresize', target: this});
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
530 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
531 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
532 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
533 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
534 * @method _setCache
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
535 * @description Sets up the this._cache hash table.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
536 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
537 _setCache: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
538 YAHOO.log('Setting up property cache', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
539 this._cache.xy = D.getXY(this._wrap);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
540 D.setXY(this._wrap, this._cache.xy);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
541 this._cache.height = this.get('clientHeight');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
542 this._cache.width = this.get('clientWidth');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
543 this._cache.start.height = this._cache.height;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
544 this._cache.start.width = this._cache.width;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
545 this._cache.start.top = this._cache.xy[1];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
546 this._cache.start.left = this._cache.xy[0];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
547 this._cache.top = this._cache.xy[1];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
548 this._cache.left = this._cache.xy[0];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
549 this.set('height', this._cache.height, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
550 this.set('width', this._cache.width, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
551 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
552 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
553 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
554 * @method _handleMouseUp
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
555 * @param {Event} ev A mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
556 * @description Cleans up listeners, hides proxy element and removes class names.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
557 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
558 _handleMouseUp: function(ev) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
559 this._active = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
560
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
561 var handle = '_handle_for_' + this._currentHandle;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
562 this._currentDD.unsubscribe('dragEvent', this[handle], this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
563 this._currentDD.unsubscribe('mouseUpEvent', this._handleMouseUp, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
564
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
565 if (this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
566 YAHOO.log('Hide Proxy Element', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
567 this._proxy.style.visibility = 'hidden';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
568 this._proxy.style.zIndex = '-1';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
569 if (this.get('setSize')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
570 YAHOO.log('Setting Size', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
571 this.resize(ev, this._cache.height, this._cache.width, this._cache.top, this._cache.left, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
572 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
573 YAHOO.log('Firing Resize Event', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
574 this.fireEvent('resize', { ev: 'resize', target: this, height: this._cache.height, width: this._cache.width, top: this._cache.top, left: this._cache.left });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
575 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
576
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
577 if (this.get('ghost')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
578 YAHOO.log('Removing Ghost Class', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
579 this.removeClass(this.CSS_GHOST);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
580 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
581 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
582
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
583 if (this.get('hover')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
584 D.addClass(this._wrap, this.CSS_HOVER);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
585 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
586 if (this._status) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
587 D.setStyle(this._status, 'display', 'none');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
588 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
589 if (this.browser.ie) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
590 YAHOO.log('Resetting IE onselectstart function', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
591 document.body.onselectstart = this._ieSelectBack;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
592 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
593
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
594 if (this.browser.ie) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
595 D.removeClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
596 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
597
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
598 for (var i in this._handles) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
599 if (Lang.hasOwnProperty(this._handles, i)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
600 D.removeClass(this._handles[i], this.CSS_HANDLE + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
601 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
602 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
603 if (this.get('hover') && !this._active) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
604 D.addClass(this._wrap, this.CSS_HOVER);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
605 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
606 D.removeClass(this._wrap, this.CSS_RESIZING);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
607
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
608 D.removeClass(this._handles[this._currentHandle], this.CSS_HANDLE + '-' + this._currentHandle + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
609 D.removeClass(this._handles[this._currentHandle], this.CSS_HANDLE + '-active');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
610
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
611 if (this.browser.ie) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
612 D.addClass(this._wrap, this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
613 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
614
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
615 this._resizeEvent = null;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
616 this._currentHandle = null;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
617
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
618 if (!this.get('animate')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
619 this.set('height', this._cache.height, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
620 this.set('width', this._cache.width, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
621 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
622
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
623 YAHOO.log('Firing endResize Event', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
624 this.fireEvent('endResize', { ev: 'endResize', target: this, height: this._cache.height, width: this._cache.width, top: this._cache.top, left: this._cache.left });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
625 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
626 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
627 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
628 * @method _setRatio
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
629 * @param {Number} h The height offset.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
630 * @param {Number} w The with offset.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
631 * @param {Number} t The top offset.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
632 * @param {Number} l The left offset.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
633 * @description Using the Height, Width, Top & Left, it recalcuates them based on the original element size.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
634 * @return {Array} The new Height, Width, Top & Left settings
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
635 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
636 _setRatio: function(h, w, t, l) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
637 YAHOO.log('Setting Ratio', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
638 var oh = h, ow = w;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
639 if (this.get('ratio')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
640 var orgH = this._cache.height,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
641 orgW = this._cache.width,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
642 nh = parseInt(this.get('height'), 10),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
643 nw = parseInt(this.get('width'), 10),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
644 maxH = this.get('maxHeight'),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
645 minH = this.get('minHeight'),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
646 maxW = this.get('maxWidth'),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
647 minW = this.get('minWidth');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
648
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
649 switch (this._currentHandle) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
650 case 'l':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
651 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
652 h = Math.min(Math.max(minH, h), maxH);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
653 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
654 t = (this._cache.start.top - (-((nh - h) / 2)));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
655 l = (this._cache.start.left - (-((nw - w))));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
656 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
657 case 'r':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
658 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
659 h = Math.min(Math.max(minH, h), maxH);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
660 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
661 t = (this._cache.start.top - (-((nh - h) / 2)));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
662 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
663 case 't':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
664 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
665 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
666 l = (this._cache.start.left - (-((nw - w) / 2)));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
667 t = (this._cache.start.top - (-((nh - h))));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
668 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
669 case 'b':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
670 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
671 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
672 l = (this._cache.start.left - (-((nw - w) / 2)));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
673 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
674 case 'bl':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
675 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
676 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
677 l = (this._cache.start.left - (-((nw - w))));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
678 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
679 case 'br':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
680 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
681 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
682 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
683 case 'tl':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
684 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
685 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
686 l = (this._cache.start.left - (-((nw - w))));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
687 t = (this._cache.start.top - (-((nh - h))));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
688 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
689 case 'tr':
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
690 h = nh * (w / nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
691 w = nw * (h / nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
692 l = (this._cache.start.left);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
693 t = (this._cache.start.top - (-((nh - h))));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
694 break;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
695 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
696 oh = this._checkHeight(h);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
697 ow = this._checkWidth(w);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
698 if ((oh != h) || (ow != w)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
699 t = 0;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
700 l = 0;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
701 if (oh != h) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
702 ow = this._cache.width;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
703 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
704 if (ow != w) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
705 oh = this._cache.height;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
706 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
707 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
708 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
709 return [oh, ow, t, l];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
710 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
711 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
712 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
713 * @method _updateStatus
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
714 * @param {Number} h The new height setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
715 * @param {Number} w The new width setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
716 * @param {Number} t The new top setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
717 * @param {Number} l The new left setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
718 * @description Using the Height, Width, Top & Left, it updates the status element with the elements sizes.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
719 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
720 _updateStatus: function(h, w, t, l) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
721 if (this._resizeEvent && (!Lang.isString(this._resizeEvent))) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
722 YAHOO.log('Updating Status Box', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
723 h = ((h === 0) ? this._cache.start.height : h);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
724 w = ((w === 0) ? this._cache.start.width : w);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
725 var h1 = parseInt(this.get('height'), 10),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
726 w1 = parseInt(this.get('width'), 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
727
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
728 if (isNaN(h1)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
729 h1 = parseInt(h, 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
730 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
731 if (isNaN(w1)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
732 w1 = parseInt(w, 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
733 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
734 var diffH = (parseInt(h, 10) - h1);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
735 var diffW = (parseInt(w, 10) - w1);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
736 this._cache.offsetHeight = diffH;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
737 this._cache.offsetWidth = diffW;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
738 if (this.get('status')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
739 YAHOO.log('Showing Status Box', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
740 D.setStyle(this._status, 'display', 'inline');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
741 //This will cause IE8 to crash if the status box is hidden..
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
742 this._status.innerHTML = '<strong>' + parseInt(h, 10) + ' x ' + parseInt(w, 10) + '</strong><em>' + ((diffH > 0) ? '+' : '') + diffH + ' x ' + ((diffW > 0) ? '+' : '') + diffW + '</em>';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
743 D.setXY(this._status, [Event.getPageX(this._resizeEvent) + 12, Event.getPageY(this._resizeEvent) + 12]);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
744 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
745 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
746 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
747 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
748 * @method lock
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
749 * @description Lock the resize so it can't be resized
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
750 * @param {Boolean} dd If the draggable config is set, lock it too
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
751 * @return {<a href="YAHOO.util.Resize.html">YAHOO.util.Resize</a>} The Resize instance
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
752 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
753 lock: function(dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
754 this._locked = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
755 if (dd && this.dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
756 D.removeClass(this._wrap, 'yui-draggable');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
757 this.dd.lock();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
758 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
759 return this;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
760 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
761 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
762 * @method unlock
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
763 * @description Unlock the resize so it can be resized
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
764 * @param {Boolean} dd If the draggable config is set, unlock it too
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
765 * @return {<a href="YAHOO.util.Resize.html">YAHOO.util.Resize</a>} The Resize instance
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
766 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
767 unlock: function(dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
768 this._locked = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
769 if (dd && this.dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
770 D.addClass(this._wrap, 'yui-draggable');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
771 this.dd.unlock();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
772 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
773 return this;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
774 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
775 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
776 * @method isLocked
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
777 * @description Check the locked status of the resize instance
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
778 * @return {Boolean}
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
779 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
780 isLocked: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
781 return this._locked;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
782 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
783 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
784 * @method reset
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
785 * @description Resets the element to is start state.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
786 * @return {<a href="YAHOO.util.Resize.html">YAHOO.util.Resize</a>} The Resize instance
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
787 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
788 reset: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
789 YAHOO.log('Resetting to cached sizes and position', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
790 this.resize(null, this._cache.start.height, this._cache.start.width, this._cache.start.top, this._cache.start.left, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
791 return this;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
792 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
793 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
794 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
795 * @method resize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
796 * @param {Event} ev The mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
797 * @param {Number} h The new height setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
798 * @param {Number} w The new width setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
799 * @param {Number} t The new top setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
800 * @param {Number} l The new left setting.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
801 * @param {Boolean} force Resize the element (used for proxy resize).
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
802 * @param {Boolean} silent Don't fire the beforeResize Event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
803 * @description Resizes the element, wrapper or proxy based on the data from the handlers.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
804 * @return {<a href="YAHOO.util.Resize.html">YAHOO.util.Resize</a>} The Resize instance
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
805 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
806 resize: function(ev, h, w, t, l, force, silent) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
807 if (this._locked) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
808 YAHOO.log('Resize Locked', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
809 return false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
810 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
811 YAHOO.log('Resize: ' + h + ',' + w + ',' + t + ',' + l, 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
812 this._resizeEvent = ev;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
813 var el = this._wrap, anim = this.get('animate'), set = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
814 if (this._proxy && !force) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
815 el = this._proxy;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
816 anim = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
817 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
818 this._setAutoRatio(ev);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
819 if (this._positioned) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
820 if (this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
821 t = this._cache.top - t;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
822 l = this._cache.left - l;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
823 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
824 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
825
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
826
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
827 var ratio = this._setRatio(h, w, t, l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
828 h = parseInt(ratio[0], 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
829 w = parseInt(ratio[1], 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
830 t = parseInt(ratio[2], 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
831 l = parseInt(ratio[3], 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
832
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
833 if (t == 0) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
834 //No Offset, get from cache
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
835 t = D.getY(el);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
836 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
837 if (l == 0) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
838 //No Offset, get from cache
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
839 l = D.getX(el);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
840 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
841
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
842
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
843
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
844 if (this._positioned) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
845 if (this._proxy && force) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
846 if (!anim) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
847 el.style.top = this._proxy.style.top;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
848 el.style.left = this._proxy.style.left;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
849 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
850 t = this._proxy.style.top;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
851 l = this._proxy.style.left;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
852 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
853 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
854 if (!this.get('ratio') && !this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
855 t = this._cache.top + -(t);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
856 l = this._cache.left + -(l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
857 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
858 if (t) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
859 if (this.get('minY')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
860 if (t < this.get('minY')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
861 t = this.get('minY');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
862 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
863 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
864 if (this.get('maxY')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
865 if (t > this.get('maxY')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
866 t = this.get('maxY');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
867 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
868 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
869 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
870 if (l) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
871 if (this.get('minX')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
872 if (l < this.get('minX')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
873 l = this.get('minX');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
874 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
875 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
876 if (this.get('maxX')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
877 if ((l + w) > this.get('maxX')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
878 l = (this.get('maxX') - w);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
879 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
880 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
881 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
882 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
883 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
884 if (!silent) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
885 YAHOO.log('beforeResize', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
886 var beforeReturn = this.fireEvent('beforeResize', { ev: 'beforeResize', target: this, height: h, width: w, top: t, left: l });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
887 if (beforeReturn === false) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
888 YAHOO.log('Resized cancelled because befireResize returned false', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
889 return false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
890 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
891 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
892
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
893 this._updateStatus(h, w, t, l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
894
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
895
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
896 if (this._positioned) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
897 if (this._proxy && force) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
898 //Do nothing
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
899 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
900 if (t) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
901 D.setY(el, t);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
902 this._cache.top = t;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
903 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
904 if (l) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
905 D.setX(el, l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
906 this._cache.left = l;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
907 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
908 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
909 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
910 if (h) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
911 if (!anim) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
912 set = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
913 if (this._proxy && force) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
914 if (!this.get('setSize')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
915 set = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
916 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
917 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
918 if (set) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
919 el.style.height = h + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
920 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
921 if ((this._proxy && force) || !this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
922 if (this._wrap != this.get('element')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
923 this.get('element').style.height = h + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
924 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
925 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
926 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
927 this._cache.height = h;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
928 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
929 if (w) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
930 this._cache.width = w;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
931 if (!anim) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
932 set = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
933 if (this._proxy && force) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
934 if (!this.get('setSize')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
935 set = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
936 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
937 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
938 if (set) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
939 el.style.width = w + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
940 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
941 if ((this._proxy && force) || !this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
942 if (this._wrap != this.get('element')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
943 this.get('element').style.width = w + 'px';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
944 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
945 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
946 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
947 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
948 if (anim) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
949 if (YAHOO.util.Anim) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
950 var _anim = new YAHOO.util.Anim(el, {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
951 height: {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
952 to: this._cache.height
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
953 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
954 width: {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
955 to: this._cache.width
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
956 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
957 }, this.get('animateDuration'), this.get('animateEasing'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
958 if (this._positioned) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
959 if (t) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
960 _anim.attributes.top = {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
961 to: parseInt(t, 10)
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
962 };
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
963 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
964 if (l) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
965 _anim.attributes.left = {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
966 to: parseInt(l, 10)
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
967 };
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
968 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
969 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
970
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
971 if (this._wrap != this.get('element')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
972 _anim.onTween.subscribe(function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
973 this.get('element').style.height = el.style.height;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
974 this.get('element').style.width = el.style.width;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
975 }, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
976 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
977
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
978 _anim.onComplete.subscribe(function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
979 YAHOO.log('Animation onComplete fired', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
980 this.set('height', h);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
981 this.set('width', w);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
982 this.fireEvent('resize', { ev: 'resize', target: this, height: h, width: w, top: t, left: l });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
983 }, this, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
984 _anim.animate();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
985
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
986 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
987 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
988 if (this._proxy && !force) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
989 YAHOO.log('proxyResize', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
990 this.fireEvent('proxyResize', { ev: 'proxyresize', target: this, height: h, width: w, top: t, left: l });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
991 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
992 YAHOO.log('resize', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
993 this.fireEvent('resize', { ev: 'resize', target: this, height: h, width: w, top: t, left: l });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
994 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
995 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
996 return this;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
997 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
998 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
999 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1000 * @method _handle_for_br
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1001 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1002 * @description Handles the sizes for the Bottom Right handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1003 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1004 _handle_for_br: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1005 YAHOO.log('Handle BR', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1006 var newW = this._setWidth(args.e);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1007 var newH = this._setHeight(args.e);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1008 this.resize(args.e, newH, newW, 0, 0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1009 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1010 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1011 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1012 * @method _handle_for_bl
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1013 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1014 * @description Handles the sizes for the Bottom Left handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1015 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1016 _handle_for_bl: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1017 YAHOO.log('Handle BL', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1018 var newW = this._setWidth(args.e, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1019 var newH = this._setHeight(args.e);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1020 var l = (newW - this._cache.width);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1021 this.resize(args.e, newH, newW, 0, l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1022 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1023 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1024 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1025 * @method _handle_for_tl
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1026 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1027 * @description Handles the sizes for the Top Left handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1028 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1029 _handle_for_tl: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1030 YAHOO.log('Handle TL', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1031 var newW = this._setWidth(args.e, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1032 var newH = this._setHeight(args.e, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1033 var t = (newH - this._cache.height);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1034 var l = (newW - this._cache.width);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1035 this.resize(args.e, newH, newW, t, l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1036 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1037 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1038 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1039 * @method _handle_for_tr
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1040 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1041 * @description Handles the sizes for the Top Right handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1042 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1043 _handle_for_tr: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1044 YAHOO.log('Handle TR', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1045 var newW = this._setWidth(args.e);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1046 var newH = this._setHeight(args.e, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1047 var t = (newH - this._cache.height);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1048 this.resize(args.e, newH, newW, t, 0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1049 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1050 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1051 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1052 * @method _handle_for_r
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1053 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1054 * @description Handles the sizes for the Right handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1055 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1056 _handle_for_r: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1057 YAHOO.log('Handle R', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1058 this._dds.r.setYConstraint(0,0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1059 var newW = this._setWidth(args.e);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1060 this.resize(args.e, 0, newW, 0, 0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1061 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1062 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1063 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1064 * @method _handle_for_l
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1065 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1066 * @description Handles the sizes for the Left handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1067 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1068 _handle_for_l: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1069 YAHOO.log('Handle L', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1070 this._dds.l.setYConstraint(0,0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1071 var newW = this._setWidth(args.e, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1072 var l = (newW - this._cache.width);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1073 this.resize(args.e, 0, newW, 0, l);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1074 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1075 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1076 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1077 * @method _handle_for_b
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1078 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1079 * @description Handles the sizes for the Bottom handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1080 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1081 _handle_for_b: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1082 YAHOO.log('Handle B', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1083 this._dds.b.setXConstraint(0,0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1084 var newH = this._setHeight(args.e);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1085 this.resize(args.e, newH, 0, 0, 0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1086 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1087 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1088 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1089 * @method _handle_for_t
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1090 * @param {Object} args The arguments from the CustomEvent.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1091 * @description Handles the sizes for the Top handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1092 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1093 _handle_for_t: function(args) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1094 YAHOO.log('Handle T', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1095 this._dds.t.setXConstraint(0,0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1096 var newH = this._setHeight(args.e, true);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1097 var t = (newH - this._cache.height);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1098 this.resize(args.e, newH, 0, t, 0);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1099 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1100 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1101 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1102 * @method _setWidth
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1103 * @param {Event} ev The mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1104 * @param {Boolean} flip Argument to determine the direction of the movement.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1105 * @description Calculates the width based on the mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1106 * @return {Number} The new value
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1107 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1108 _setWidth: function(ev, flip) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1109 YAHOO.log('Set width based on Event', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1110 var xy = this._cache.xy[0],
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1111 w = this._cache.width,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1112 x = Event.getPageX(ev),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1113 nw = (x - xy);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1114
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1115 if (flip) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1116 nw = (xy - x) + parseInt(this.get('width'), 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1117 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1118
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1119 nw = this._snapTick(nw, this.get('xTicks'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1120 nw = this._checkWidth(nw);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1121 return nw;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1122 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1123 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1124 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1125 * @method _checkWidth
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1126 * @param {Number} w The width to check.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1127 * @description Checks the value passed against the maxWidth and minWidth.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1128 * @return {Number} the new value
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1129 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1130 _checkWidth: function(w) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1131 YAHOO.log('Checking the min/max width', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1132 if (this.get('minWidth')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1133 if (w <= this.get('minWidth')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1134 YAHOO.log('Using minWidth', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1135 w = this.get('minWidth');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1136 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1137 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1138 if (this.get('maxWidth')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1139 if (w >= this.get('maxWidth')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1140 YAHOO.log('Using Max Width', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1141 w = this.get('maxWidth');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1142 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1143 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1144 return w;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1145 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1146 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1147 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1148 * @method _checkHeight
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1149 * @param {Number} h The height to check.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1150 * @description Checks the value passed against the maxHeight and minHeight.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1151 * @return {Number} The new value
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1152 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1153 _checkHeight: function(h) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1154 YAHOO.log('Checking the min/max height', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1155 if (this.get('minHeight')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1156 if (h <= this.get('minHeight')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1157 YAHOO.log('Using minHeight', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1158 h = this.get('minHeight');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1159 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1160 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1161 if (this.get('maxHeight')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1162 if (h >= this.get('maxHeight')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1163 YAHOO.log('using maxHeight', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1164 h = this.get('maxHeight');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1165 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1166 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1167 return h;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1168 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1169 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1170 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1171 * @method _setHeight
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1172 * @param {Event} ev The mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1173 * @param {Boolean} flip Argument to determine the direction of the movement.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1174 * @description Calculated the height based on the mouse event.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1175 * @return {Number} The new value
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1176 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1177 _setHeight: function(ev, flip) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1178 YAHOO.log('Setting the height based on the Event', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1179 var xy = this._cache.xy[1],
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1180 h = this._cache.height,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1181 y = Event.getPageY(ev),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1182 nh = (y - xy);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1183
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1184 if (flip) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1185 nh = (xy - y) + parseInt(this.get('height'), 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1186 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1187 nh = this._snapTick(nh, this.get('yTicks'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1188 nh = this._checkHeight(nh);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1189
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1190 return nh;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1191 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1192 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1193 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1194 * @method _snapTick
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1195 * @param {Number} size The size to tick against.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1196 * @param {Number} pix The tick pixels.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1197 * @description Adjusts the number based on the ticks used.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1198 * @return {Number} the new snapped position
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1199 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1200 _snapTick: function(size, pix) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1201 YAHOO.log('Snapping to ticks', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1202 if (!size || !pix) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1203 return size;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1204 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1205 var _s = size;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1206 var _x = size % pix;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1207 if (_x > 0) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1208 if (_x > (pix / 2)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1209 _s = size + (pix - _x);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1210 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1211 _s = size - _x;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1212 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1213 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1214 return _s;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1215 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1216 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1217 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1218 * @method init
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1219 * @description The Resize class's initialization method
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1220 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1221 init: function(p_oElement, p_oAttributes) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1222 YAHOO.log('init', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1223 this._locked = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1224 this._cache = {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1225 xy: [],
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1226 height: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1227 width: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1228 top: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1229 left: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1230 offsetHeight: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1231 offsetWidth: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1232 start: {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1233 height: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1234 width: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1235 top: 0,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1236 left: 0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1237 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1238 };
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1239
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1240 Resize.superclass.init.call(this, p_oElement, p_oAttributes);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1241
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1242 this.set('setSize', this.get('setSize'));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1243
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1244 if (p_oAttributes.height) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1245 this.set('height', parseInt(p_oAttributes.height, 10));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1246 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1247 var h = this.getStyle('height');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1248 if (h == 'auto') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1249 this.set('height', parseInt(this.get('element').offsetHeight, 10));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1250 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1251 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1252 if (p_oAttributes.width) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1253 this.set('width', parseInt(p_oAttributes.width, 10));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1254 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1255 var w = this.getStyle('width');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1256 if (w == 'auto') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1257 this.set('width', parseInt(this.get('element').offsetWidth, 10));
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1258 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1259 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1260
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1261 var id = p_oElement;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1262 if (!Lang.isString(id)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1263 id = D.generateId(id);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1264 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1265 Resize._instances[id] = this;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1266
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1267 this._active = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1268
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1269 this._createWrap();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1270 this._createProxy();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1271 this._createHandles();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1272
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1273 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1274 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1275 * @method getProxyEl
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1276 * @description Get the HTML reference for the proxy, returns null if no proxy.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1277 * @return {HTMLElement} The proxy element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1278 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1279 getProxyEl: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1280 return this._proxy;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1281 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1282 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1283 * @method getWrapEl
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1284 * @description Get the HTML reference for the wrap element, returns the current element if not wrapped.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1285 * @return {HTMLElement} The wrap element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1286 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1287 getWrapEl: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1288 return this._wrap;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1289 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1290 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1291 * @method getStatusEl
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1292 * @description Get the HTML reference for the status element.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1293 * @return {HTMLElement} The status element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1294 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1295 getStatusEl: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1296 return this._status;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1297 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1298 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1299 * @method getActiveHandleEl
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1300 * @description Get the HTML reference for the currently active resize handle.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1301 * @return {HTMLElement} The handle element that is active
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1302 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1303 getActiveHandleEl: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1304 return this._handles[this._currentHandle];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1305 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1306 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1307 * @method isActive
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1308 * @description Returns true or false if a resize operation is currently active on the element.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1309 * @return {Boolean}
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1310 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1311 isActive: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1312 return ((this._active) ? true : false);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1313 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1314 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1315 * @private
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1316 * @method initAttributes
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1317 * @description Initializes all of the configuration attributes used to create a resizable element.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1318 * @param {Object} attr Object literal specifying a set of
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1319 * configuration attributes used to create the utility.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1320 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1321 initAttributes: function(attr) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1322 Resize.superclass.initAttributes.call(this, attr);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1323
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1324 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1325 * @attribute useShim
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1326 * @description This setting will be passed to the DragDrop instances on the resize handles and for the draggable property.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1327 * This property should be used if you want the resize handles to work over iframe and other elements.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1328 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1329 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1330 this.setAttributeConfig('useShim', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1331 value: ((attr.useShim === true) ? true : false),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1332 validator: YAHOO.lang.isBoolean,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1333 method: function(u) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1334 for (var i in this._dds) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1335 if (Lang.hasOwnProperty(this._dds, i)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1336 this._dds[i].useShim = u;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1337 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1338 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1339 if (this.dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1340 this.dd.useShim = u;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1341 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1342 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1343 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1344 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1345 * @attribute setSize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1346 * @description Set the size of the resized element, if set to false the element will not be auto resized,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1347 * the resize event will contain the dimensions so the end user can resize it on their own.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1348 * This setting will only work with proxy set to true and animate set to false.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1349 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1350 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1351 this.setAttributeConfig('setSize', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1352 value: ((attr.setSize === false) ? false : true),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1353 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1354 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1355
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1356 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1357 * @attribute wrap
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1358 * @description Should we wrap the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1359 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1360 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1361 this.setAttributeConfig('wrap', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1362 writeOnce: true,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1363 validator: YAHOO.lang.isBoolean,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1364 value: attr.wrap || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1365 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1366
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1367 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1368 * @attribute handles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1369 * @description The handles to use (any combination of): 't', 'b', 'r', 'l', 'bl', 'br', 'tl', 'tr'. Defaults to: ['r', 'b', 'br'].
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1370 * Can use a shortcut of All. Note: 8 way resizing should be done on an element that is absolutely positioned.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1371 * @type Array
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1372 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1373 this.setAttributeConfig('handles', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1374 writeOnce: true,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1375 value: attr.handles || ['r', 'b', 'br'],
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1376 validator: function(handles) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1377 if (Lang.isString(handles) && handles.toLowerCase() == 'all') {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1378 handles = ['t', 'b', 'r', 'l', 'bl', 'br', 'tl', 'tr'];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1379 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1380 if (!Lang.isArray(handles)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1381 handles = handles.replace(/, /g, ',');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1382 handles = handles.split(',');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1383 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1384 this._configs.handles.value = handles;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1385 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1386 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1387
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1388 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1389 * @attribute width
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1390 * @description The width of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1391 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1392 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1393 this.setAttributeConfig('width', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1394 value: attr.width || parseInt(this.getStyle('width'), 10),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1395 validator: YAHOO.lang.isNumber,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1396 method: function(width) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1397 width = parseInt(width, 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1398 if (width > 0) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1399 if (this.get('setSize')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1400 this.setStyle('width', width + 'px');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1401 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1402 this._cache.width = width;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1403 this._configs.width.value = width;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1404 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1405 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1406 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1407
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1408 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1409 * @attribute height
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1410 * @description The height of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1411 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1412 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1413 this.setAttributeConfig('height', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1414 value: attr.height || parseInt(this.getStyle('height'), 10),
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1415 validator: YAHOO.lang.isNumber,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1416 method: function(height) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1417 height = parseInt(height, 10);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1418 if (height > 0) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1419 if (this.get('setSize')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1420 this.setStyle('height', height + 'px');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1421 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1422 this._cache.height = height;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1423 this._configs.height.value = height;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1424 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1425 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1426 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1427
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1428 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1429 * @attribute minWidth
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1430 * @description The minimum width of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1431 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1432 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1433 this.setAttributeConfig('minWidth', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1434 value: attr.minWidth || 15,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1435 validator: YAHOO.lang.isNumber
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1436 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1437
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1438 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1439 * @attribute minHeight
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1440 * @description The minimum height of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1441 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1442 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1443 this.setAttributeConfig('minHeight', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1444 value: attr.minHeight || 15,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1445 validator: YAHOO.lang.isNumber
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1446 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1447
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1448 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1449 * @attribute maxWidth
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1450 * @description The maximum width of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1451 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1452 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1453 this.setAttributeConfig('maxWidth', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1454 value: attr.maxWidth || 10000,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1455 validator: YAHOO.lang.isNumber
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1456 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1457
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1458 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1459 * @attribute maxHeight
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1460 * @description The maximum height of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1461 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1462 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1463 this.setAttributeConfig('maxHeight', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1464 value: attr.maxHeight || 10000,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1465 validator: YAHOO.lang.isNumber
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1466 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1467
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1468 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1469 * @attribute minY
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1470 * @description The minimum y coord of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1471 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1472 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1473 this.setAttributeConfig('minY', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1474 value: attr.minY || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1475 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1476
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1477 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1478 * @attribute minX
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1479 * @description The minimum x coord of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1480 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1481 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1482 this.setAttributeConfig('minX', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1483 value: attr.minX || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1484 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1485 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1486 * @attribute maxY
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1487 * @description The max y coord of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1488 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1489 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1490 this.setAttributeConfig('maxY', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1491 value: attr.maxY || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1492 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1493
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1494 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1495 * @attribute maxX
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1496 * @description The max x coord of the element
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1497 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1498 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1499 this.setAttributeConfig('maxX', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1500 value: attr.maxX || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1501 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1502
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1503 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1504 * @attribute animate
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1505 * @description Should be use animation to resize the element (can only be used if we use proxy).
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1506 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1507 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1508 this.setAttributeConfig('animate', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1509 value: attr.animate || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1510 validator: function(value) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1511 var ret = true;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1512 if (!YAHOO.util.Anim) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1513 ret = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1514 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1515 return ret;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1516 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1517 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1518
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1519 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1520 * @attribute animateEasing
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1521 * @description The Easing to apply to the animation.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1522 * @type Object
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1523 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1524 this.setAttributeConfig('animateEasing', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1525 value: attr.animateEasing || function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1526 var easing = false;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1527 if (YAHOO.util.Easing && YAHOO.util.Easing.easeOut) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1528 easing = YAHOO.util.Easing.easeOut;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1529 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1530 return easing;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1531 }()
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1532 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1533
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1534 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1535 * @attribute animateDuration
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1536 * @description The Duration to apply to the animation.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1537 * @type Number
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1538 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1539 this.setAttributeConfig('animateDuration', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1540 value: attr.animateDuration || 0.5
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1541 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1542
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1543 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1544 * @attribute proxy
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1545 * @description Resize a proxy element instead of the real element.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1546 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1547 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1548 this.setAttributeConfig('proxy', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1549 value: attr.proxy || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1550 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1551 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1552
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1553 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1554 * @attribute ratio
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1555 * @description Maintain the element's ratio when resizing.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1556 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1557 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1558 this.setAttributeConfig('ratio', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1559 value: attr.ratio || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1560 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1561 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1562
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1563 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1564 * @attribute ghost
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1565 * @description Apply an opacity filter to the element being resized (only works with proxy).
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1566 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1567 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1568 this.setAttributeConfig('ghost', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1569 value: attr.ghost || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1570 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1571 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1572
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1573 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1574 * @attribute draggable
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1575 * @description A convienence method to make the element draggable
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1576 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1577 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1578 this.setAttributeConfig('draggable', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1579 value: attr.draggable || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1580 validator: YAHOO.lang.isBoolean,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1581 method: function(dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1582 if (dd && this._wrap) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1583 this._setupDragDrop();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1584 } else {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1585 if (this.dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1586 D.removeClass(this._wrap, this.CSS_DRAG);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1587 this.dd.unreg();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1588 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1589 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1590 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1591 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1592
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1593 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1594 * @attribute hover
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1595 * @description Only show the handles when they are being moused over.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1596 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1597 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1598 this.setAttributeConfig('hover', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1599 value: attr.hover || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1600 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1601 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1602
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1603 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1604 * @attribute hiddenHandles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1605 * @description Don't show the handles, just use the cursor to the user.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1606 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1607 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1608 this.setAttributeConfig('hiddenHandles', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1609 value: attr.hiddenHandles || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1610 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1611 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1612
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1613 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1614 * @attribute knobHandles
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1615 * @description Use the smaller handles, instead if the full size handles.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1616 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1617 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1618 this.setAttributeConfig('knobHandles', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1619 value: attr.knobHandles || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1620 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1621 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1622
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1623 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1624 * @attribute xTicks
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1625 * @description The number of x ticks to span the resize to.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1626 * @type Number or False
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1627 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1628 this.setAttributeConfig('xTicks', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1629 value: attr.xTicks || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1630 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1631
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1632 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1633 * @attribute yTicks
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1634 * @description The number of y ticks to span the resize to.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1635 * @type Number or False
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1636 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1637 this.setAttributeConfig('yTicks', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1638 value: attr.yTicks || false
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1639 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1640
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1641 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1642 * @attribute status
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1643 * @description Show the status (new size) of the resize.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1644 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1645 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1646 this.setAttributeConfig('status', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1647 value: attr.status || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1648 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1649 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1650
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1651 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1652 * @attribute autoRatio
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1653 * @description Using the shift key during a resize will toggle the ratio config.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1654 * @type Boolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1655 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1656 this.setAttributeConfig('autoRatio', {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1657 value: attr.autoRatio || false,
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1658 validator: YAHOO.lang.isBoolean
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1659 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1660
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1661 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1662 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1663 * @method destroy
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1664 * @description Destroys the resize object and all of it's elements & listeners.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1665 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1666 destroy: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1667 YAHOO.log('Destroying Resize', 'info', 'Resize');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1668 for (var h in this._handles) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1669 if (Lang.hasOwnProperty(this._handles, h)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1670 Event.purgeElement(this._handles[h]);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1671 this._handles[h].parentNode.removeChild(this._handles[h]);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1672 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1673 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1674 if (this._proxy) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1675 this._proxy.parentNode.removeChild(this._proxy);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1676 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1677 if (this._status) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1678 this._status.parentNode.removeChild(this._status);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1679 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1680 if (this.dd) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1681 this.dd.unreg();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1682 D.removeClass(this._wrap, this.CSS_DRAG);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1683 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1684 if (this._wrap != this.get('element')) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1685 this.setStyle('position', '');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1686 this.setStyle('top', '');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1687 this.setStyle('left', '');
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1688 this._wrap.parentNode.replaceChild(this.get('element'), this._wrap);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1689 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1690 this.removeClass(this.CSS_RESIZE);
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1691
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1692 delete YAHOO.util.Resize._instances[this.get('id')];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1693 //Brutal Object Destroy
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1694 for (var i in this) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1695 if (Lang.hasOwnProperty(this, i)) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1696 this[i] = null;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1697 delete this[i];
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1698 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1699 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1700 },
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1701 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1702 * @method toString
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1703 * @description Returns a string representing the Resize Object.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1704 * @return {String}
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1705 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1706 toString: function() {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1707 if (this.get) {
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1708 return 'Resize (#' + this.get('id') + ')';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1709 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1710 return 'Resize Utility';
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1711 }
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1712 });
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1713
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1714 YAHOO.util.Resize = Resize;
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1715
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1716 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1717 * @event dragEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1718 * @description Fires when the <a href="YAHOO.util.DragDrop.html">YAHOO.util.DragDrop</a> dragEvent is fired for the config option draggable.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1719 * @type YAHOO.util.CustomEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1720 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1721 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1722 * @event startResize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1723 * @description Fires when a resize action is started.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1724 * @type YAHOO.util.CustomEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1725 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1726 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1727 * @event endResize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1728 * @description Fires when the mouseUp event from the Drag Instance fires.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1729 * @type YAHOO.util.CustomEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1730 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1731 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1732 * @event resize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1733 * @description Fires on every element resize (only fires once when used with proxy config setting).
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1734 * @type YAHOO.util.CustomEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1735 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1736 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1737 * @event beforeResize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1738 * @description Fires before every element resize after the size calculations, returning false will stop the resize.
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1739 * @type YAHOO.util.CustomEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1740 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1741 /**
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1742 * @event proxyResize
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1743 * @description Fires on every proxy resize (only fires when used with proxy config setting).
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1744 * @type YAHOO.util.CustomEvent
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1745 */
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1746
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1747 })();
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1748
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1749 YAHOO.register("resize", YAHOO.util.Resize, {version: "2.8.0r4", build: "2449"});