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']
|
if Conf['Autoplay']
|
||||||
el.play()
|
el.play()
|
||||||
@currentTime = el.currentTime if @nodeName is 'VIDEO'
|
@currentTime = el.currentTime if @nodeName is 'VIDEO'
|
||||||
[width, height] = (+x for x in file.dimensions.split 'x')
|
if file.dimensions
|
||||||
{left, right} = @getBoundingClientRect()
|
[width, height] = (+x for x in file.dimensions.split 'x')
|
||||||
maxWidth = doc.clientWidth
|
maxWidth = doc.clientWidth
|
||||||
maxHeight = doc.clientHeight - UI.hover.padding
|
maxHeight = doc.clientHeight - UI.hover.padding
|
||||||
scale = Math.min 1, maxWidth / width, maxHeight / height
|
scale = Math.min 1, maxWidth / width, maxHeight / height
|
||||||
el.style.maxWidth = "#{scale * width}px"
|
width *= scale
|
||||||
el.style.maxHeight = "#{scale * height}px"
|
height *= scale
|
||||||
|
el.style.maxWidth = "#{width}px"
|
||||||
|
el.style.maxHeight = "#{height}px"
|
||||||
UI.hover
|
UI.hover
|
||||||
root: @
|
root: @
|
||||||
el: el
|
el: el
|
||||||
latestEvent: e
|
latestEvent: e
|
||||||
endEvents: 'mouseout click'
|
endEvents: 'mouseout click'
|
||||||
height: scale * height
|
height: height
|
||||||
width: scale * width
|
width: width
|
||||||
noRemove: true
|
noRemove: true
|
||||||
cb: ->
|
cb: ->
|
||||||
$.off el, 'error', error
|
$.off el, 'error', error
|
||||||
|
|||||||
@ -1350,6 +1350,10 @@ span.hide-announcement {
|
|||||||
}
|
}
|
||||||
#ihover {
|
#ihover {
|
||||||
pointer-events: none;
|
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 Metadata */
|
||||||
.webm-title > a::before {
|
.webm-title > a::before {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user