1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| var app = angular.module('myApp', []);
app.controller('myDrag', function($scope) {
$scope.drag = {
start: [],
end: []
};
$scope.handlerMouseDown = function(ev) {
$scope.drag.start = [ev.pageX, ev.pageY];
$scope.infoDown = `x :${ev.pageX}, y :${ev.pageY}`;
};
$scope.handlerMouseMove = function(ev) {
$scope.infoMove = `x :${ev.pageX}, y :${ev.pageY}`;
};
$scope.handlerMouseUp = function(ev) {
$scope.drag.end = [ev.pageX, ev.pageY];
$scope.infoUp = `x :${ev.pageX}, y :${ev.pageY}`;
console.log(JSON.stringify($scope.drag, null, 2))
};
}); |
Partager