From b28f9a6f87a74e51938b4830b938ad54bb50ff0f Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 6 Mar 2012 18:10:32 +0530 Subject: [PATCH] put crop setCSS into a callback also - modify setCSS function to accept a callback param --- edgware/static/js/editor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/edgware/static/js/editor.js b/edgware/static/js/editor.js index 9cc62ae..cbbcf18 100644 --- a/edgware/static/js/editor.js +++ b/edgware/static/js/editor.js @@ -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);