Adjust gallery 'Stretch to Fit' height when window is resized.
This commit is contained in:
parent
635178c39f
commit
3731d49cef
@ -81,6 +81,8 @@ Gallery =
|
|||||||
$.on d, 'keydown', cb.keybinds
|
$.on d, 'keydown', cb.keybinds
|
||||||
$.off d, 'keydown', Keybinds.keydown if Conf['Keybinds']
|
$.off d, 'keydown', Keybinds.keydown if Conf['Keybinds']
|
||||||
|
|
||||||
|
$.on window, 'resize', Gallery.cb.setHeight
|
||||||
|
|
||||||
for file in $$ '.post .file'
|
for file in $$ '.post .file'
|
||||||
post = Get.postFromNode file
|
post = Get.postFromNode file
|
||||||
continue unless post.file?.thumb
|
continue unless post.file?.thumb
|
||||||
@ -314,12 +316,13 @@ Gallery =
|
|||||||
|
|
||||||
$.off d, 'keydown', Gallery.cb.keybinds
|
$.off d, 'keydown', Gallery.cb.keybinds
|
||||||
$.on d, 'keydown', Keybinds.keydown if Conf['Keybinds']
|
$.on d, 'keydown', Keybinds.keydown if Conf['Keybinds']
|
||||||
|
$.off window, 'resize', Gallery.cb.setHeight
|
||||||
clearTimeout Gallery.timeoutID
|
clearTimeout Gallery.timeoutID
|
||||||
|
|
||||||
setFitness: ->
|
setFitness: ->
|
||||||
(if @checked then $.addClass else $.rmClass) doc, "gal-#{@name.toLowerCase().replace /\s+/g, '-'}"
|
(if @checked then $.addClass else $.rmClass) doc, "gal-#{@name.toLowerCase().replace /\s+/g, '-'}"
|
||||||
|
|
||||||
setHeight: ->
|
setHeight: $.debounce 100, ->
|
||||||
{current, frame} = Gallery.nodes
|
{current, frame} = Gallery.nodes
|
||||||
{style} = current
|
{style} = current
|
||||||
if Conf['Stretch to Fit'] and (dim = g.posts[current.dataset.post]?.file.dimensions)
|
if Conf['Stretch to Fit'] and (dim = g.posts[current.dataset.post]?.file.dimensions)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user