Changed hinting visibility check.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 12 Oct 2013 11:15:32 +0000 (13:15 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 12 Oct 2013 11:15:32 +0000 (13:15 +0200)
Don't even check if the point in the center of the element is the element
itself, because this caused broken links to be not hintable, if the second
link line didn't reach the center of the above line. So now the element is
checked for the upper left corner too.

src/hints.js

index 8857c79..2a1deeb 100644 (file)
@@ -46,14 +46,12 @@ var VbHint = (function(){
                 if (cStyle.display === "none" || cStyle.visibility !== "visible") {
                     return false;
                 }
-                /* check if the element at the center of current is that element self */
-                /* else the element is covers by another element or within a hidden container */
-                if (!e.childElementCount
-                    && e.ownerDocument.elementFromPoint((rect.left + rect.right)/2, (rect.top + rect.bottom)/2) !== e
-                ) {
-                    return false;
-                }
-                return true;
+
+                /* check if the element at the left top or center of current is the element self */
+                /* else the element is covered by another element or within a hidden container */
+                return e.childElementCount > 0
+                    || e.ownerDocument.elementFromPoint((rect.left + rect.right)/2, (rect.top + rect.bottom)/2) === e
+                    || e.ownerDocument.elementFromPoint(rect.left, rect.top + rect.bottom) === e
             }
 
             var doc   = win.document,