hints: fix bug in the correction of coordinates based on zoom level

This commit is contained in:
Jakub Klinkovský 2016-02-19 21:15:56 +01:00
parent 97d2038528
commit 1cff16b3b4

View File

@ -443,6 +443,13 @@ class HintManager(QObject):
width = rect.get("width", 0)
height = rect.get("height", 0)
if width > 0 and height > 0:
# fix coordinates according to zoom level
zoom = elem.webFrame().zoomFactor()
if not config.get('ui', 'zoom-text-only'):
rect["left"] *= zoom
rect["top"] *= zoom
width *= zoom
height *= zoom
return QRect(rect["left"], rect["top"], width, height)
return elem.rect_on_view()
@ -472,15 +479,9 @@ class HintManager(QObject):
rect = self._get_first_rectangle(elem)
pos = rect.center()
# fix coordinates according to zoom level
zoom = elem.webFrame().zoomFactor()
if not config.get('ui', 'zoom-text-only'):
pos.setX(pos.x() * zoom)
pos.setY(pos.y() * zoom)
action = "Hovering" if context.target == Target.hover else "Clicking"
log.hints.debug("{} on '{}' at position {} (zoom = {})".format(
action, elem.debug_text(), pos, zoom))
log.hints.debug("{} on '{}' at position {}".format(
action, elem.debug_text(), pos))
self.start_hinting.emit(target_mapping[context.target])
if context.target in [Target.tab, Target.tab_fg, Target.tab_bg,