Fix image/video hover in case where dimensions are not available. #2197
This commit is contained in:
parent
501a103a1d
commit
8f9d7c984f
@ -46,20 +46,22 @@ ImageHover =
|
||||
if Conf['Autoplay']
|
||||
el.play()
|
||||
@currentTime = el.currentTime if @nodeName is 'VIDEO'
|
||||
[width, height] = (+x for x in file.dimensions.split 'x')
|
||||
{left, right} = @getBoundingClientRect()
|
||||
maxWidth = doc.clientWidth
|
||||
maxHeight = doc.clientHeight - UI.hover.padding
|
||||
scale = Math.min 1, maxWidth / width, maxHeight / height
|
||||
el.style.maxWidth = "#{scale * width}px"
|
||||
el.style.maxHeight = "#{scale * height}px"
|
||||
if file.dimensions
|
||||
[width, height] = (+x for x in file.dimensions.split 'x')
|
||||
maxWidth = doc.clientWidth
|
||||
maxHeight = doc.clientHeight - UI.hover.padding
|
||||
scale = Math.min 1, maxWidth / width, maxHeight / height
|
||||
width *= scale
|
||||
height *= scale
|
||||
el.style.maxWidth = "#{width}px"
|
||||
el.style.maxHeight = "#{height}px"
|
||||
UI.hover
|
||||
root: @
|
||||
el: el
|
||||
latestEvent: e
|
||||
endEvents: 'mouseout click'
|
||||
height: scale * height
|
||||
width: scale * width
|
||||
height: height
|
||||
width: width
|
||||
noRemove: true
|
||||
cb: ->
|
||||
$.off el, 'error', error
|
||||
|
||||
@ -1350,6 +1350,10 @@ span.hide-announcement {
|
||||
}
|
||||
#ihover {
|
||||
pointer-events: none;
|
||||
/* XXX https://code.google.com/p/chromium/issues/detail?id=168840, https://bugs.webkit.org/show_bug.cgi?id=94158 */
|
||||
max-height: 95vh;
|
||||
max-height: calc(100vh - 25px);
|
||||
max-width: 100vw;
|
||||
}
|
||||
/* WEBM Metadata */
|
||||
.webm-title > a::before {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user