Make movement of image hover / quote preview with mouse optional; option is Follow Cursor. #471, #2245

This commit is contained in:
ccd0 2019-03-24 07:16:45 -07:00
parent b09b190e7a
commit 501a103a1d
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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.'