| author | veltr |
| Wed, 11 Apr 2012 17:06:11 +0200 | |
| changeset 857 | fa614dc66b0b |
| parent 830 | 18ca612e9ff0 |
| child 874 | 38b65761a7d5 |
| permissions | -rw-r--r-- |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
1 |
/* this widget displays a small tooltip */ |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
2 |
IriSP.TooltipWidget = function(Popcorn, config, Serializer) { |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
3 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
| 474 | 4 |
this._shown = false; |
| 477 | 5 |
this._displayedText = ""; |
6 |
this._hideTimeout = -1; |
|
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
7 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
8 |
|
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
9 |
|
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
10 |
IriSP.TooltipWidget.prototype = new IriSP.Widget(); |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
11 |
|
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
12 |
IriSP.TooltipWidget.prototype.draw = function() { |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
13 |
var templ = Mustache.to_html(IriSP.tooltipWidget_template); |
|
827
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
14 |
// position the widget absolutely relative to document. --- NOOOO !!!! |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
15 |
this.selector.css({ |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
16 |
"position": "absolute", |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
17 |
"top": 0, |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
18 |
"left": 0 |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
19 |
}); |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
20 |
this.selector.parent().css({ |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
21 |
"position": "relative" |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
22 |
}); |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
23 |
this.selector.append(templ); |
| 830 | 24 |
var _this = this; |
25 |
this.selector.mouseover(function() { |
|
26 |
_this.hide(); |
|
27 |
}); |
|
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
28 |
this.hide(); |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
29 |
|
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
30 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
31 |
|
|
336
8da13562cfea
segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents:
289
diff
changeset
|
32 |
IriSP.TooltipWidget.prototype.clear = function() { |
| 685 | 33 |
this.selector.find(".tiptext").html(""); |
|
336
8da13562cfea
segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents:
289
diff
changeset
|
34 |
}; |
|
8da13562cfea
segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents:
289
diff
changeset
|
35 |
|
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
36 |
IriSP.TooltipWidget.prototype.show = function(text, color, x, y) { |
| 478 | 37 |
|
| 579 | 38 |
if (this._displayedText == text && this._shown) |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
39 |
return; |
| 579 | 40 |
|
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
41 |
this.selector.find(".tipcolor").css("background-color", color); |
| 477 | 42 |
this._displayedText = text; |
|
827
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
43 |
this.selector.find(".tiptext").html(text); |
| 646 | 44 |
|
|
827
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
45 |
var _tip = this.selector.find(".tip"); |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
46 |
_tip.show(); |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
47 |
_tip.css({ |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
48 |
"left": Math.floor(x - _tip.outerWidth() / 2)+"px", |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
49 |
"top": Math.floor(y - _tip.outerHeight())+"px" |
|
1dc2f85c3b89
BUGFIX: Tooltips are now positioned relative to their parent widget.
veltr
parents:
685
diff
changeset
|
50 |
}); |
| 474 | 51 |
this._shown = true; |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
52 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
53 |
|
| 478 | 54 |
IriSP.TooltipWidget.prototype.hide = function() { |
55 |
this.selector.find(".tip").hide(); |
|
56 |
this._shown = false; |
|
| 487 | 57 |
}; |