Show More
@@ -119,9 +119,6 b' class _ToolTip(object):' | |||
|
119 | 119 | var context = args[0]; |
|
120 | 120 | var txt = context.getAttribute('tooltip_title'); |
|
121 | 121 | if(txt){ |
|
122 | this.cfg.config.x.value = 0; | |
|
123 | this.cfg.config.y.value = 0; | |
|
124 | ||
|
125 | 122 | return true; |
|
126 | 123 | } |
|
127 | 124 | else{ |
@@ -133,34 +130,61 b' class _ToolTip(object):' | |||
|
133 | 130 | // Set the text for the tooltip just before we display it. Lazy method |
|
134 | 131 | myToolTips.contextTriggerEvent.subscribe( |
|
135 | 132 | function(type, args) { |
|
133 | ||
|
134 | ||
|
136 | 135 | var context = args[0]; |
|
136 | ||
|
137 | 137 | var txt = context.getAttribute('tooltip_title'); |
|
138 | 138 | this.cfg.setProperty("text", txt); |
|
139 |
|
|
|
140 | var w = this.element.clientWidth; | |
|
141 | var h = this.element.clientHeight; | |
|
142 |
var |
|
|
143 |
var |
|
|
139 | ||
|
140 | ||
|
141 | // positioning of tooltip | |
|
142 | var tt_w = this.element.clientWidth; | |
|
143 | var tt_h = this.element.clientHeight; | |
|
144 | ||
|
145 | var context_w = context.offsetWidth; | |
|
146 | var context_h = context.offsetHeight; | |
|
147 | ||
|
148 | var pos_x = YAHOO.util.Dom.getX(context); | |
|
149 | var pos_y = YAHOO.util.Dom.getY(context); | |
|
150 | ||
|
151 | var display_strategy = 'top'; | |
|
152 | var xy_pos= [0,0] | |
|
153 | switch (display_strategy){ | |
|
144 | 154 | |
|
145 | this.cfg.setProperty("xy",[cur_x,cur_y]); | |
|
155 | case 'top': | |
|
156 | var cur_x = (pos_x+context_w/2)-(tt_w/2); | |
|
157 | var cur_y = pos_y-tt_h-4; | |
|
158 | xy_pos = [cur_x,cur_y]; | |
|
159 | break; | |
|
160 | case 'bottom': | |
|
161 | var cur_x = (pos_x+context_w/2)-(tt_w/2); | |
|
162 | var cur_y = pos_y+context_h+4; | |
|
163 | xy_pos = [cur_x,cur_y]; | |
|
164 | break; | |
|
165 | case 'left': | |
|
166 | var cur_x = (pos_x-tt_w-4); | |
|
167 | var cur_y = pos_y-((tt_h/2)-context_h/2); | |
|
168 | xy_pos = [cur_x,cur_y]; | |
|
169 | break; | |
|
170 | case 'right': | |
|
171 | var cur_x = (pos_x+context_w+4); | |
|
172 | var cur_y = pos_y-((tt_h/2)-context_h/2); | |
|
173 | xy_pos = [cur_x,cur_y]; | |
|
174 | break; | |
|
175 | ||
|
176 | } | |
|
177 | ||
|
178 | this.cfg.setProperty("xy",xy_pos); | |
|
146 | 179 | |
|
147 | 180 | }); |
|
181 | ||
|
148 | 182 | //Mouse out |
|
149 | 183 | myToolTips.contextMouseOutEvent.subscribe( |
|
150 | 184 | function(type, args) { |
|
151 | 185 | var context = args[0]; |
|
152 | 186 | |
|
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 | 187 | }); |
|
163 | ||
|
164 | 188 | }); |
|
165 | 189 | ''' |
|
166 | 190 | return literal(js) |
General Comments 0
You need to be logged in to leave comments.
Login now