Skip to content

Commit 201c5a9

Browse files
authored
Merge pull request #10 from romellem/feature/expose-previous-x-y
Exposes previous X and previous Y in callback
2 parents 8327b2f + 24aebcb commit 201c5a9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/implosion.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class Implosion {
6060
decVelY;
6161
let targetX = 0;
6262
let targetY = 0;
63+
let prevTargetX = null;
64+
let prevTargetY = null;
6365
let stopThreshold = stopThresholdDefault * multiplier;
6466
let ticking = false;
6567
let pointerActive = false;
@@ -216,7 +218,9 @@ class Implosion {
216218
* Executes the update function
217219
*/
218220
function callUpdateCallback() {
219-
updateCallback.call(sourceEl, targetX, targetY);
221+
updateCallback.call(sourceEl, targetX, targetY, prevTargetX, prevTargetY);
222+
prevTargetX = targetX;
223+
prevTargetY = targetY;
220224
}
221225

222226
/**

0 commit comments

Comments
 (0)