Skip to content

Commit

Permalink
Add namespace to filesList events and remove them on namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul de Vries committed Oct 31, 2015
1 parent 8127394 commit 7e1049f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions octoprint_touchui/static/js/includes/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@
/* Add touch friendly files list */
var self = this,
touch = false,
start = 0;
start = 0,
namespace = ".files.touchui";

$(document).on("mousedown touchstart", "#files .entry, #temp .row-fluid", function(e) {
touch = e.currentTarget;
start = e.pageX || e.originalEvent.targetTouches[0].pageX;

var move = function(event) {
$(document).one("mouseup"+namespace+" touchend"+namespace, function(e) {
touch = false;
start = 0;

$(document).off(namespace);
});

$(document).on("mousemove"+namespace+" touchmove"+namespace, function(event) {
if(touch !== false) {
var current = event.pageX || event.originalEvent.targetTouches[0].pageX;

Expand All @@ -52,15 +60,8 @@
}

}
};

$(document).one("mouseup touchend", function(e) {
touch = false;
start = 0;
$(document).off("mousemove touchmove");
});

$(document).on("mousemove touchmove", move);
});

}
Expand Down

0 comments on commit 7e1049f

Please sign in to comment.