src/js/widgets/tooltipWidget.js
branchpopcorn-port
changeset 478 1422ba0fc333
parent 477 1e51d638e7ea
child 480 043a159c75f0
equal deleted inserted replaced
477:1e51d638e7ea 478:1422ba0fc333
    20 IriSP.TooltipWidget.prototype.clear = function() {
    20 IriSP.TooltipWidget.prototype.clear = function() {
    21 	this.selector.find(".tiptext").text("");
    21 	this.selector.find(".tiptext").text("");
    22 };
    22 };
    23 
    23 
    24 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
    24 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
    25   if (this._shown === true || this._displayedText == text)
    25 
       
    26   if (this._displayedText == text)
    26     return;
    27     return;
    27     
       
    28   // cancel the timeout for the previously displayed element.
       
    29   if (this._hideTimeout != -1) {
       
    30     window.clearTimeout(this._hideTimeout);
       
    31     this._hideTimeout = -1;
       
    32     console.log(text === this._displayedText);
       
    33   }
       
    34   debugger;
       
    35   
    28   
    36   this.selector.find(".tipcolor").css("background-color", color);
    29   this.selector.find(".tipcolor").css("background-color", color);
    37   this._displayedText = text;
    30   this._displayedText = text;
    38 	this.selector.find(".tiptext").text(text);
    31 	this.selector.find(".tiptext").text(text);
    39   //this.selector.find(".tip").css("left", x).css("top", y);  
    32   //this.selector.find(".tip").css("left", x).css("top", y);  
    40   this.selector.find(".tip").css("left", x).css("top", "-160px");
    33   this.selector.find(".tip").css("left", x).css("top", "-180px");
    41   this.selector.find(".tip").show();
    34   this.selector.find(".tip").show();
    42   this._shown = true;
    35   this._shown = true;
    43 };
    36 };
    44 
    37 
    45 IriSP.TooltipWidget.prototype.hide = function() {  
    38 IriSP.TooltipWidget.prototype.hide = function() {                                                   
    46   this._hideTimeout = window.setTimeout(IriSP.wrap(this, function() {                                                  
    39   console.log("hide");  
    47                                                   this.selector.find(".tip").hide();
    40   this.selector.find(".tip").hide();
    48                                                   this._shown = false; }), 1000);
    41   this._shown = false;  
    49   
       
    50 };
    42 };