changeset 286:6603c9891b91

tooltip display bugfix
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 22 Jun 2010 21:24:22 +0200
parents 42f5c36820ef
children 5827c739b0bd
files pylons_app/lib/helpers.py
diffstat 1 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/helpers.py	Mon Jun 14 01:16:57 2010 +0200
+++ b/pylons_app/lib/helpers.py	Tue Jun 22 21:24:22 2010 +0200
@@ -119,6 +119,9 @@
                     var context = args[0];
                     var txt = context.getAttribute('tooltip_title');
                     if(txt){
+                        this.cfg.config.x.value = 0;
+                        this.cfg.config.y.value = 0;
+                                        
                         return true;
                     }
                     else{
@@ -126,13 +129,38 @@
                     }
                 });
             
+                            
             // Set the text for the tooltip just before we display it. Lazy method
             myToolTips.contextTriggerEvent.subscribe( 
                  function(type, args) { 
                         var context = args[0]; 
                         var txt = context.getAttribute('tooltip_title');
-                        this.cfg.setProperty("text", txt);                     
+                        this.cfg.setProperty("text", txt);
+                        //autocenter
+                        var w = this.element.clientWidth;
+                        var h = this.element.clientHeight;
+                        var cur_x = this.pageX - (w / 2);
+                        var cur_y = this.pageY - h - 10;
+
+                        this.cfg.setProperty("xy",[cur_x,cur_y]);
+
                   });
+            //Mouse out 
+            myToolTips.contextMouseOutEvent.subscribe(
+                function(type, args) {
+                    var context = args[0];
+                    
+                    //console.log(this.cfg.config.x.value);
+                    //console.log(this.cfg.config.y.value);
+                    //console.log(this.cfg.config.xy.value);
+                    //console.log(this.cfg.config);
+                    //this.cfg.config.xy = [0,0];
+                    //this.cfg.config.xyoffset = [0,0];
+                    
+                    
+                    
+                });
+                                  
         });
         '''         
         return literal(js)