make a setting for normalizing the offset and check that getBoundingClientRect function exists before trying to call it

This commit is contained in:
Brandon Aaron
2014-04-09 13:21:39 -04:00
parent 74bd0d0318
commit 309077ffb6
+4 -1
View File
@@ -70,7 +70,8 @@
},
settings: {
adjustOldDeltas: true
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
normalizeOffset: true // calls getBoundingClientRect for each event
}
};
@@ -168,9 +169,11 @@
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
// Normalise offsetX and offsetY properties
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
var boundingRect = this.getBoundingClientRect();
offsetX = event.clientX - boundingRect.left;
offsetY = event.clientY - boundingRect.top;
}
// Add information to the event object
event.deltaX = deltaX;