resize on rotate
This commit is contained in:
parent
148703ceb8
commit
9581ce16f6
@ -306,19 +306,37 @@ Gallery =
|
|||||||
$.rmClass Gallery.nodes.buttons, 'gal-playing'
|
$.rmClass Gallery.nodes.buttons, 'gal-playing'
|
||||||
Gallery.slideshow = false
|
Gallery.slideshow = false
|
||||||
|
|
||||||
rotateLeft: ->
|
rotateLeft: $.debounce 100, ->
|
||||||
{current, frame} = Gallery.nodes
|
{current, frame} = Gallery.nodes
|
||||||
{style, dataRotate} = current
|
{style, dataRotate} = current
|
||||||
dataRotate = 0 if (!dataRotate || dataRotate <= -360)
|
dataRotate = 0 if (!dataRotate || dataRotate <= -360)
|
||||||
style.transform = 'rotate(' + (dataRotate - 90) + 'deg)'
|
style.transform = 'rotate(' + (dataRotate - 90) + 'deg)'
|
||||||
current.dataRotate = dataRotate - 90
|
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
|
{current, frame} = Gallery.nodes
|
||||||
{style, dataRotate} = current
|
{style, dataRotate} = current
|
||||||
dataRotate = 0 if (!dataRotate || dataRotate >= 360)
|
dataRotate = 0 if (!dataRotate || dataRotate >= 360)
|
||||||
style.transform = 'rotate(' + (dataRotate + 90) + 'deg)'
|
style.transform = 'rotate(' + (dataRotate + 90) + 'deg)'
|
||||||
current.dataRotate = dataRotate + 90
|
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: ->
|
close: ->
|
||||||
$.off Gallery.nodes.current, 'error', Gallery.error
|
$.off Gallery.nodes.current, 'error', Gallery.error
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user