r2963 commited - position: fixes for flip-collision: ignore at-center (no flip happens)...

r2963 commited - position: fixes for flip-collision: ignore at-center (no flip happens)...


Revision: 2963
Author: joern.zaefferer
Date: Thu Jul 23 02:30:28 2009
Log: position: fixes for flip-collision: ignore at-center (no flip
happens); adjust my-center to use the correct offset
http://code.google.com/p/jquery-ui/source/detail?r=2963
Modified:
/branches/dev/positionTo/ui/ui.position.js
=======================================
--- /branches/dev/positionTo/ui/ui.position.js    Wed Jul 22 19:35:10 2009
+++ /branches/dev/positionTo/ui/ui.position.js    Thu Jul 23 02:30:28 2009
@@ -159,14 +159,18 @@
    flip: {
        left: function(position, data) {
+            if (data.at[0] == 'center')
+                return;
            var over = position.left + data.elemWidth - $(window).width() -
$(window).scrollLeft(),
-                myOffset = data.my[0] == 'left' ? -data.elemWidth : data.elemWidth,
+                myOffset = data.my[0] == 'left' ? -data.elemWidth : data.my[0]
== 'right' ? data.elemWidth : 0,
                offset = -2 * data.offset[0];
            position.left += position.left < 0 ? myOffset + data.targetWidth +
offset : over > 0 ? myOffset - data.targetWidth + offset : 0;
        },
        top: function(position, data) {
+            if (data.at[1] == 'center')
+                return;
            var over = position.top + data.elemHeight - $(window).height() -
$(window).scrollTop(),
-                myOffset = data.my[1] == 'top' ? -data.elemHeight : data.elemHeight,
+                myOffset = data.my[1] == 'top' ? -data.elemHeight : data.my[1]
== 'bottom' ? data.elemHeight : 0,
                atOffset = data.at[1] == 'top' ? data.targetHeight :
-data.targetHeight,
                offset = -2 * data.offset[1];
            position.top += position.top < 0 ? myOffset + data.targetHeight +
offset : over > 0 ? myOffset + atOffset + offset : 0;