now image flipping more consistent, still not done (needs images.js)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-11-06 01:36:03 +03:00
parent 645d045545
commit 5238a78397
2 changed files with 38 additions and 5 deletions

View File

@ -1313,6 +1313,9 @@ module.RibbonsPrototype = {
return image
},
getImageRotation: function(target){
return this.getImage(target).attr('orientation') || 0
},
// Rotate an image...
//
// Rotate image clockwise:
@ -1360,6 +1363,12 @@ module.RibbonsPrototype = {
return target
},
getImageFlip: function(target){
return (this.getImage(target).attr('flipped') || '')
.split(',')
.map(function(e){ return e.trim() })
.filter(function(e){ return e != '' })
},
// Flip an image...
//
// Flip image:

View File

@ -687,7 +687,6 @@ actions.Actions(Client, {
}],
// XXX skip invisible ribbons (???)
// XXX load data chunks...
focusImage: [
function(target, list){
var ribbons = this.ribbons
@ -707,8 +706,6 @@ actions.Actions(Client, {
// NOTE: this will prevent sync errors...
var gid = data.getImage()
// XXX see if we need to do some loading...
target = ribbons.focusImage(gid)
}
}
@ -895,10 +892,37 @@ actions.Actions(Client, {
function(target){ this.ribbons.rotateCW(target) }],
rotateCCW: [
function(target){ this.ribbons.rotateCCW(target) }],
// NOTE: these are relative to how the image is viewed and not to
// it's original orientation...
// ...this makes things consistent both visually and internally
// NOTE: these support target lists...
// XXX tell data/images about the flip...
flipVertical: [
function(target){ this.ribbons.flipVertical(target) }],
function(target){
target = target == null || target.constructor !== Array ? [target] : target
var that = this
target.forEach(function(target){
var r = that.ribbons.getImageRotation(target)
if(r == 0 || r == 180){
that.ribbons.flipVertical(target)
} else {
that.ribbons.flipHorizontal(target)
}
})
}],
flipHorizontal: [
function(target){ this.ribbons.flipHorizontal(target) }],
function(target){
target = target == null || target.constructor !== Array ? [target] : target
var that = this
target.forEach(function(target){
var r = that.ribbons.getImageRotation(target)
if(r == 0 || r == 180){
that.ribbons.flipHorizontal(target)
} else {
that.ribbons.flipVertical(target)
}
})
}],
crop: [ reloadAfter() ],
uncrop: [ reloadAfter() ],