fixed a position bug. popcorn-port
authorhamidouk
Mon, 14 Nov 2011 12:16:27 +0100
branchpopcorn-port
changeset 231 accc7358d8b5
parent 228 53d8d95a0079
child 232 cf3fffbb2cb0
fixed a position bug.
src/css/LdtPlayer.css
src/js/widgets/polemicWidget.js
src/js/widgets/tooltipWidget.js
unittests/tests/tooltipWidget.js
--- a/src/css/LdtPlayer.css	Thu Nov 10 17:25:30 2011 +0100
+++ b/src/css/LdtPlayer.css	Mon Nov 14 12:16:27 2011 +0100
@@ -183,7 +183,8 @@
 		}
 		
 		.tip{
-			position : absolute;
+			position : fixed; /* why not absolute instead of fixed ? because the div containing the tooltip widget is not a subdiv of its parent
+                           widget */
 			padding : 3px;
 			z-index: 10000000000;
 			max-width: 200px;			
@@ -196,7 +197,6 @@
 			padding-top: 15px;
 			padding-right: 15px;
 			color: black;
-			z-index: 10000000000;
 			font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
 			overflow:hidden;
 		}
--- a/src/js/widgets/polemicWidget.js	Thu Nov 10 17:25:30 2011 +0100
+++ b/src/js/widgets/polemicWidget.js	Mon Nov 14 12:16:27 2011 +0100
@@ -275,11 +275,11 @@
                   e.time= frames[i].mytweetsID[k].timeframe;
                   e.title= frames[i].mytweetsID[k].title;
                   
-                  e.mouseover(function(element) { return function (event) {                                             
-                  
-                        // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.
+                  e.mouseover(function(element) { return function (event) {
+                        // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
                         element.displayed = true;
+                        debugger;
                   }}(e)).mouseout(function(element) { return function () {                          
                           self.TooltipWidget.hide.call(self.TooltipWidget);
                   }}(e)).mousedown(function () {
--- a/src/js/widgets/tooltipWidget.js	Thu Nov 10 17:25:30 2011 +0100
+++ b/src/js/widgets/tooltipWidget.js	Mon Nov 14 12:16:27 2011 +0100
@@ -8,6 +8,7 @@
 
 IriSP.TooltipWidget.prototype.draw = function() {
   var templ = Mustache.to_html(IriSP.tooltipWidget_template);
+    
   this.selector.append(templ);
   this.hide();
   
--- a/unittests/tests/tooltipWidget.js	Thu Nov 10 17:25:30 2011 +0100
+++ b/unittests/tests/tooltipWidget.js	Mon Nov 14 12:16:27 2011 +0100
@@ -26,6 +26,7 @@
     widget.draw();
 
     equal(widget.selector.children(".tip").length, 1, "test if the div has been added correctly");
+    equal(widget.selector.children(".tip").css("position"), "fixed", "test if the widget has the correct position attr");    
     equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
     equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
   });
@@ -38,7 +39,7 @@
     equal(widget.selector.children(".tip").css("left"), "105px", "test if div has been positionned correctly");
     equal(widget.selector.children(".tip").css("top"), "240px", "test if div has been positionned correctly");    
     equal(widget.selector.find(".tiptext").text(), "ceci est un texte", "test if text has been set correctly");
-  
+    
     widget.hide();
     equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
     equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");