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....
//css.left = cur[0].offsetLeft
this.ribbons.dom.setOffset(marker, cur[0].offsetLeft, 0)
this.ribbons.dom.setOffset(marker,
cur[0].offsetLeft - (parseFloat(cur[0].style.marginLeft) || 0),
0)
marker.css(css)
}],

View File

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