Allow image hover previews to use full width of screen.

This commit is contained in:
ccd0 2019-03-17 05:42:50 -07:00
parent cafb7250c7
commit fafdc4fa44
3 changed files with 12 additions and 6 deletions

View File

@ -308,7 +308,7 @@ dragend = ->
$.off d, 'mouseup', @up
$.set "#{@id}.position", @style.cssText
hoverstart = ({root, el, latestEvent, endEvents, height, cb, noRemove}) ->
hoverstart = ({root, el, latestEvent, endEvents, height, width, cb, noRemove}) ->
o = {
root
el
@ -320,6 +320,7 @@ hoverstart = ({root, el, latestEvent, endEvents, height, cb, noRemove}) ->
clientHeight: doc.clientHeight
clientWidth: doc.clientWidth
height
width
noRemove
}
o.hover = hover.bind o
@ -344,6 +345,7 @@ hoverstart.padding = 25
hover = (e) ->
@latestEvent = e
height = (@height or @el.offsetHeight) + hoverstart.padding
width = (@width or @el.offsetWidth)
{clientX, clientY} = e
top = if @isImage
@ -353,10 +355,10 @@ hover = (e) ->
threshold = @clientWidth / 2
threshold = Math.max threshold, @clientWidth - 400 unless @isImage
[left, right] = if clientX <= threshold
[clientX + 45 + 'px', '']
else
['', @clientWidth - clientX + 45 + 'px']
marginX = (if clientX <= threshold then clientX else @clientWidth - clientX) + 45
marginX = Math.min(marginX, @clientWidth - width) if @isImage
marginX += 'px'
[left, right] = if clientX <= threshold then [marginX, ''] else ['', marginX]
{style} = @
style.top = top + 'px'

View File

@ -48,7 +48,7 @@ ImageHover =
@currentTime = el.currentTime if @nodeName is 'VIDEO'
[width, height] = (+x for x in file.dimensions.split 'x')
{left, right} = @getBoundingClientRect()
maxWidth = Math.max left, doc.clientWidth - right
maxWidth = doc.clientWidth
maxHeight = doc.clientHeight - UI.hover.padding
scale = Math.min 1, maxWidth / width, maxHeight / height
el.style.maxWidth = "#{scale * width}px"
@ -59,6 +59,7 @@ ImageHover =
latestEvent: e
endEvents: 'mouseout click'
height: scale * height
width: scale * width
noRemove: true
cb: ->
$.off el, 'error', error

View File

@ -1344,6 +1344,9 @@ span.hide-announcement {
.fileThumb > .warning {
clear: both;
}
#ihover {
pointer-events: none;
}
/* WEBM Metadata */
.webm-title > a::before {
content: "title";