mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a3d2f84cad
commit
47f1007a49
@ -131,49 +131,39 @@ function updateImageProportions(){
|
|||||||
|
|
||||||
// horizontal viewer...
|
// horizontal viewer...
|
||||||
if(Di == H){
|
if(Di == H){
|
||||||
images
|
var a = 'width'
|
||||||
.each(function(_, img){
|
var b = 'height'
|
||||||
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 = ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// vertical viewer...
|
// vertical viewer...
|
||||||
} else {
|
} else {
|
||||||
images
|
var a = 'height'
|
||||||
.each(function(_, img){
|
var b = 'width'
|
||||||
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 = ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
that.ribbons
|
||||||
.centerImage()
|
.centerImage()
|
||||||
.restoreTransitions(true)
|
.restoreTransitions(true)
|
||||||
@ -310,6 +300,8 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
this.ribbons.centerImage()
|
this.ribbons.centerImage()
|
||||||
|
|
||||||
|
// XXX need to correctly align other ribbons...
|
||||||
|
|
||||||
// update scale...
|
// update scale...
|
||||||
if(state != pre_state){
|
if(state != pre_state){
|
||||||
var s = this.scale
|
var s = this.scale
|
||||||
|
|||||||
@ -1564,13 +1564,7 @@ module.AutoAlignRibbons = core.ImageGridFeatures.Feature({
|
|||||||
},
|
},
|
||||||
|
|
||||||
actions: actions.Actions({
|
actions: actions.Actions({
|
||||||
toggleRibbonAlignMode : ['Interface/Toggle ribbon align mode',
|
alignRibbons: ['Interface/Align ribbons',
|
||||||
core.makeConfigToggler('ribbon-align-mode',
|
|
||||||
function(){ return this.config['ribbon-align-modes'] })],
|
|
||||||
}),
|
|
||||||
|
|
||||||
handlers: [
|
|
||||||
['focusImage.post',
|
|
||||||
function(){
|
function(){
|
||||||
var mode = this.config['ribbon-align-mode']
|
var mode = this.config['ribbon-align-mode']
|
||||||
|| this.config['ribbon-focus-mode']
|
|| this.config['ribbon-focus-mode']
|
||||||
@ -1589,6 +1583,14 @@ module.AutoAlignRibbons = core.ImageGridFeatures.Feature({
|
|||||||
.centerImage()
|
.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