src/js/widgets/tooltipWidget.js
branchpopcorn-port
changeset 474 c1998d5d552e
parent 336 8da13562cfea
child 477 1e51d638e7ea
equal deleted inserted replaced
473:1a09ab7e7163 474:c1998d5d552e
     1 /* this widget displays a small tooltip */
     1 /* this widget displays a small tooltip */
     2 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
     2 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
     3   IriSP.Widget.call(this, Popcorn, config, Serializer);
     3   IriSP.Widget.call(this, Popcorn, config, Serializer);
       
     4   this._shown = false;
     4 };
     5 };
     5 
     6 
     6 
     7 
     7 IriSP.TooltipWidget.prototype = new IriSP.Widget();
     8 IriSP.TooltipWidget.prototype = new IriSP.Widget();
     8 
     9 
    17 IriSP.TooltipWidget.prototype.clear = function() {
    18 IriSP.TooltipWidget.prototype.clear = function() {
    18 	this.selector.find(".tiptext").text("");
    19 	this.selector.find(".tiptext").text("");
    19 };
    20 };
    20 
    21 
    21 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
    22 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
    22   if (this.selector.find(".tiptext").text() == text)
    23   if (this._shown === true || this.selector.find(".tiptext").text() == text)
    23     return;
    24     return;
    24 
    25 
    25   this.selector.find(".tipcolor").css("background-color", color);
    26   this.selector.find(".tipcolor").css("background-color", color);
    26 	this.selector.find(".tiptext").text(text);
    27 	this.selector.find(".tiptext").text(text);
    27   this.selector.find(".tip").css("left", x).css("top", y);
    28   this.selector.find(".tip").css("left", x).css("top", y);
       
    29   
       
    30   this._shown = true;
    28 };
    31 };
    29 
    32 
    30 IriSP.TooltipWidget.prototype.hide = function() {
    33 IriSP.TooltipWidget.prototype.hide = function() {
    31   this.clear();
    34   this.clear();
    32   this.selector.find(".tip").css("left", -10000).css("top", -100000);
    35   this.selector.find(".tip").css("left", -10000).css("top", -100000);
       
    36   
       
    37   this._shown = false;
    33 };
    38 };