From fa5196134197f44b08591fb342caeb1e60a47693 Mon Sep 17 00:00:00 2001 From: Yuki Date: Fri, 8 May 2015 21:50:57 +0530 Subject: [PATCH] prevent double binding controls --- app/assets/javascripts/settings.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/settings.coffee b/app/assets/javascripts/settings.coffee index f3eb6c84..6142a7dd 100644 --- a/app/assets/javascripts/settings.coffee +++ b/app/assets/javascripts/settings.coffee @@ -42,8 +42,10 @@ updateVars cropper.guillotine('getData'), 'drag' # just because - ($ '#cropper-zoom-out').click -> cropper.guillotine 'zoomOut' - ($ '#cropper-zoom-in').click -> cropper.guillotine 'zoomIn' + unless ($ '#profile-picture-crop-controls')[0].dataset.bound? + ($ '#cropper-zoom-out').click -> cropper.guillotine 'zoomOut' + ($ '#cropper-zoom-in').click -> cropper.guillotine 'zoomIn' + ($ '#profile-picture-crop-controls')[0].dataset.bound = true ($ '#profile-picture-crop-controls').slideDown() cropper.attr 'src', e.target.result @@ -74,8 +76,10 @@ updateVars cropper.guillotine('getData'), 'drag' - ($ '#cropper-header-zoom-out').click -> cropper.guillotine 'zoomOut' - ($ '#cropper-header-zoom-in').click -> cropper.guillotine 'zoomIn' + unless ($ '#profile-header-crop-controls')[0].dataset.bound? + ($ '#cropper-header-zoom-out').click -> cropper.guillotine 'zoomOut' + ($ '#cropper-header-zoom-in').click -> cropper.guillotine 'zoomIn' + ($ '#profile-header-crop-controls')[0].dataset.bound = true ($ '#profile-header-crop-controls').slideDown() cropper.attr 'src', e.target.result