Skip to content

Commit 7692b6e

Browse files
bhollisscottgonzalez
authored andcommitted
Position: Fix flip collision. Fixes #5932 - Position: flip collision handling is wrong in some cases.
1 parent 03eea0e commit 7692b6e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ui/jquery.ui.position.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,14 @@ $.ui.position = {
164164
data.my[ 0 ] === "right" ?
165165
data.elemWidth :
166166
0,
167+
atOffset = data.at[ 0 ] === "left" ?
168+
data.targetWidth :
169+
-data.targetWidth,
167170
offset = -2 * data.offset[ 0 ];
168171
position.left += position.left < 0 ?
169-
myOffset + data.targetWidth + offset :
172+
myOffset + atOffset + offset :
170173
over > 0 ?
171-
myOffset - data.targetWidth + offset :
174+
myOffset + atOffset + offset :
172175
0;
173176
},
174177
top: function( position, data ) {
@@ -187,7 +190,7 @@ $.ui.position = {
187190
-data.targetHeight,
188191
offset = -2 * data.offset[ 1 ];
189192
position.top += position.top < 0 ?
190-
myOffset + data.targetHeight + offset :
193+
myOffset + atOffset + offset :
191194
over > 0 ?
192195
myOffset + atOffset + offset :
193196
0;

0 commit comments

Comments
 (0)