From 338fa5bdb2721d180a69c9fa5e31bd381689a727 Mon Sep 17 00:00:00 2001 From: nilsding Date: Mon, 29 Dec 2014 16:39:27 +0100 Subject: [PATCH] divide by scale --- app/assets/javascripts/settings.coffee | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/settings.coffee b/app/assets/javascripts/settings.coffee index a11947ad..3d50f262 100644 --- a/app/assets/javascripts/settings.coffee +++ b/app/assets/javascripts/settings.coffee @@ -27,17 +27,17 @@ height: side onChange: (data, action) -> console.log data - ($ '#crop_x').val Math.floor(data.x) - ($ '#crop_y').val Math.floor(data.y) - ($ '#crop_w').val Math.floor(data.w) - ($ '#crop_h').val Math.floor(data.h) -# rx = 100 / data.w -# ry = 100 / data.h -# ($ '#profile-picture-preview').css -# width: Math.round(rx * preview[0].naturalWidth) + 'px' -# height: Math.round(ry * preview[0].naturalHeight) + 'px' -# marginLeft: '-' + Math.round(rx * data.x) + 'px' -# marginTop: '-' + Math.round(ry * data.y) + 'px' + ($ '#crop_x').val Math.floor(data.x / data.scale) + ($ '#crop_y').val Math.floor(data.y / data.scale) + ($ '#crop_w').val Math.floor(data.w / data.scale) + ($ '#crop_h').val Math.floor(data.h / data.scale) + # rx = 100 / data.w + # ry = 100 / data.h + # ($ '#profile-picture-preview').css + # width: Math.round(rx * preview[0].naturalWidth) + 'px' + # height: Math.round(ry * preview[0].naturalHeight) + 'px' + # marginLeft: '-' + Math.round(rx * data.x) + 'px' + # marginTop: '-' + Math.round(ry * data.y) + 'px' ($ '#cropper-zoom-out').click -> cropper.guillotine 'zoomOut' ($ '#cropper-zoom-in').click -> cropper.guillotine 'zoomIn'