##// END OF EJS Templates
Merge pull request #7605 from minrk/f-the-pager...
Thomas Kluyver -
r20229:f3af2702 merge
parent child Browse files
Show More
@@ -65,7 +65,7 b' 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,33 +273,38 b' 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 // width of the editor
277 var w = $(this.code_mirror.getScrollerElement()).width();
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;
288
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';
287 292
288 293 if (this._hidden === false) {
289 294 this.tooltip.animate({
290 'left': xinter - 30 + 'px',
291 'top': (head.bottom + 10) + 'px'
295 left: left,
296 top: top
292 297 });
293 298 } else {
294 299 this.tooltip.css({
295 'left': xinter - 30 + 'px'
300 left: left
296 301 });
297 302 this.tooltip.css({
298 'top': (head.bottom + 10) + 'px'
303 top: top
299 304 });
300 305 }
301 306 this.arrow.animate({
302 'left': posarrowleft + 'px'
307 'left': arrow_left + 'px'
303 308 });
304 309
305 310 this._hidden = false;
@@ -16,7 +16,7 b' div#pager {'
16 16 z-index: 100;
17 17
18 18 /* Hack which prevents jquery ui resizable from changing top. */
19 top: inherit !important;
19 top: auto !important;
20 20
21 21 pre {
22 22 line-height: @code_line_height;
@@ -10909,7 +10909,7 b' div#pager {'
10909 10909 /* Display over codemirror */
10910 10910 z-index: 100;
10911 10911 /* Hack which prevents jquery ui resizable from changing top. */
10912 top: inherit !important;
10912 top: auto !important;
10913 10913 }
10914 10914 div#pager pre {
10915 10915 line-height: 1.21429em;
@@ -287,13 +287,18 b' data-notebook-path="{{notebook_path}}"'
287 287
288 288 {% block site %}
289 289
290
291 290 <div id="ipython-main-app">
292 291 <div id="notebook_panel">
293 292 <div id="notebook"></div>
294 293 </div>
295 294 </div>
296 295
296 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
297
298 {% endblock %}
299
300 {% block after_site %}
301
297 302 <div id="pager">
298 303 <div id="pager-contents">
299 304 <div id="pager-container" class="container"></div>
@@ -301,12 +306,8 b' data-notebook-path="{{notebook_path}}"'
301 306 <div id='pager-button-area'></div>
302 307 </div>
303 308
304 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
305
306
307 309 {% endblock %}
308 310
309
310 311 {% block script %}
311 312 {{super()}}
312 313 <script type="text/javascript">
@@ -111,6 +111,9 b''
111 111 {% endblock %}
112 112 </div>
113 113
114 {% block after_site %}
115 {% endblock %}
116
114 117 {% block script %}
115 118 {% endblock %}
116 119
General Comments 0
You need to be logged in to leave comments. Login now