# HG changeset patch # User Marcin Kuzminski # Date 1277234662 -7200 # Node ID 6603c9891b91cd8d02ca20f196f50d89bf6b84b3 # Parent 42f5c36820efa89ef7cbe8e8fffa3500f9ca2497 tooltip display bugfix diff -r 42f5c36820ef -r 6603c9891b91 pylons_app/lib/helpers.py --- 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)