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

BF: Mouse coordinate mapping on retina displays #4755

Merged
merged 3 commits into from
Apr 7, 2022

Conversation

mdcutone
Copy link
Member

@mdcutone mdcutone commented Apr 5, 2022

Fixes the issue that mouse coordinates are incorrectly mapped to window coordinates on macOS. Tested on the office Mac here without a retina display (same problem as before), need someone to check on a real retina display if the fix works there too.

Furthermore, the fix should apply to HiDPI displays on other platforms too since we're using the new setContentScaleFactor() method which generalizes mapping between window and framebuffer coordinates in cases where they differ in size.

@TEParsons
Copy link
Contributor

Unfortunately this doesn't work on retina :( When I run this experiment:
untitled.zip
the text is only True when the mouse is in the top right corner

@mdcutone
Copy link
Member Author

mdcutone commented Apr 6, 2022

I think I needed to apply these changes to the pyglet backend directly since it handles coordinates differently and overrides the underlying conversion methods of the base class. Hope it works now!

@mdcutone mdcutone marked this pull request as draft April 6, 2022 20:40
@mdcutone
Copy link
Member Author

mdcutone commented Apr 6, 2022

Converted to a draft, don't pull in until we confirm this fixes the issue across different Mac configurations (i.e. retina/non-retina).

@TEParsons
Copy link
Contributor

It works on my retina screen! I'll figure out what this textbox glyph test bug is and submit a separate PR for it

@TEParsons TEParsons marked this pull request as ready for review April 7, 2022 14:11
@codecov
Copy link

codecov bot commented Apr 7, 2022

Codecov Report

Merging #4755 (facca10) into release (9fcdb76) will increase coverage by 0.01%.
The diff coverage is 25.00%.

@@             Coverage Diff             @@
##           release    #4755      +/-   ##
===========================================
+ Coverage    45.32%   45.33%   +0.01%     
===========================================
  Files          294      294              
  Lines        58845    58849       +4     
  Branches     10393    10393              
===========================================
+ Hits         26671    26682      +11     
+ Misses       29793    29784       -9     
- Partials      2381     2383       +2     
Impacted Files Coverage Δ
psychopy/visual/backends/_base.py 66.94% <0.00%> (-1.16%) ⬇️
psychopy/visual/backends/pygletbackend.py 47.43% <50.00%> (+0.01%) ⬆️
psychopy/visual/textbox2/textbox2.py 78.88% <0.00%> (+1.24%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

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 this pull request may close these issues.

Slider and button not picking up software-triggered mouse click event Mouse click inaccurate position
2 participants