[tor-commits] [atlas/master] Fix bug in visualization of tooltip in Firefox

karsten at torproject.org karsten at torproject.org
Thu Mar 21 17:28:33 UTC 2013


commit 3652cfcda57d1f4fa040a2965b1a100df5c92fb1
Author: Arturo Filastò <art at fuffa.org>
Date:   Sun Mar 17 11:35:03 2013 -0400

    Fix bug in visualization of tooltip in Firefox
---
 js/libs/bootstrap/bootstrap-tooltip.js |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/js/libs/bootstrap/bootstrap-tooltip.js b/js/libs/bootstrap/bootstrap-tooltip.js
index 21f2311..10c155f 100644
--- a/js/libs/bootstrap/bootstrap-tooltip.js
+++ b/js/libs/bootstrap/bootstrap-tooltip.js
@@ -129,13 +129,21 @@
 
         actualWidth = $tip[0].offsetWidth
         actualHeight = $tip[0].offsetHeight
-
+        // XXX this is a fix to a bug inside of firefox where the offsetWidth
+        // is not set on svg circle elements.
+        var left_fix;
+        if (pos.width) {
+          left_fix = pos.left + pos.width / 2 - actualWidth / 2;
+        }
+        else {
+          left_fix = pos.left - actualWidth / 2;
+        }
         switch (inside ? placement.split(' ')[1] : placement) {
           case 'bottom':
-            tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
+            tp = {top: pos.top + pos.height, left: left_fix};
             break
           case 'top':
-            tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
+            tp = {top: pos.top - actualHeight, left: left_fix};
             break
           case 'left':
             tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}





More information about the tor-commits mailing list