Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer coordinates are wrong in the browser fullscreen API #1734

Closed
eonarheim opened this issue Dec 22, 2020 · 0 comments · Fixed by #1735
Closed

Pointer coordinates are wrong in the browser fullscreen API #1734

eonarheim opened this issue Dec 22, 2020 · 0 comments · Fixed by #1735

Comments

@eonarheim
Copy link
Member

Steps to Reproduce

var game = new ex.Engine({
  width: 800,
  height: 600
});
game.screen.goFullScreen();

var pointer = new ex.Actor({
  width: 25,
  height: 25,
  color: ex.Color.Red
});
game.add(pointer);

game.input.pointers.primary.on('move', (ev) => {
   pointer.pos = ev.worldPos;
});

Expected Result

Pointer actor should line up with cursor in fullscreen

Actual Result

Pointer actor does not line up with cursor in fullscreen

Environment

  • browsers and versions: Chrome/Firefox Latest
  • operating system: N/A
  • Excalibur versions: Latest

Current Workaround

None

eonarheim added a commit that referenced this issue Jan 1, 2021
![fullscreen](https://user-images.githubusercontent.com/612071/102927569-d7045f00-445c-11eb-92d9-4126a301e937.gif)

Closes #1733
Closes #1734

## Changes:

- Breaking change: `DisplayMode.FullScreen` will now scale the game to fit the available space, preserving the `aspectRatio`. This matches the browser "FullScreen" api behavior
- New: `DisplayMode.Dynamic` now does what `DisplayMode.FullScreen` used to do, the resolution and viewport dynamically adjust to fit the available space, DOES NOT preserve `aspectRatio`
- Fix: In the the browser "FullScreen" api, coordinates are now correctly mapped from page space to world space
- Added: Screen helpers for mapping between world, screen, and page space coordinates
- Deprecate: `DisplayMode.Position` CSS can accomplish this task better than Excalibur
- Tests!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant