diff --git a/src/General/UI.coffee b/src/General/UI.coffee index 388aea7c4..929f85278 100644 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -309,6 +309,7 @@ dragend = -> $.set "#{@id}.position", @style.cssText hoverstart = ({root, el, latestEvent, endEvents, height, width, cb, noRemove}) -> + rect = root.getBoundingClientRect() o = { root el @@ -322,6 +323,8 @@ hoverstart = ({root, el, latestEvent, endEvents, height, width, cb, noRemove}) - height width noRemove + clientX: (rect.left + rect.right) / 2 + clientY: (rect.top + rect.bottom) / 2 } o.hover = hover.bind o o.hoverend = hoverend.bind o @@ -346,7 +349,7 @@ hover = (e) -> @latestEvent = e height = (@height or @el.offsetHeight) + hoverstart.padding width = (@width or @el.offsetWidth) - {clientX, clientY} = e + {clientX, clientY} = if Conf['Follow Cursor'] then e else @ top = if @isImage Math.max 0, clientY * (@clientHeight - height) / @clientHeight diff --git a/src/config/Config.coffee b/src/config/Config.coffee index fdcc39acc..8b388305c 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -19,6 +19,10 @@ Config = 'Show a notice at the top of the page when the index is refreshed.' 1 ] + 'Follow Cursor': [ + true + 'Image Hover and Quote Preview move with the mouse cursor.' + ] 'Open Threads in New Tab': [ false 'Make links to threads in the index / <%= meta.name %> catalog open in a new tab.'