Skip to content

Commit 7a12cff

Browse files
authored
Merge pull request phaserjs#2588 from LoneStranger/dev-a
Group.getClosestTo() comparator wrong direction
2 parents 5e38f83 + fca0a62 commit 7a12cff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/core/Group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ Phaser.Group.prototype.getClosestTo = function (object, callback, callbackContex
22382238
{
22392239
tempDistance = Math.abs(Phaser.Point.distance(object, child));
22402240

2241-
if (tempDistance > distance && (!callback || callback.call(callbackContext, child, tempDistance)))
2241+
if (tempDistance < distance && (!callback || callback.call(callbackContext, child, tempDistance)))
22422242
{
22432243
distance = tempDistance;
22442244
result = child;

0 commit comments

Comments
 (0)