roojs-bootstrap.js
[roojs1] / roojs-bootstrap-debug.js
index 7262438..f926485 100644 (file)
@@ -19933,7 +19933,8 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
     },
     /**
      * fire this manually after loading a grid in the table for example
-     *
+     * @param {string} (left|right|top|bottom) where to try and put it
+     * @param {Boolean} try and move it if we cant get right position.
      */
     updatePosition : function(placement, try_move)
     {
@@ -19947,14 +19948,46 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
             case 'right':
                 var exact = this.el.getAlignToXY(this.alignEl, 'tl-tr', [10,0]);
                 var offset = this.el.getAlignToXY(this.alignEl, 'tl-tr?',[10,0]);
-                if (exact.equals(offset)) {
-                    //normal display...
-                    this.setXY(exact, this.preanim(arguments, 3));
-                    var xy = this.alignEl.getAnchorXY(p1, false);
-                    
+                if (!try_move || exact.equals(offset) || exact[0] == offset[0] ) {
+                    //normal display... or moved up/down.
+                    this.setXY(offset);
+                    var xy = this.alignEl.getAnchorXY('tr', false);
+                    xy[0]+=2;xy[1]+=5;
+                    this.arrowEl.setXY(xy);
+                    return true;
                 }
+                // continue through...
+                try_move = false;
                 
+            
+            case 'left':
+                var exact = this.el.getAlignToXY(this.alignEl, 'tr-tl', [-10,0]);
+                var offset = this.el.getAlignToXY(this.alignEl, 'tl-tr?',[-10,0]);
+                if (!try_move || exact.equals(offset) || exact[0] == offset[0] ) {
+                    //normal display... or moved up/down.
+                    this.setXY(offset);
+                    var xy = this.alignEl.getAnchorXY('tl', false);
+                    xy[0]+=2;xy[1]+=5; // << fix me
+                    this.arrowEl.setXY(xy);
+                    return true;
+                }
+                // call self...
+                return this.updatePosition('right', false);
+            
+            case 'top':
+                var exact = this.el.getAlignToXY(this.alignEl, 't-b', [0,-10]);
+                var offset = this.el.getAlignToXY(this.alignEl, 't-b?',[0,-10]);
+                if (!try_move || exact.equals(offset) || exact[1] == offset[1] ) {
+                    //normal display... or moved up/down.
+                    this.setXY(offset);
+                    var xy = this.alignEl.getAnchorXY('tl', false);
+                    xy[0]+=2;xy[1]+=5; // << fix me
+                    this.arrowEl.setXY(xy);
+                    return true;
+                }
+                return this.updatePosition('right', false);
                 
+            
         }
         
         
@@ -19964,7 +19997,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         var xy = this.alignEl.getAnchorXY(p1, false);
         xy[0]+=2;xy[1]+=5;
         this.arrowEl.setXY(xy);
-        
+        return true;
     },
     
     hide : function()