put crop setCSS into a callback also - modify setCSS function to accept a callback param

This commit is contained in:
Sanj 2012-03-06 18:10:32 +05:30
parent 78b530205d
commit b28f9a6f87

View File

@ -861,12 +861,14 @@ ImageBox.prototype.updateCSS = function(css) {
});
};
ImageBox.prototype.setCSS = function(css, doUpdate) {
ImageBox.prototype.setCSS = function(css, doUpdate, callback) {
var that = this;
var update = doUpdate == undefined ? true : doUpdate;
this.jq.css(css);
if (update) {
this.updateCSS(css);
}
callback == undefined ? $.noop() : callback(that);
return this;
};
@ -1562,8 +1564,10 @@ $(".box").live("click", function(e){
// console.log(data.path);
new_top = parseInt(box_top) + crop_dimensions.y;
new_left = parseInt(box_left) + crop_dimensions.x;
boxObj.setCSS({'width': crop_dimensions.w, 'height': crop_dimensions.h}, false);
boxObj.setCSS({'top': new_top, 'left': new_left});
boxObj.setCSS({'width': crop_dimensions.w, 'height': crop_dimensions.h}, false, function(obj) {
obj.setCSS({'top': new_top, 'left': new_left});
});
jcrop.destroy();
box.find('.edgeImage').attr("width", crop_dimensions.w);
box.find('.edgeImage').attr("height", crop_dimensions.h);