more docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-07-24 16:46:32 +04:00
parent 3fcdb03aec
commit 4fee407c0b

View File

@ -495,14 +495,21 @@ module.RibbonsPrototype = {
// Rotate an image... // Rotate an image...
// //
// direction can be: // Rotate image clockwise:
// XXX not sure if we need these as attrs... // .rotateImage(target, 'cw')
CW: 'cw', // -> image
CCW: 'ccw',
// //
// rotation tables... // Rotate image counterclockwise:
// NOTE: setting a value to null will remove the attribute, 0 will // .rotateImage(target, 'ccw')
// set 0 explicitly... // -> image
//
//
// NOTE: target must be .getImage(..) compatible.
// NOTE: this can be applied in bulk, e.g.
// this.rotateImage($('.image'), 'cw') will rotate all the
// loaded images clockwise.
//
// Rotation tables...
_cw: { _cw: {
null: 90, null: 90,
0: 90, 0: 90,
@ -519,8 +526,10 @@ module.RibbonsPrototype = {
180: 90, 180: 90,
270: 180, 270: 180,
}, },
// NOTE: setting a value to null will remove the attribute, 0 will
// set 0 explicitly...
rotateImage: function(target, direction){ rotateImage: function(target, direction){
var r_table = direction == this.CW ? this._cw : this._ccw var r_table = direction == 'cw' ? this._cw : this._ccw
target = this.getImage(target) target = this.getImage(target)
target.each(function(i, e){ target.each(function(i, e){
var img = $(this) var img = $(this)
@ -542,10 +551,14 @@ module.RibbonsPrototype = {
// Flip an image... // Flip an image...
// //
// direction can be: // .flipImage(target, 'horizontal')
// XXX not sure if we need these as attrs... // .flipImage(target, 'vertical')
VERTICAL: 'vertical', // -> image
HORIZONTAL: 'horizontal', //
// NOTE: target must be .getImage(..) compatible.
// NOTE: this can be applied in bulk, e.g.
// this.flipImage($('.image'), 'vertical') will rotate all the
// loaded images vertically.
flipImage: function(target, direction){ flipImage: function(target, direction){
target = this.getImage(target) target = this.getImage(target)
target.each(function(i, e){ target.each(function(i, e){
@ -578,10 +591,10 @@ module.RibbonsPrototype = {
// shorthands... // shorthands...
// XXX should these be here??? // XXX should these be here???
rotateCW: function(target){ return this.rotateImage(target, this.CW) }, //rotateCW: function(target){ return this.rotateImage(target, 'cw') },
rotateCCW: function(target){ return this.rotateImage(target, this.CCW) }, //rotateCCW: function(target){ return this.rotateImage(target, 'ccw') },
flipVertical: function(target){ return this.flipImage(target, this.VERTICAL) }, //flipVertical: function(target){ return this.flipImage(target, 'vertical') },
flipHorizontal: function(target){ return this.flipImage(target, this.HORIZONTAL) }, //flipHorizontal: function(target){ return this.flipImage(target, 'horizontal') },
// UI manipulation... // UI manipulation...