Closed gorhill closed 10 years ago
The div main element has a margin of -390px, and a left position of 390px (position
is relative
). I suspect the problem is the browser's Element.getBoundingClientRect
implementation.
Quick fix: Replace both lines in highlightElements()
'M', r.left + offx, ' ', r.top + offy,
with
'M', r.left - document.body.getBoundingClientRect().left + offx, ' ', r.top + offy,
As long as the Element.getBoundingClientRect
isn't working as expected, this works for me, at least, all tested websites looked alright with the picker.
Thanks for the finding, I will try it.
Ok, this works so long as the document is not scrolled. As soon as you scroll, the highlighted rectangle becomes sticky rather than scroll with the position of the highlighted element.
Need something more, will look into it.
Ok, replacing offx
entirely with -bodyRect.left
seems to do the trick (also applies to offy
).
This issue seems to be fixed on http://xkcd.com/. Unfortunately, now it seems to manifest in places where it hadn't before. Such as http://what-if.xkcd.com/ and http://oeis.org/.
It looks like the issue after scrolling has re-emerged. Otherwise, this fix works great.
after scrolling
?
@gorhill Please look at my last comment on #275, there is a new issue regarding this fix I suppose. Thanks.
Perhaps this scrolling issue is unique to me, or to people with similar setups. I'm on µBlock 0.7.0.5 on Chrome 40.0.2182.3 dev-m (64-bit) on Windows 8.1. Picking an element without any scrolling works fine: Picking the same element after scrolling slightly results in a misalignment by the amount scrolled:
@pwstokes225 I could not reproduce the glitch... µBlock 0.7.0.5 on Chrome 38.0.2125.101 m (64-bit) on Windows 8.1.
@pwstokes225a as ialexsilva I couldn't reproduce this. µBlock 0.7.0.5 on Chrome 38.0.2125.101 m (32bit)
Okay, I have confirmed my issue resulted from a flag in chrome://flags/. I'm not certain which one, but the element picker works fine now that I've reset all the flags to their default.
Reported as a comment in #190, it's a different issue than #190 though.