fixed current image indicator alignment on rotated and non sqare image blocks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-04-25 02:37:57 +03:00
parent d41fbee0db
commit 4e68345ffe
2 changed files with 17 additions and 6 deletions

View File

@ -247,9 +247,9 @@ var CurrentImageIndicatorActions = actions.Actions({
} }
} }
// XXX need to account for image margins.... this.ribbons.dom.setOffset(marker,
//css.left = cur[0].offsetLeft cur[0].offsetLeft - (parseFloat(cur[0].style.marginLeft) || 0),
this.ribbons.dom.setOffset(marker, cur[0].offsetLeft, 0) 0)
marker.css(css) marker.css(css)
}], }],

View File

@ -77,9 +77,13 @@ var core = require('features/core')
// ribbon view! // ribbon view!
function updateImageProportions(){ function updateImageProportions(){
var that = this var that = this
var threshold = this.config['single-image-proportions-threshold'] || 2 var threshold = this.config['single-image-proportions-threshold']
var viewer = this.ribbons.viewer
if(!threshold || threshold == -1){
return
}
var viewer = this.ribbons.viewer
var img = this.ribbons.getImage() var img = this.ribbons.getImage()
var w = img.outerWidth() var w = img.outerWidth()
@ -175,6 +179,7 @@ var SingleImageActions = actions.Actions({
'single-image-scale': null, 'single-image-scale': null,
'ribbon-scale': null, 'ribbon-scale': null,
// NOTE: setting this to null or to -1 will disable the feature...
'single-image-proportions-threshold': 2, 'single-image-proportions-threshold': 2,
}, },
@ -200,7 +205,6 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
handlers:[ handlers:[
['fitImage.post setScale.post', ['fitImage.post setScale.post',
function(){ function(){
// singe image mode -- set image proportions... // singe image mode -- set image proportions...
if(this.toggleSingleImage('?') == 'on'){ if(this.toggleSingleImage('?') == 'on'){
updateImageProportions.call(this) updateImageProportions.call(this)
@ -211,6 +215,13 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
this.config['ribbon-scale'] = this.screenwidth this.config['ribbon-scale'] = this.screenwidth
} }
}], }],
// update new images...
['resizeRibbon',
function(){
if(this.toggleSingleImage('?') == 'on'){
updateImageProportions.call(this)
}
}],
// NOTE: this is not part of the actual action above because we // NOTE: this is not part of the actual action above because we
// need to see if the state has changed and doing this with // need to see if the state has changed and doing this with
// two separate pre/post callbacks (toggler callbacks) is // two separate pre/post callbacks (toggler callbacks) is