Changeset 5666
- Timestamp:
- 05/22/08 12:11:15 (3 months ago)
- Location:
- branches/ui-experimental/mouse
- Files:
-
- 2 modified
-
ui.core.js (modified) (1 diff)
-
ui.resizable.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ui-experimental/mouse/ui.core.js
r5655 r5666 258 258 259 259 $.ui.mouse.defaults = { 260 cancel: "",260 cancel: null, 261 261 distance: 0, 262 262 delay: 0 -
branches/ui-experimental/mouse/ui.resizable.js
r5663 r5666 15 15 ;(function($) { 16 16 17 $.widget("ui.resizable", {17 $.widget("ui.resizable", $.extend($.ui.mouse, { 18 18 init: function() { 19 19 20 20 var self = this, o = this.options; 21 21 22 22 var elpos = this.element.css('position'); 23 23 … … 210 210 } 211 211 212 //Initialize mouse events for interaction 213 this.element.mouse({ 214 executor: this, 215 delay: 0, 216 distance: 0, 217 dragPrevention: ['input','textarea','button','select','option'], 218 start: this.start, 219 stop: this.stop, 220 drag: this.drag, 221 condition: function(e) { 222 if(this.disabled) return false; 223 for(var i in this.options.handles) { 224 if($(this.options.handles[i])[0] == e.target) return true; 225 } 226 return false; 227 } 228 }); 212 this.mouseInit(); 229 213 230 214 }, … … 242 226 }, 243 227 destroy: function() { 244 var el = this.element, wrapped = el.children(".ui-resizable").get(0), 245 246 _destroy = function(exp) { 228 var el = this.element, wrapped = el.children(".ui-resizable").get(0); 229 230 this.mouseDestroy(); 231 232 var _destroy = function(exp) { 247 233 $(exp).removeClass("ui-resizable ui-resizable-disabled") 248 .mouse("destroy").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); 234 .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); 235 249 236 }; 250 237 … … 273 260 this.disabled = true; 274 261 }, 275 start: function(e) { 262 mouseStart: function(e) { 263 if(this.disabled) return false; 264 276 265 var o = this.options, iniPos = this.element.position(), el = this.element, 277 266 num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7; … … 313 302 314 303 this.propagate("start", e); 304 for(var i in this.options.handles) { 305 if($(this.options.handles[i])[0] == e.target) return true; 306 } 315 307 return false; 316 308 }, 317 stop: function(e) { 309 mouseDrag: function(e) { 310 //Increase performance, avoid regex 311 var el = this.helper, o = this.options, props = {}, 312 self = this, smp = this.originalMousePosition, a = this.axis; 313 314 var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0; 315 var trigger = this._change[a]; 316 if (!trigger) return false; 317 318 // Calculate the attrs that will be change 319 var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; 320 321 if (o._aspectRatio || e.shiftKey) 322 data = this._updateRatio(data, e); 323 324 data = this._respectSize(data, e); 325 326 this.propagate("resize", e); 327 328 el.css({ 329 top: this.position.top + "px", left: this.position.left + "px", 330 width: this.size.width + "px", height: this.size.height + "px" 331 }); 332 333 if (!o.proxy && o.proportionallyResize) 334 this._proportionallyResize(); 335 336 this._updateCache(data); 337 338 return false; 339 }, 340 mouseStop: function(e) { 318 341 this.options.resizing = false; 319 342 var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this; … … 339 362 340 363 this.propagate("stop", e); 341 return false;342 },343 drag: function(e) {344 //Increase performance, avoid regex345 var el = this.helper, o = this.options, props = {},346 self = this, smp = this.originalMousePosition, a = this.axis;347 348 var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0;349 var trigger = this._change[a];350 if (!trigger) return false;351 352 // Calculate the attrs that will be change353 var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;354 355 if (o._aspectRatio || e.shiftKey)356 data = this._updateRatio(data, e);357 358 data = this._respectSize(data, e);359 360 this.propagate("resize", e);361 362 el.css({363 top: this.position.top + "px", left: this.position.left + "px",364 width: this.size.width + "px", height: this.size.height + "px"365 });366 367 if (!o.proxy && o.proportionallyResize)368 this._proportionallyResize();369 370 this._updateCache(data);371 372 364 return false; 373 365 }, … … 499 491 } 500 492 } 501 }) ;493 })); 502 494 503 495 $.extend($.ui.resizable, { 504 496 defaults: { 497 cancel: ":input,button", 498 distance: 0, 499 delay: 0, 500 505 501 preventDefault: true, 506 502 transparent: false,