diff --git a/src/General/UI.coffee b/src/General/UI.coffee index c57bc0251..388aea7c4 100644 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -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' diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index ee47c120e..fdce1854e 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -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 diff --git a/src/css/style.css b/src/css/style.css index 935f73bdd..89d12663a 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -1344,6 +1344,9 @@ span.hide-announcement { .fileThumb > .warning { clear: both; } +#ihover { + pointer-events: none; +} /* WEBM Metadata */ .webm-title > a::before { content: "title";