resize on rotate

This commit is contained in:
cSuwwi 2019-07-18 21:04:45 +02:00
parent 148703ceb8
commit 9581ce16f6
No known key found for this signature in database
GPG Key ID: 395BAD6707582FCA

View File

@ -306,19 +306,37 @@ Gallery =
$.rmClass Gallery.nodes.buttons, 'gal-playing'
Gallery.slideshow = false
rotateLeft: ->
rotateLeft: $.debounce 100, ->
{current, frame} = Gallery.nodes
{style, dataRotate} = current
dataRotate = 0 if (!dataRotate || dataRotate <= -360)
style.transform = 'rotate(' + (dataRotate - 90) + 'deg)'
current.dataRotate = dataRotate - 90
if (current.dataRotate == 90 || current.dataRotate == 270)
dim = g.posts[current.dataset.post]?.file.dimensions
[width, height] = dim.split 'x'
if (parseInt(width) > parseInt(height))
style.width = Math.min(doc.clientHeight - 25 / (width / height)) + 'px'
else
style.width = ''
else
style.width = ''
rotateRight: ->
rotateRight: $.debounce 100, ->
{current, frame} = Gallery.nodes
{style, dataRotate} = current
dataRotate = 0 if (!dataRotate || dataRotate >= 360)
style.transform = 'rotate(' + (dataRotate + 90) + 'deg)'
current.dataRotate = dataRotate + 90
if (current.dataRotate == 90 || current.dataRotate == 270)
dim = g.posts[current.dataset.post]?.file.dimensions
[width, height] = dim.split 'x'
if (parseInt(width) > parseInt(height))
style.width = Math.min(doc.clientHeight - 25 / (width / height)) + 'px'
else
style.width = ''
else
style.width = ''
close: ->
$.off Gallery.nodes.current, 'error', Gallery.error