Adjust gallery 'Stretch to Fit' height when window is resized.

This commit is contained in:
ccd0 2016-02-14 23:31:51 -08:00
parent 635178c39f
commit 3731d49cef

View File

@ -81,6 +81,8 @@ Gallery =
$.on d, 'keydown', cb.keybinds
$.off d, 'keydown', Keybinds.keydown if Conf['Keybinds']
$.on window, 'resize', Gallery.cb.setHeight
for file in $$ '.post .file'
post = Get.postFromNode file
continue unless post.file?.thumb
@ -314,12 +316,13 @@ Gallery =
$.off d, 'keydown', Gallery.cb.keybinds
$.on d, 'keydown', Keybinds.keydown if Conf['Keybinds']
$.off window, 'resize', Gallery.cb.setHeight
clearTimeout Gallery.timeoutID
setFitness: ->
(if @checked then $.addClass else $.rmClass) doc, "gal-#{@name.toLowerCase().replace /\s+/g, '-'}"
setHeight: ->
setHeight: $.debounce 100, ->
{current, frame} = Gallery.nodes
{style} = current
if Conf['Stretch to Fit'] and (dim = g.posts[current.dataset.post]?.file.dimensions)