mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Draggable: Redid f7ec502992
after bad merge.
This commit is contained in:
parent
536a11893a
commit
7941f7c13f
26
ui/jquery.ui.draggable.js
vendored
26
ui/jquery.ui.draggable.js
vendored
@ -46,7 +46,7 @@ $.widget( "ui.draggable", {
|
|||||||
|
|
||||||
// TODO: why is relative handled differently than fixed/absolute?
|
// TODO: why is relative handled differently than fixed/absolute?
|
||||||
_getPosition: function() {
|
_getPosition: function() {
|
||||||
var left, top, position,
|
var left, top, position, offset,
|
||||||
scrollTop = this.scrollParent.scrollTop(),
|
scrollTop = this.scrollParent.scrollTop(),
|
||||||
scrollLeft = this.scrollParent.scrollLeft();
|
scrollLeft = this.scrollParent.scrollLeft();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ $.widget( "ui.draggable", {
|
|||||||
|
|
||||||
// Take into account scrollbar
|
// Take into account scrollbar
|
||||||
position.top -= scrollTop;
|
position.top -= scrollTop;
|
||||||
position.left -= scrollLeft
|
position.left -= scrollLeft;
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ $.widget( "ui.draggable", {
|
|||||||
this.dragEl
|
this.dragEl
|
||||||
// TODO: should we move this to the stylesheet and use a class?
|
// TODO: should we move this to the stylesheet and use a class?
|
||||||
.css( "position", "absolute" )
|
.css( "position", "absolute" )
|
||||||
.appendTo( this.doc[0].body )
|
.appendTo( this.document[0].body )
|
||||||
.offset( this.element.offset() );
|
.offset( this.element.offset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,17 +168,17 @@ $.widget( "ui.draggable", {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cache the offset of scrollParent, if required for _handleScrolling
|
// Cache the offset of scrollParent, if required for _handleScrolling
|
||||||
if ( this.scrollParent[0] != this.doc[0] && this.scrollParent[0].tagName != 'HTML') {
|
if ( this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== 'HTML') {
|
||||||
this.overflowOffset = this.scrollParent.offset();
|
this.overflowOffset = this.scrollParent.offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.overflow = {};
|
this.overflow = {};
|
||||||
|
|
||||||
this.overflow.height = ( this.scrollParent[0] === this.doc[0] ) ?
|
this.overflow.height = ( this.scrollParent[0] === this.document[0] ) ?
|
||||||
this.win.height() : this.scrollParent.height();
|
this.window.height() : this.scrollParent.height();
|
||||||
|
|
||||||
this.overflow.width = ( this.scrollParent[0] === this.doc[0] ) ?
|
this.overflow.width = ( this.scrollParent[0] === this.document[0] ) ?
|
||||||
this.win.width() : this.scrollParent.width();
|
this.window.width() : this.scrollParent.width();
|
||||||
|
|
||||||
this._preparePosition( event );
|
this._preparePosition( event );
|
||||||
|
|
||||||
@ -186,13 +186,13 @@ $.widget( "ui.draggable", {
|
|||||||
|
|
||||||
// If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes
|
// If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes
|
||||||
if ( allowed !== true ) {
|
if ( allowed !== true ) {
|
||||||
this.doc.unbind( "." + this.widgetName );
|
this.document.unbind( "." + this.widgetName );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setCss( event );
|
this._setCss( event );
|
||||||
|
|
||||||
this._bind( this.doc, {
|
this._bind( this.document, {
|
||||||
mousemove: "_mouseMove",
|
mousemove: "_mouseMove",
|
||||||
mouseup: "_mouseUp"
|
mouseup: "_mouseUp"
|
||||||
});
|
});
|
||||||
@ -208,7 +208,7 @@ $.widget( "ui.draggable", {
|
|||||||
|
|
||||||
// If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes
|
// If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes
|
||||||
if ( allowed !== true ) {
|
if ( allowed !== true ) {
|
||||||
this.doc.unbind( "." + this.widgetName );
|
this.document.unbind( "." + this.widgetName );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ $.widget( "ui.draggable", {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.doc.unbind( "." + this.widgetName );
|
this.document.unbind( "." + this.widgetName );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Uses event to determine new position of draggable, before any override from callbacks
|
// Uses event to determine new position of draggable, before any override from callbacks
|
||||||
@ -257,7 +257,7 @@ $.widget( "ui.draggable", {
|
|||||||
this.tempPosition = {
|
this.tempPosition = {
|
||||||
left: newLeft,
|
left: newLeft,
|
||||||
top: newTop
|
top: newTop
|
||||||
}
|
};
|
||||||
|
|
||||||
// Refresh offset cache with new positions
|
// Refresh offset cache with new positions
|
||||||
this.offset.left = this.startOffset.left + newLeft;
|
this.offset.left = this.startOffset.left + newLeft;
|
||||||
|
Loading…
Reference in New Issue
Block a user