src/js/widgets/tooltipWidget.js
author hamidouk
Tue, 29 Nov 2011 11:09:08 +0100
branchpopcorn-port
changeset 345 8a088f7daa66
parent 336 8da13562cfea
child 409 aa08a47b3dbb
child 474 c1998d5d552e
permissions -rw-r--r--
rollover over the interface buttons now works as expected. Also changed the width of the buttons to the correct size. Resized the width and height of the sprites to be the same as the boxes we display them in.

/* this widget displays a small tooltip */
IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
  IriSP.Widget.call(this, Popcorn, config, Serializer);
};


IriSP.TooltipWidget.prototype = new IriSP.Widget();

IriSP.TooltipWidget.prototype.draw = function() {
  var templ = Mustache.to_html(IriSP.tooltipWidget_template);

  this.selector.append(templ);
  this.hide();

};

IriSP.TooltipWidget.prototype.clear = function() {
	this.selector.find(".tiptext").text("");
};

IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
  if (this.selector.find(".tiptext").text() == text)
    return;

  this.selector.find(".tipcolor").css("background-color", color);
	this.selector.find(".tiptext").text(text);
  this.selector.find(".tip").css("left", x).css("top", y);
};

IriSP.TooltipWidget.prototype.hide = function() {
  this.clear();
  this.selector.find(".tip").css("left", -10000).css("top", -100000);
};