hints: change click position to the center of the largest square fitting to the top/left corner of the rectangle
This commit is contained in:
parent
0f8b298fad
commit
4c06e34074
@ -482,11 +482,15 @@ class HintManager(QObject):
|
|||||||
else:
|
else:
|
||||||
target_mapping[Target.tab] = usertypes.ClickTarget.tab
|
target_mapping[Target.tab] = usertypes.ClickTarget.tab
|
||||||
|
|
||||||
# FIXME Instead of clicking the center, we could have nicer heuristics.
|
# Click the center of the largest square fitting into the top/left
|
||||||
# e.g. parse (-webkit-)border-radius correctly and click text fields at
|
# corner of the rectangle, this will help if part of the <a> element
|
||||||
# the bottom right, and everything else on the top left or so.
|
# is hidden behind other elements
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/70
|
# https://github.com/The-Compiler/qutebrowser/issues/1005
|
||||||
rect = self._get_first_rectangle(elem)
|
rect = self._get_first_rectangle(elem)
|
||||||
|
if rect.width() > rect.height():
|
||||||
|
rect.setWidth(rect.height())
|
||||||
|
else:
|
||||||
|
rect.setHeight(rect.width())
|
||||||
pos = rect.center()
|
pos = rect.center()
|
||||||
|
|
||||||
action = "Hovering" if context.target == Target.hover else "Clicking"
|
action = "Hovering" if context.target == Target.hover else "Clicking"
|
||||||
|
Loading…
Reference in New Issue
Block a user