-
Notifications
You must be signed in to change notification settings - Fork 502
FlxMouseEvent: pixelPerfect checks no longer honor clipRects #3568
Copy link
Copy link
Open
Labels
BugCollisionsEasy ChangeGood for first-time contributorsGood for first-time contributorsInputRegression
Milestone
Description
Likely caused by #3419
Noticed in FlxLightPuzzle on dev, but not master. sprite.getPixelAt needs to check clipRect specifically:
/**
* Determines which of this sprite's pixels are at the specified world coordinate, if any.
* Factors in `scale`, `angle`, `offset`, `origin`, `scrollFactor`, `clipRect`, `flipX` and `flipY`.
*
* @param worldPoint The point in world space
* @param camera The camera, used for `scrollFactor`. If `null`, `getDefaultCamera()` is used.
* @return a `FlxColor`, if the point is in the sprite's graphic, otherwise `null` is returned.
* @since 5.0.0
*/
public function getPixelAt(worldPoint:FlxPoint, ?camera:FlxCamera):Null<FlxColor>
{
final point = worldToFramePosition(worldPoint, camera, FlxPoint.weak());
final overlaps = point.x >= 0 && point.x <= frameWidth && point.y >= 0 && point.y <= frameHeight
&& (clipRect == null || clipRect.containsPoint(point));
if (!overlaps)
{
point.put();
return null;
}
return transformColor(frame.getPixelAt(point));
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugCollisionsEasy ChangeGood for first-time contributorsGood for first-time contributorsInputRegression