Separate Gallery and Image Expansion fit width / height
This commit is contained in:
parent
5c43ffb272
commit
9353bcd50d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -403,14 +403,14 @@ Config =
|
||||
]
|
||||
|
||||
gallery:
|
||||
# Gallery mostly gets its config from imageExpansion
|
||||
'Hide thumbnails': [
|
||||
false
|
||||
]
|
||||
'Gallery fit width': [
|
||||
# Fit Width =/= Fit width
|
||||
'Fit Width': [
|
||||
true
|
||||
]
|
||||
'Gallery fit height': [
|
||||
'Fit Height': [
|
||||
true
|
||||
]
|
||||
|
||||
|
||||
@ -1182,10 +1182,10 @@ a:only-of-type > .remove {
|
||||
margin: auto;
|
||||
line-height: 0;
|
||||
}
|
||||
.fit-width .gal-image img {
|
||||
.gal-fit-width .gal-image img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.fit-height .gal-image img {
|
||||
.gal-fit-height .gal-image img {
|
||||
max-height: calc(100vh - 25px);
|
||||
}
|
||||
.gal-buttons {
|
||||
|
||||
@ -74,7 +74,7 @@ Gallery =
|
||||
nodes.menu.toggle e, @, g
|
||||
|
||||
{createSubEntry} = Gallery.menu
|
||||
for name in ['Gallery fit width', 'Gallery fit height', 'Hide thumbnails']
|
||||
for name in Config.gallery
|
||||
{el} = createSubEntry name
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
@ -221,9 +221,12 @@ Gallery =
|
||||
$.off d, 'keydown', Gallery.cb.keybinds
|
||||
$.on d, 'keydown', Keybinds.keydown
|
||||
|
||||
setFitness: ->
|
||||
(if @checked then $.addClass else $.rmClass) doc, "gal-#{@name.toLowerCase().replace /\s+/g, '-'}"
|
||||
|
||||
menu:
|
||||
init: ->
|
||||
return if g.VIEW is 'catalog' or !Conf['Gallery'] or Conf['Image Expansion']
|
||||
return if g.VIEW is 'catalog' or !Conf['Gallery']
|
||||
|
||||
el = $.el 'span',
|
||||
textContent: 'Gallery'
|
||||
@ -231,7 +234,7 @@ Gallery =
|
||||
|
||||
{createSubEntry} = Gallery.menu
|
||||
subEntries = []
|
||||
for name in ['Gallery fit width', 'Gallery fit height', 'Hide thumbnails']
|
||||
for name in Config.gallery
|
||||
subEntries.push createSubEntry name
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
@ -244,8 +247,8 @@ Gallery =
|
||||
label = $.el 'label',
|
||||
innerHTML: "<input type=checkbox name='#{name}'> #{name}"
|
||||
input = label.firstElementChild
|
||||
# Reusing ImageExpand here because this code doesn't need any auditing to work for what we need
|
||||
$.on input, 'change', ImageExpand.cb.setFitness
|
||||
if ['Fit Width', 'Fit Height'].contains name
|
||||
$.on input, 'change', Gallery.cb.setFitness
|
||||
input.checked = Conf[name]
|
||||
$.event 'change', null, input
|
||||
$.on input, 'change', $.cb.checked
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user