Roo/bootstrap/Popover.js
authorAlan Knowles <alan@roojs.com>
Thu, 11 Feb 2021 03:46:43 +0000 (11:46 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 11 Feb 2021 03:46:43 +0000 (11:46 +0800)
Roo/bootstrap/Popover.js

index fd23720..b77309d 100644 (file)
@@ -63,7 +63,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
     maskEl : false, // the mask element
     headerEl : false,
     contentEl : false,
-    
+    alignEl : false, // when show is called with an element - this get's stored.
     
     getChildContainer : function()
     {
@@ -267,12 +267,11 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
      * @param {Roo.Element|string|Boolean} - element to align and point to. (set align to [ pos, offset ])
      * @param {string} (left|right|top|bottom) position
      */
-    show : function (on_el)
+    show : function (on_el, placement)
     {
-        
+        this.placement = typeof(placement) == 'undefined' ?  this.placement   : placement;
         on_el = on_el || false; // default to false
-        var align = on_el && typeof(on_el._align) != 'undefined' ? on_el._align : false;
-        
+         
         if (!on_el) {
             if (this.parent() && (this.over == 'parent' || (this.over === false))) {
                 on_el = this.parent().el;
@@ -296,10 +295,8 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
             this.headerEl.hide();
         }
         
+        // why make it so complicated... - we used to support functional calls for this .. why ?
         
-        var placement = typeof this.placement == 'function' ?
-            this.placement.call(this, this.el, on_el) :
-            this.placement;
             
         /*
         var autoToken = /\s?auto?\s?/i;   /// not sure how this was supposed to work? right auto ? what?
@@ -322,13 +319,9 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         var box = this.el.getBox();
         
         
-        this.alignment = align || Roo.bootstrap.Popover.alignment[placement];
-        this.el.addClass(this.alignment[2]);
-
-//        Roo.log(align);
+        this.el.addClass(placement + ' roo-popover-' + placement);
 
         if (on_el) {
-            this.alignEl = on_el;
             this.updatePosition();
              
         } else {