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

Fixes #2578 - Updates mouse events to be relative to View.Bounds #2920

Merged
merged 31 commits into from
Nov 26, 2023

Conversation

tig
Copy link
Collaborator

@tig tig commented Oct 17, 2023

Fixes #2578 - How should MouseEvent work with Margin, Border, and Padding?

  • Update docs
  • Add more unit tests to enforce current behavior
  • Refactor View.ScreenToView/ViewToScreen to be more sensical in the face of Bounds != Frame.
  • Update logic that fires mouse events
  • Fix View dragging code. Right now, dragging is handled w/in TopLevel. This needs to change to be handled within Border. See #Discuss - There should only be one (Application.Top) #2502. Will define View.Movable and View.Sizable that will control whether a view can be dragged and/or resized.
  • Update unit tests to not fail
  • Track down and fix all library and Scenario code that depends on old behavior

Related:

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tig tig self-assigned this Oct 17, 2023
@tig tig added the v2 For discussions, issues, etc... relavant for v2 label Oct 17, 2023
@tig tig changed the title Fixes #2578 - Makes mouse events relative to View.Bounds Fixes #2578 - Updates mouse event docs relative to View.Bounds Nov 23, 2023
@tig tig changed the title Fixes #2578 - Updates mouse event docs relative to View.Bounds Fixes #2578 - Updates mouse events to be relative to View.Bounds Nov 23, 2023
@tig tig marked this pull request as draft November 25, 2023 14:32
@tig tig requested a review from BDisp November 25, 2023 14:32
@tig
Copy link
Collaborator Author

tig commented Nov 25, 2023

@BDisp & @tznind - still a draft (and currently broken), but I'd love your eyes on this asap.

Thanks!

Terminal.Gui/Application.cs Outdated Show resolved Hide resolved
@tznind
Copy link
Collaborator

tznind commented Nov 25, 2023

This looks great. If I understand correctly this PR establishes more clearly the idea of bounds (like view client area) and 'frame' i.e. border, padding margin.

This is good because it simplifies things and is mostly backwards compatible so shouldn't complicate upgrades from v1 too much.

🎆 🚀

@BDisp
Copy link
Collaborator

BDisp commented Nov 25, 2023

This is really fantastic. Much more clear, more readable. Thanks for effort.

@tig tig marked this pull request as ready for review November 26, 2023 13:00
@tig
Copy link
Collaborator Author

tig commented Nov 26, 2023

I think this is done. I could add more unit tests...

Note the big hack for Toplevel dragging. I decided to not tackle this in this pr but to just hack it until we refactor drag/size per #2537

@tig tig merged commit 42b9ad1 into gui-cs:v2_develop Nov 26, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 For discussions, issues, etc... relavant for v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants