2007-09-15 03:08:25 +02:00
|
|
|
/**
|
|
|
|
* @author Mateusz
|
|
|
|
*/
|
|
|
|
var Effects = {
|
|
|
|
initialize: function() {
|
|
|
|
this.setListeners = Effects.setListeners.bind(this);
|
|
|
|
this.rotate = Effects.rotate.bind(this);
|
2007-09-15 03:31:31 +02:00
|
|
|
this.setListeners();
|
|
|
|
this.isRotateEnabled = true;
|
|
|
|
this.enableRotate = Effects.enableRotate.bind(this);
|
|
|
|
this.disableRotate = Effects.disableRotate.bind(this);
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
rotate: function() {
|
2007-09-15 03:31:31 +02:00
|
|
|
if(this.isRotateEnabled) {
|
2007-09-15 22:54:37 +02:00
|
|
|
var windowWidth = Element.getDimensions($('mainContainer')).width;
|
|
|
|
var windowHeight = Element.getDimensions($('mainContainer')).height - 100;
|
|
|
|
var imageWidth = Element.getDimensions($('image')).height;
|
|
|
|
var imageHeight = Element.getDimensions($('image')).width;
|
|
|
|
if(imageWidth > windowWidth - 30 || imageHeight > windowHeight - 30) {
|
|
|
|
alert('Image to big to rotate');
|
|
|
|
} else {
|
|
|
|
resize.imageContainerResize.disable();
|
|
|
|
crop.disable();
|
|
|
|
imageTransformation.rotate(90,Effects.rotateCallback.bind(this));
|
|
|
|
this.isRotateEnabled = false;
|
|
|
|
}
|
2007-09-15 03:31:31 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
rotateCallback: function() {
|
2007-09-15 22:54:37 +02:00
|
|
|
resize.imageContainerResize.placeClickBox();
|
2007-09-15 03:31:31 +02:00
|
|
|
this.isRotateEnabled = true;
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
setListeners: function() {
|
|
|
|
Event.observe('rotateButton','click',this.rotate);
|
2007-09-15 03:31:31 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
disableRotate: function() {
|
|
|
|
this.isRotateEnabled = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
enableRotate: function() {
|
|
|
|
this.isRotateEnabled = true;
|
|
|
|
}
|
|
|
|
|
2007-09-15 03:08:25 +02:00
|
|
|
}
|