Skip to content

Fix Hammerjs unbind events #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions jquery.cropbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@
this.updateOptions();

if (typeof $.fn.hammer === 'function' || typeof Hammer !== 'undefined') {
var hammerit, dragData;
var dragData;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the indentation of this dragData is not correct anymore.

if (typeof $.fn.hammer === 'function')
hammerit = this.$image.hammer().data('hammer'); // Get the hammer instance after it has been created.
this.hammerit = this.$image.hammer().data('hammer'); // Get the hammer instance after it has been created.
else
hammerit = Hammer(this.$image.get(0));
this.hammerit = Hammer(this.$image.get(0));
// Enable panning in all directions without any threshold.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is wrong here too.. your commit didn't introduce this, but if you could fix it it will be greatly appreciated, otherwise I can do it after I merge your change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix all of it and re-commit.

Copy link
Author

@Growiel Growiel May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something weird is happening. I have none of the indentation issues on my side, but when I push it, the indent is incorrect on github. Have you ever had this issue ?

Could you give me your indent size ? And are you using spaces or tabs ?

hammerit.get('pan').set({ direction: Hammer.DIRECTION_ALL, threshold: 0 });
this.hammerit.get('pan').set({ direction: Hammer.DIRECTION_ALL, threshold: 0 });
// Enable pinching.
hammerit.get('pinch').set({ enable: true });
hammerit.on('panleft panright panup pandown', function(e) {
this.hammerit.get('pinch').set({ enable: true });
this.hammerit.on('panleft panright panup pandown', function(e) {
if (!dragData)
dragData = {
startX: self.img_left,
Expand Down Expand Up @@ -158,13 +158,8 @@
},

remove: function () {
var hammerit;
if (typeof $.fn.hammer === 'function')
hammerit = this.$image.data('hammer'); // Get hammer instance object.
else if (typeof Hammer !== 'undefined')
hammerit = Hammer(this.$image.get(0));
if (hammerit)
hammerit.off('panleft panright panup pandown panend pancancel doubletap pinchin pinchout');
if (this.hammerit)
this.hammerit.off('panleft panright panup pandown panend pancancel doubletap pinchin pinchout');
this.$frame.off('.' + pluginName);
this.$image.off('.' + pluginName);
this.$image.css({width: '', left: '', top: ''});
Expand Down