Skip to content

Commit

Permalink
Adds test for deltaX, deltaY
Browse files Browse the repository at this point in the history
  • Loading branch information
stephband committed Oct 28, 2013
1 parent e298fdb commit d27c9a6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion event.move.jquery.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event.move",
"title": "jquery.event.move",
"version": "1.3.5",
"version": "1.3.6",
"author": {
"name": "Stephen Band",
"url": "http://stephband.info"
Expand Down
28 changes: 27 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ <h3>Find me on...</h3>
function logEvent(e){ window.console && console.log(e.type, e); }

jQuery(document)
.bind('mousedown mouseup', logEvent)
//.bind('mousedown mouseup', logEvent)
.ready(function(){
var start,
box = jQuery('.test'),
Expand Down Expand Up @@ -335,6 +335,32 @@ <h3>Find me on...</h3>
}
});

(function(){
// Test for correct deltaX and deltaY values

var distX = 0, distY = 0, pageX = 0, pageY = 0;

box
.bind('movestart', function(e) {
distX = e.distX;
distY = e.distY;
pageX = e.pageX;
pageY = e.pageY;
})
.bind('move', function(e){
// All these statements should be true
console.log(e.deltaX === e.distX - distX,
e.deltaY === e.distY - distY,
e.deltaX === e.pageX - pageX,
e.deltaY === e.pageY - pageY);

distY = e.distY;
distX = e.distX;
pageX = e.pageX;
pageY = e.pageY;
});
})();

var rotation = 0;

(function(){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery.event.move",
"title": "jquery.event.move",
"version": "1.3.5",
"version": "1.3.6",
"author": {
"name": "Stephen Band",
"url": "http://stephband.info",
Expand Down

0 comments on commit d27c9a6

Please sign in to comment.