Changeset 563
- Timestamp:
- 08/17/08 01:15:49 (19 months ago)
- Location:
- trunk/ui
- Files:
-
- 5 modified
-
ui.core.js (modified) (10 diffs)
-
ui.draggable.js (modified) (9 diffs)
-
ui.resizable.js (modified) (5 diffs)
-
ui.selectable.js (modified) (4 diffs)
-
ui.sortable.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.core.js
r552 r563 203 203 204 204 $.ui.mouse = { 205 mouseInit: function() {205 _mouseInit: function() { 206 206 var self = this; 207 207 208 208 this.element.bind('mousedown.'+this.widgetName, function(e) { 209 return self. mouseDown(e);209 return self._mouseDown(e); 210 210 }); 211 211 … … 221 221 // TODO: make sure destroying one instance of mouse doesn't mess with 222 222 // other instances of mouse 223 mouseDestroy: function() {223 _mouseDestroy: function() { 224 224 this.element.unbind('.'+this.widgetName); 225 225 … … 229 229 }, 230 230 231 mouseDown: function(e) {231 _mouseDown: function(e) { 232 232 // we may have missed mouseup (out of window) 233 (this._mouseStarted && this. mouseUp(e));233 (this._mouseStarted && this._mouseUp(e)); 234 234 235 235 this._mouseDownEvent = e; … … 238 238 btnIsLeft = (e.which == 1), 239 239 elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false); 240 if (!btnIsLeft || elIsCancel || !this. mouseCapture(e)) {240 if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) { 241 241 return true; 242 242 } 243 243 244 this. _mouseDelayMet = !this.options.delay;245 if (!this. _mouseDelayMet) {244 this.mouseDelayMet = !this.options.delay; 245 if (!this.mouseDelayMet) { 246 246 this._mouseDelayTimer = setTimeout(function() { 247 self. _mouseDelayMet = true;247 self.mouseDelayMet = true; 248 248 }, this.options.delay); 249 249 } 250 250 251 if (this. mouseDistanceMet(e) && this.mouseDelayMet(e)) {252 this._mouseStarted = (this. mouseStart(e) !== false);251 if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { 252 this._mouseStarted = (this._mouseStart(e) !== false); 253 253 if (!this._mouseStarted) { 254 254 e.preventDefault(); … … 259 259 // these delegates are required to keep context 260 260 this._mouseMoveDelegate = function(e) { 261 return self. mouseMove(e);261 return self._mouseMove(e); 262 262 }; 263 263 this._mouseUpDelegate = function(e) { 264 return self. mouseUp(e);264 return self._mouseUp(e); 265 265 }; 266 266 $(document) … … 271 271 }, 272 272 273 mouseMove: function(e) {273 _mouseMove: function(e) { 274 274 // IE mouseup check - mouseup happened when mouse was out of window 275 275 if ($.browser.msie && !e.button) { 276 return this. mouseUp(e);276 return this._mouseUp(e); 277 277 } 278 278 279 279 if (this._mouseStarted) { 280 this. mouseDrag(e);280 this._mouseDrag(e); 281 281 return false; 282 282 } 283 283 284 if (this. mouseDistanceMet(e) && this.mouseDelayMet(e)) {284 if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { 285 285 this._mouseStarted = 286 (this. mouseStart(this._mouseDownEvent, e) !== false);287 (this._mouseStarted ? this. mouseDrag(e) : this.mouseUp(e));286 (this._mouseStart(this._mouseDownEvent, e) !== false); 287 (this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e)); 288 288 } 289 289 … … 291 291 }, 292 292 293 mouseUp: function(e) {293 _mouseUp: function(e) { 294 294 $(document) 295 295 .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) … … 298 298 if (this._mouseStarted) { 299 299 this._mouseStarted = false; 300 this. mouseStop(e);300 this._mouseStop(e); 301 301 } 302 302 … … 304 304 }, 305 305 306 mouseDistanceMet: function(e) {306 _mouseDistanceMet: function(e) { 307 307 return (Math.max( 308 308 Math.abs(this._mouseDownEvent.pageX - e.pageX), … … 312 312 }, 313 313 314 mouseDelayMet: function(e) {315 return this. _mouseDelayMet;314 _mouseDelayMet: function(e) { 315 return this.mouseDelayMet; 316 316 }, 317 317 318 318 // These are placeholder methods, to be overriden by extending plugin 319 mouseStart: function(e) {},320 mouseDrag: function(e) {},321 mouseStop: function(e) {},322 mouseCapture: function(e) { return true; }319 _mouseStart: function(e) {}, 320 _mouseDrag: function(e) {}, 321 _mouseStop: function(e) {}, 322 _mouseCapture: function(e) { return true; } 323 323 }; 324 324 -
trunk/ui/ui.draggable.js
r561 r563 22 22 (this.options.disabled && this.element.addClass('ui-draggable-disabled')); 23 23 24 this. mouseInit();25 26 }, 27 mouseStart: function(e) {24 this._mouseInit(); 25 26 }, 27 _mouseStart: function(e) { 28 28 29 29 var o = this.options; … … 136 136 137 137 this.helper.addClass("ui-draggable-dragging"); 138 this. mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position138 this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position 139 139 return true; 140 140 }, … … 208 208 return position; 209 209 }, 210 mouseDrag: function(e) {210 _mouseDrag: function(e) { 211 211 212 212 //Compute the helpers position … … 223 223 return false; 224 224 }, 225 mouseStop: function(e) {225 _mouseStop: function(e) { 226 226 227 227 //If we are using droppables, inform the manager about the drop … … 269 269 if(!this.element.data('draggable')) return; 270 270 this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable-dragging ui-draggable-disabled'); 271 this. mouseDestroy();271 this._mouseDestroy(); 272 272 } 273 273 })); … … 493 493 this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) 494 494 if(this.shouldRevert) this.instance.options.revert = true; //revert here 495 this.instance. mouseStop(e);495 this.instance._mouseStop(e); 496 496 497 497 //Also propagate receive event, since the sortable is actually receiving a element … … 535 535 536 536 e.target = this.instance.currentItem[0]; 537 this.instance. mouseCapture(e, true);538 this.instance. mouseStart(e, true, true);537 this.instance._mouseCapture(e, true); 538 this.instance._mouseStart(e, true, true); 539 539 540 540 //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes … … 549 549 550 550 //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable 551 if(this.instance.currentItem) this.instance. mouseDrag(e);551 if(this.instance.currentItem) this.instance._mouseDrag(e); 552 552 553 553 } else { … … 559 559 this.instance.cancelHelperRemoval = true; 560 560 this.instance.options.revert = false; //No revert here 561 this.instance. mouseStop(e, true);561 this.instance._mouseStop(e, true); 562 562 this.instance.options.helper = this.instance.options._helper; 563 563 -
trunk/ui/ui.resizable.js
r560 r563 213 213 } 214 214 215 this. mouseInit();215 this._mouseInit(); 216 216 }, 217 217 plugins: {}, … … 235 235 var el = this.element, wrapped = el.children(".ui-resizable").get(0); 236 236 237 this. mouseDestroy();237 this._mouseDestroy(); 238 238 239 239 var _destroy = function(exp) { … … 258 258 } 259 259 }, 260 mouseStart: function(e) {260 _mouseStart: function(e) { 261 261 if(this.options.disabled) return false; 262 262 … … 313 313 return true; 314 314 }, 315 mouseDrag: function(e) {315 _mouseDrag: function(e) { 316 316 317 317 //Increase performance, avoid regex … … 349 349 return false; 350 350 }, 351 mouseStop: function(e) {351 _mouseStop: function(e) { 352 352 353 353 this.options.resizing = false; -
trunk/ui/ui.selectable.js
r558 r563 46 46 this.selectees = selectees.addClass("ui-selectee"); 47 47 48 this. mouseInit();48 this._mouseInit(); 49 49 50 50 this.helper = $(document.createElement('div')) … … 64 64 .removeData("selectable") 65 65 .unbind(".selectable"); 66 this. mouseDestroy();67 }, 68 mouseStart: function(e) {66 this._mouseDestroy(); 67 }, 68 _mouseStart: function(e) { 69 69 var self = this; 70 70 … … 122 122 return this.options.keyboard ? !isSelectee : true; 123 123 }, 124 mouseDrag: function(e) {124 _mouseDrag: function(e) { 125 125 var self = this; 126 126 this.dragged = true; … … 211 211 return false; 212 212 }, 213 mouseStop: function(e) {213 _mouseStop: function(e) { 214 214 var self = this; 215 215 -
trunk/ui/ui.sortable.js
r562 r563 42 42 43 43 //Initialize mouse events for interaction 44 this. mouseInit();44 this._mouseInit(); 45 45 46 46 }, … … 284 284 .removeData("sortable") 285 285 .unbind(".sortable"); 286 this. mouseDestroy();286 this._mouseDestroy(); 287 287 288 288 for ( var i = this.items.length - 1; i >= 0; i-- ) … … 361 361 }, 362 362 363 mouseCapture: function(e, overrideHandle) {363 _mouseCapture: function(e, overrideHandle) { 364 364 365 365 if(this.options.disabled || this.options.type == 'static') return false; … … 391 391 }, 392 392 393 mouseStart: function(e, overrideHandle, noActivation) {393 _mouseStart: function(e, overrideHandle, noActivation) { 394 394 395 395 var o = this.options; … … 500 500 this.dragging = true; 501 501 502 this. mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position502 this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position 503 503 return true; 504 504 … … 567 567 }, 568 568 569 mouseDrag: function(e) {569 _mouseDrag: function(e) { 570 570 571 571 //Compute the helpers position … … 634 634 }, 635 635 636 mouseStop: function(e, noPropagation) {636 _mouseStop: function(e, noPropagation) { 637 637 638 638 //If we are using droppables, inform the manager about the drop