silverstripe-cms/javascript/ImageEditor/Effects.js
Andrew O'Neil b0d78ea5bd mujma: BUGFIX: All global variables added to ImageEditor namespace, solved issue reported in ticket 102, http://support.silverstripe.com/gsoc/ticket/102 (merged from gsoc branch, r42789)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42989 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-10-02 23:26:35 +00:00

41 lines
1.0 KiB
JavaScript

/**
* @author Mateusz
*/
ImageEditor.Effects = {
initialize: function() {
this.setListeners = ImageEditor.Effects.setListeners.bind(this);
this.rotate = ImageEditor.Effects.rotate.bind(this);
this.setListeners();
this.isRotateEnabled = true;
this.enableRotate = ImageEditor.Effects.enableRotate.bind(this);
this.disableRotate = ImageEditor.Effects.disableRotate.bind(this);
},
rotate: function() {
if(this.isRotateEnabled) {
ImageEditor.resize.imageContainerResize.disable();
ImageEditor.crop.disable();
ImageEditor.imageHistory.disable();
ImageEditor.imageTransformation.rotate(90,ImageEditor.Effects.rotateCallback.bind(this));
this.isRotateEnabled = false;
}
},
rotateCallback: function() {
ImageEditor.resize.imageContainerResize.placeClickBox();
this.isRotateEnabled = true;
},
setListeners: function() {
Event.observe('RotateButton','click',this.rotate);
},
disableRotate: function() {
this.isRotateEnabled = false;
},
enableRotate: function() {
this.isRotateEnabled = true;
}
}