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