Show More
@@ -65,7 +65,7 define([ | |||
|
65 | 65 | this._clocklink = $('<a/>').attr('href', "#"); |
|
66 | 66 | this._clocklink.attr('role', "button"); |
|
67 | 67 | this._clocklink.addClass('ui-button'); |
|
68 | this._clocklink.attr('title', 'Tootip is not dismissed while typing for 10 seconds'); | |
|
68 | this._clocklink.attr('title', 'Tooltip is not dismissed while typing for 10 seconds'); | |
|
69 | 69 | var clockspan = $('<span/>').text('Close'); |
|
70 | 70 | clockspan.addClass('ui-icon'); |
|
71 | 71 | clockspan.addClass('ui-icon-clock'); |
@@ -273,20 +273,22 define([ | |||
|
273 | 273 | this.name = content.name; |
|
274 | 274 | |
|
275 | 275 | // do some math to have the tooltip arrow on more or less on left or right |
|
276 |
// |
|
|
277 |
var |
|
|
278 | // ofset of the editor | |
|
279 | var o = $(this.code_mirror.getScrollerElement()).offset(); | |
|
280 | ||
|
281 | // whatever anchor/head order but arrow at mid x selection | |
|
282 | var anchor = this.code_mirror.cursorCoords(false); | |
|
283 | var head = this.code_mirror.cursorCoords(true); | |
|
284 | var xinit = (head.left+anchor.left)/2; | |
|
285 | var xinter = o.left + (xinit - o.left) / w * (w - 450); | |
|
286 | var posarrowleft = xinit - xinter; | |
|
276 | // position of the editor | |
|
277 | var cm_pos = $(this.code_mirror.getWrapperElement()).position(); | |
|
278 | ||
|
279 | // anchor and head positions are local within CodeMirror element | |
|
280 | var anchor = this.code_mirror.cursorCoords(false, 'local'); | |
|
281 | var head = this.code_mirror.cursorCoords(true, 'local'); | |
|
282 | // locate the target at the center of anchor, head | |
|
283 | var center_left = (head.left + anchor.left) / 2; | |
|
284 | // locate the left edge of the tooltip, at most 450 px left of the arrow | |
|
285 | var edge_left = Math.max(center_left - 450, 0); | |
|
286 | // locate the arrow at the cursor. A 24 px offset seems necessary. | |
|
287 | var arrow_left = center_left - edge_left - 24; | |
|
287 | 288 | |
|
288 | var left = xinter - 30 + 'px'; | |
|
289 |
var t |
|
|
289 | // locate left, top within container element | |
|
290 | var left = (cm_pos.left + edge_left) + 'px'; | |
|
291 | var top = (cm_pos.top + head.bottom + 10) + 'px'; | |
|
290 | 292 | |
|
291 | 293 | if (this._hidden === false) { |
|
292 | 294 | this.tooltip.animate({ |
@@ -302,7 +304,7 define([ | |||
|
302 | 304 | }); |
|
303 | 305 | } |
|
304 | 306 | this.arrow.animate({ |
|
305 |
'left': |
|
|
307 | 'left': arrow_left + 'px' | |
|
306 | 308 | }); |
|
307 | 309 | |
|
308 | 310 | this._hidden = false; |
General Comments 0
You need to be logged in to leave comments.
Login now