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