comparison pylons_app/lib/helpers.py @ 296:6603c9891b91

tooltip display bugfix
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 22 Jun 2010 21:24:22 +0200
parents c4caeca9dd66
children 5827c739b0bd
comparison
equal deleted inserted replaced
294:42f5c36820ef 296:6603c9891b91
117 myToolTips.contextMouseOverEvent.subscribe( 117 myToolTips.contextMouseOverEvent.subscribe(
118 function(type, args) { 118 function(type, args) {
119 var context = args[0]; 119 var context = args[0];
120 var txt = context.getAttribute('tooltip_title'); 120 var txt = context.getAttribute('tooltip_title');
121 if(txt){ 121 if(txt){
122 this.cfg.config.x.value = 0;
123 this.cfg.config.y.value = 0;
124
122 return true; 125 return true;
123 } 126 }
124 else{ 127 else{
125 return false; 128 return false;
126 } 129 }
127 }); 130 });
128 131
132
129 // Set the text for the tooltip just before we display it. Lazy method 133 // Set the text for the tooltip just before we display it. Lazy method
130 myToolTips.contextTriggerEvent.subscribe( 134 myToolTips.contextTriggerEvent.subscribe(
131 function(type, args) { 135 function(type, args) {
132 var context = args[0]; 136 var context = args[0];
133 var txt = context.getAttribute('tooltip_title'); 137 var txt = context.getAttribute('tooltip_title');
134 this.cfg.setProperty("text", txt); 138 this.cfg.setProperty("text", txt);
139 //autocenter
140 var w = this.element.clientWidth;
141 var h = this.element.clientHeight;
142 var cur_x = this.pageX - (w / 2);
143 var cur_y = this.pageY - h - 10;
144
145 this.cfg.setProperty("xy",[cur_x,cur_y]);
146
135 }); 147 });
148 //Mouse out
149 myToolTips.contextMouseOutEvent.subscribe(
150 function(type, args) {
151 var context = args[0];
152
153 //console.log(this.cfg.config.x.value);
154 //console.log(this.cfg.config.y.value);
155 //console.log(this.cfg.config.xy.value);
156 //console.log(this.cfg.config);
157 //this.cfg.config.xy = [0,0];
158 //this.cfg.config.xyoffset = [0,0];
159
160
161
162 });
163
136 }); 164 });
137 ''' 165 '''
138 return literal(js) 166 return literal(js)
139 167
140 tooltip = _ToolTip() 168 tooltip = _ToolTip()