Permalink
Browse files

fix(profile): Avatar cropper again can be moved immediately after upl…

…oading image


Fixes #8449
  • Loading branch information...
mrclay committed Jun 20, 2015
1 parent 37425f2 commit d8cf51b7d4e718f8a67fa8d26a11e697851820bc
Showing with 11 additions and 7 deletions.
  1. +11 −7 js/lib/ui.avatar_cropper.js
@@ -28,17 +28,21 @@ elgg.avatarCropper.init = function() {
$('#user-avatar-cropper').imgAreaSelect(params);
if ($('input[name=x2]').val()) {
- var ias = $('#user-avatar-cropper').imgAreaSelect({instance: true});
- var selection = ias.getSelection();
- elgg.avatarCropper.preview($('#user-avatar-cropper'), selection);
+
+ // TODO figure out why this is necessary
+ $(window).on('load', function () {
+ var ias = $('#user-avatar-cropper').imgAreaSelect({instance: true});
+ var selection = ias.getSelection();
+ elgg.avatarCropper.preview($('#user-avatar-cropper'), selection);
+ });
}
};
/**
* Handler for changing select area.
*
- * @param {Object} reference to the image
- * @param {Object} imgareaselect selection object
+ * @param {Object} img reference to the image
+ * @param {Object} selection imgareaselect selection object
* @return void
*/
elgg.avatarCropper.preview = function(img, selection) {
@@ -62,8 +66,8 @@ elgg.avatarCropper.preview = function(img, selection) {
/**
* Handler for updating the form inputs after select ends
*
- * @param {Object} reference to the image
- * @param {Object} imgareaselect selection object
+ * @param {Object} img reference to the image
+ * @param {Object} selection imgareaselect selection object
* @return void
*/
elgg.avatarCropper.selectChange = function(img, selection) {

0 comments on commit d8cf51b

Please sign in to comment.