some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-04-28 18:45:16 +03:00
parent a3d2f84cad
commit 47f1007a49
2 changed files with 40 additions and 46 deletions

View File

@ -131,28 +131,15 @@ 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 {
var a = 'height'
var b = 'width'
}
images
.each(function(_, img){
var o = img.getAttribute('orientation')
@ -160,19 +147,22 @@ function updateImageProportions(){
// rotated images...
if(o == 90 || o == 270){
img.style.width = n + 'px'
img.style.height = ''
img.style[a] = ''
img.style[b] = n + 'px'
img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px'
} else {
img.style.width = ''
img.style.height = n + 'px'
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

View File

@ -1564,13 +1564,7 @@ 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',
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() }],
],
})