[Mobile] Comments

Added comments to destroy and remaining
MCTPinch functions.
This commit is contained in:
Shivam Dave 2015-09-02 10:20:49 -07:00
parent 9d1841db55
commit 0b7ab75512

View File

@ -51,7 +51,7 @@ define(
} }
// Calculates the midpoint between two given // Calculates the midpoint between two given
// coordinates // coordinates and returns it as coordinate object
function calculateMidpoint(coordOne, coordTwo) { function calculateMidpoint(coordOne, coordTwo) {
return { return {
clientX: (coordOne.clientX + coordTwo.clientX) / 2, clientX: (coordOne.clientX + coordTwo.clientX) / 2,
@ -211,17 +211,29 @@ define(
} }
// Stop checking for touch when scope is destroyed // Stop checking for touch when scope is destroyed
// (when user navigates away from graph).
$scope.$on("$destroy", function () { $scope.$on("$destroy", function () {
// All elements' event listeners are
// removed
element.off('touchstart', touchStart); element.off('touchstart', touchStart);
element.off('touchmove', touchChange); element.off('touchmove', touchChange);
element.off('touchend', touchEnd); element.off('touchend', touchEnd);
element.off('touchcancel', touchEnd); element.off('touchcancel', touchEnd);
// If for some reason, midtouch the
// user is navigated away, set pan/pinch
// statuses to false
isPan = false;
isPinch = false;
}); });
} }
return { return {
// MCTPinch is treated as an attribute
restrict: "A", restrict: "A",
// Link with the provided function
// Link with the provided function above
link: link link: link
}; };
} }