| author | veltr |
| Thu, 10 May 2012 18:48:09 +0200 | |
| branch | new-model |
| changeset 887 | 6a04bd37da0a |
| parent 882 | 61c384dda19e |
| child 922 | 096c06aea8b5 |
| 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 */ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
2 |
IriSP.Widgets.Tooltip = function(Popcorn, config, Serializer) { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
3 |
IriSP.Widgets.Widget.call(this, Popcorn, config, Serializer); |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
4 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
5 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
6 |
IriSP.Widgets.Tooltip.prototype = new IriSP.Widgets.Widget(); |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
7 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
8 |
IriSP.Widgets.Tooltip.prototype.template = '<div class="Ldt-Tooltip"><div class="Ldt-Tooltip-Color"></div><div class="Ldt-Tooltip-Text"></div></div>'; |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
9 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
10 |
IriSP.Widgets.Tooltip.prototype.draw = function() { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
11 |
_this = this; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
12 |
this.$.html(this.template); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
13 |
this.$.parent().css({ |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
14 |
"position" : "relative" |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
15 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
16 |
this.$tip = this.$.find(".Ldt-Tooltip"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
17 |
this.$.mouseover(function() { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
18 |
_this.$tip.hide(); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
19 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
20 |
this.hide(); |
|
336
8da13562cfea
segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents:
289
diff
changeset
|
21 |
}; |
|
8da13562cfea
segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents:
289
diff
changeset
|
22 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
23 |
IriSP.Widgets.Tooltip.prototype.show = function(x, y, text, color) { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
24 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
25 |
if (typeof color !== "undefined") { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
26 |
this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
27 |
} else { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
28 |
this.$.find(".Ldt-Tooltip-Color").hide(); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
29 |
} |
| 882 | 30 |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
31 |
this.$.find(".Ldt-Tooltip-Text").html(text); |
| 579 | 32 |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
33 |
this.$tip.show(); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
34 |
this.$tip.css({ |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
35 |
"left" : Math.floor(x - this.$tip.outerWidth() / 2) + "px", |
| 882 | 36 |
"top" : Math.floor(y - this.$tip.outerHeight()) + "px" |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
37 |
}); |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
38 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
39 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
40 |
IriSP.Widgets.Tooltip.prototype.hide = function() { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
41 |
this.$tip.hide(); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
830
diff
changeset
|
42 |
}; |