(window).resize(function() {
      layoutCropper();
    });

    $cropperimage.on('load', function() {
      var img = $(this).get(0);
      g_editorState.cropperImageSize = {
        w: img.naturalWidth,
        h: img.naturalHeight
      };
      layoutCropper();
    });

    // drag+drop for crop
    var startX, startY;
    var startCrop = [];
    var edge = '';
    $('.cropper-handle')
        .on('mousedown', function(e) {
          $(this).data('down', true);
          edge = $(this).data('edge');
   