mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a3d2f84cad
commit
47f1007a49
@ -131,48 +131,38 @@ function updateImageProportions(){
|
||||
|
||||
// horizontal viewer...
|
||||
if(Di == H){
|
||||
images
|
||||
.each(function(_, img){
|
||||
var o = img.getAttribute('orientation')
|
||||
o = o == null ? 0 : o
|
||||
|
||||
// rotated images...
|
||||
if(o == 90 || o == 270){
|
||||
img.style.width = ''
|
||||
img.style.height = n + 'px'
|
||||
|
||||
img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px'
|
||||
|
||||
} else {
|
||||
img.style.width = n + 'px'
|
||||
img.style.height = ''
|
||||
|
||||
img.style.margin = ''
|
||||
}
|
||||
})
|
||||
var a = 'width'
|
||||
var b = 'height'
|
||||
|
||||
// vertical viewer...
|
||||
} else {
|
||||
images
|
||||
.each(function(_, img){
|
||||
var o = img.getAttribute('orientation')
|
||||
o = o == null ? 0 : o
|
||||
|
||||
// rotated images...
|
||||
if(o == 90 || o == 270){
|
||||
img.style.width = n + 'px'
|
||||
img.style.height = ''
|
||||
|
||||
img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px'
|
||||
|
||||
} else {
|
||||
img.style.width = ''
|
||||
img.style.height = n + 'px'
|
||||
|
||||
img.style.margin = ''
|
||||
}
|
||||
})
|
||||
var a = 'height'
|
||||
var b = 'width'
|
||||
}
|
||||
|
||||
images
|
||||
.each(function(_, img){
|
||||
var o = img.getAttribute('orientation')
|
||||
o = o == null ? 0 : o
|
||||
|
||||
// rotated images...
|
||||
if(o == 90 || o == 270){
|
||||
img.style[a] = ''
|
||||
img.style[b] = n + 'px'
|
||||
|
||||
img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px'
|
||||
|
||||
} else {
|
||||
img.style[a] = n + 'px'
|
||||
img.style[b] = ''
|
||||
|
||||
img.style.margin = ''
|
||||
}
|
||||
})
|
||||
|
||||
// XXX for some reason this is not working correctly...
|
||||
//that.alignRibbons()
|
||||
//that.ribbons.restoreTransitions(true)
|
||||
|
||||
that.ribbons
|
||||
.centerImage()
|
||||
@ -310,6 +300,8 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
||||
|
||||
this.ribbons.centerImage()
|
||||
|
||||
// XXX need to correctly align other ribbons...
|
||||
|
||||
// update scale...
|
||||
if(state != pre_state){
|
||||
var s = this.scale
|
||||
|
||||
@ -1564,14 +1564,8 @@ module.AutoAlignRibbons = core.ImageGridFeatures.Feature({
|
||||
},
|
||||
|
||||
actions: actions.Actions({
|
||||
toggleRibbonAlignMode : ['Interface/Toggle ribbon align mode',
|
||||
core.makeConfigToggler('ribbon-align-mode',
|
||||
function(){ return this.config['ribbon-align-modes'] })],
|
||||
}),
|
||||
|
||||
handlers: [
|
||||
['focusImage.post',
|
||||
function(){
|
||||
alignRibbons: ['Interface/Align ribbons',
|
||||
function(){
|
||||
var mode = this.config['ribbon-align-mode']
|
||||
|| this.config['ribbon-focus-mode']
|
||||
|
||||
@ -1589,6 +1583,14 @@ module.AutoAlignRibbons = core.ImageGridFeatures.Feature({
|
||||
.centerImage()
|
||||
}
|
||||
}],
|
||||
toggleRibbonAlignMode : ['Interface/Toggle ribbon align mode',
|
||||
core.makeConfigToggler('ribbon-align-mode',
|
||||
function(){ return this.config['ribbon-align-modes'] })],
|
||||
}),
|
||||
|
||||
handlers: [
|
||||
['focusImage.post',
|
||||
function(){ this.alignRibbons() }],
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user