mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Draggable: Use pageX/Y instead of clientX/Y.
This commit is contained in:
parent
726d3f67c2
commit
49ea77eff7
10
ui/jquery.ui.draggable.js
vendored
10
ui/jquery.ui.draggable.js
vendored
@ -25,7 +25,7 @@ $.widget( "ui.draggable", $.ui.interaction, {
|
||||
// dragEl: element being dragged (original or helper)
|
||||
// position: final CSS position of dragEl
|
||||
// offset: offset of dragEl
|
||||
// startCoords: clientX/Y of the mousedown (offset of pointer)
|
||||
// startCoords: pageX/Y of the mousedown (offset of pointer)
|
||||
// startPosition: CSS position prior to drag start
|
||||
// startOffset: offset prior to drag start
|
||||
// tempPosition: overridable CSS position of dragEl
|
||||
@ -147,8 +147,8 @@ $.widget( "ui.draggable", $.ui.interaction, {
|
||||
this.offset = $.extend( {}, this.startOffset );
|
||||
|
||||
this.startCoords = {
|
||||
left: event.clientX,
|
||||
top: event.clientY
|
||||
left: event.pageX,
|
||||
top: event.pageY
|
||||
};
|
||||
|
||||
// Cache the offset of scrollParent, if required for _handleScrolling
|
||||
@ -205,8 +205,8 @@ $.widget( "ui.draggable", $.ui.interaction, {
|
||||
// Uses event to determine new position of draggable, before any override from callbacks
|
||||
// TODO: handle absolute element inside relative parent like a relative element
|
||||
_preparePosition: function( event ) {
|
||||
var leftDiff = event.clientX - this.startCoords.left,
|
||||
topDiff = event.clientY - this.startCoords.top,
|
||||
var leftDiff = event.pageX - this.startCoords.left,
|
||||
topDiff = event.pageY - this.startCoords.top,
|
||||
newLeft = leftDiff + this.startPosition.left,
|
||||
newTop = topDiff + this.startPosition.top;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user