HaxeFlixel / HaxeFlixel/flixel

FlxPointer.getScreenPosition is returning impossible numbers

Open
#3,199 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

  • Haxe version: 4.3.2
  • Flixel version: 5.8.0
  • OpenFL version: 9.3.3
  • Lime version: 8.1.2
  • Affected targets: html5, ?

Code snippet reproducing the issue:

package;

import flixel.FlxG;
import flixel.FlxState;

class PlayState extends FlxState
{
	override public function update(elapsed:Float)
	{
		super.update(elapsed);
		trace(FlxG.mouse.getScreenPosition());
	}
}

It's also useful to update openfl-content div's styling:

#openfl-content {
    background: #000000;
    width: 640px;
}

Observed behavior:

When placing the cursor at the top-left most position on the screen, trace(FlxG.mouse.getScreenPosition() is returning (x: 0 | y: -4)

Expected behavior:

When placing the cursor at the top-left most position on the screen, trace(FlxG.mouse.getScreenPosition() should return (x: 0 | y: 0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the FlxPointer.getScreenPosition entry point and reproduce the issue with the supplied HaxeFlixel, OpenFL, and Lime versions on the html5 target. Compare the returned coordinates at the top-left position; done means the result is (x: 0 | y: 0) rather than a negative y value.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.