mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
mujma: BUGFIX: Fixed buttons(Ok/Cancel) visibility after "Crop area to small" message.
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41989 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5c3e3b1d6b
commit
8e08868354
@ -14,7 +14,6 @@ var Crop = {
|
|||||||
this.centerCropBox = Crop.centerCropBox.bind(this);
|
this.centerCropBox = Crop.centerCropBox.bind(this);
|
||||||
this.placeGreyBox = Crop.placeGreyBox.bind(this);
|
this.placeGreyBox = Crop.placeGreyBox.bind(this);
|
||||||
this.setListeners = Crop.setListeners.bind(this);
|
this.setListeners = Crop.setListeners.bind(this);
|
||||||
this.onCropStop = Crop.onCropStop.bind(this);
|
|
||||||
this.onCropStart = Crop.onCropStart.bind(this);
|
this.onCropStart = Crop.onCropStart.bind(this);
|
||||||
this.onCropOk = Crop.onCropOk.bind(this);
|
this.onCropOk = Crop.onCropOk.bind(this);
|
||||||
this.onCropCancel = Crop.onCropCancel.bind(this);
|
this.onCropCancel = Crop.onCropCancel.bind(this);
|
||||||
@ -31,7 +30,7 @@ var Crop = {
|
|||||||
getMousePos: Crop.getMousePos.bind(this)
|
getMousePos: Crop.getMousePos.bind(this)
|
||||||
};
|
};
|
||||||
this.resizeCropBox = new Resizeable.initialize(this.cropBox,options);
|
this.resizeCropBox = new Resizeable.initialize(this.cropBox,options);
|
||||||
Event.observe(this.cropBox,'dblclick',this.onCropStop.bind(this));
|
Event.observe(this.cropBox,'dblclick',this.onCropOk.bind(this));
|
||||||
this.setListeners();
|
this.setListeners();
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
this.setVisible(this.isVisible);
|
this.setVisible(this.isVisible);
|
||||||
@ -97,11 +96,6 @@ var Crop = {
|
|||||||
return {x: x,y: y};
|
return {x: x,y: y};
|
||||||
},
|
},
|
||||||
|
|
||||||
onCropStop: function(event) {
|
|
||||||
Element.hide($('cropOk'),$('cropCancel'));
|
|
||||||
this.doCrop();
|
|
||||||
},
|
|
||||||
|
|
||||||
doCrop: function() {
|
doCrop: function() {
|
||||||
if(this.isEnabled) {
|
if(this.isEnabled) {
|
||||||
newWidth = this.cropBox.getWidth()
|
newWidth = this.cropBox.getWidth()
|
||||||
@ -110,11 +104,13 @@ var Crop = {
|
|||||||
startLeft = this.cropBox.getLeft() ;
|
startLeft = this.cropBox.getLeft() ;
|
||||||
if(newWidth > 35 && newHeight > 35) {
|
if(newWidth > 35 && newHeight > 35) {
|
||||||
imageTransformation.crop(startTop,startLeft,newWidth,newHeight,Crop.cropCallback.bind(this));
|
imageTransformation.crop(startTop,startLeft,newWidth,newHeight,Crop.cropCallback.bind(this));
|
||||||
|
this.disable();
|
||||||
} else {
|
} else {
|
||||||
alert('Crop area too small');
|
alert('Crop area too small');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
this.disable();
|
|
||||||
$('image').style.visibility = 'visible';//hack for IE for not selecting image during crop
|
$('image').style.visibility = 'visible';//hack for IE for not selecting image during crop
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -142,9 +138,7 @@ var Crop = {
|
|||||||
|
|
||||||
onCropOk: function() {
|
onCropOk: function() {
|
||||||
if(this.isEnabled) {
|
if(this.isEnabled) {
|
||||||
Element.hide($('cropOk'),$('cropCancel'));
|
if(this.doCrop()) Element.hide($('cropOk'),$('cropCancel'));
|
||||||
this.doCrop();
|
|
||||||
effects.disableRotate();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user