Skip to content

Fix Hammerjs unbind events#85

Open
Growiel wants to merge 2 commits intoacornejo:masterfrom
Growiel:fix_unbind_hammerit
Open

Fix Hammerjs unbind events#85
Growiel wants to merge 2 commits intoacornejo:masterfrom
Growiel:fix_unbind_hammerit

Conversation

@Growiel
Copy link

@Growiel Growiel commented May 19, 2016

Making the hammerjs instance a property of cropbox so we can properly
unbind the events in .remove();

While creating the pause function (see other PR), i noticed that in the remove() function, doing "hammerit = Hammer(this.$image.get(0));" was actually creating a NEW instance of hammerjs on the element instead of retrieving the existing one.

After looking around, just storing the one with used to bind the events seemd to be the easiest way to do it, so this PR does just that.

Making the hammerjs instance a property of cropbox so we can properly
unbind the events in .remove();
@acornejo
Copy link
Owner

this commit looks good, but the diff shows a dangling " var dragData;", why is that?


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

Choose a reason for hiding this comment

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

you do not need to declare hammirit since you ar enot using the variable yet (i.e. this is not a "var" declaration)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants