-
-
Notifications
You must be signed in to change notification settings - Fork 57
View .onHover { Bool in } modifier #212
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
Conversation
Added: - onHover(_ action: (Bool) -> Void) View Extension - OnHoverModifier TypeSafeView - createHoverTarget(wrapping: Widget) -> Widget to AppBackend Protocol - updateHoverTarget(_: Widget, environment: EnvironmentValues, action: (Bool) -> Void) to AppBackend Protocol - corresponding default implementations - AppKitBackend hover implementation - createHoverTarget implementation - updateHoverTarget implementation - NSCustomHoverTarget (NSView notifying about hovers) - HoverExample Fixed: - AppKitBackend - fixed reference removing for NSClickGestureRecognizer in NSCustomTapGestureTarget
…ming fixes in AppKitBackend - tapGestureRecognizer and longPressGestureRecognizer now get removed if their corresponding handler is set to nil. - Added Hoverable Widget - Added hovertarget creation & update functions - added macCalatalyst as compatible for UISlider since it supports it
…ming fixes in AppKitBackend - tapGestureRecognizer and longPressGestureRecognizer now get removed if their corresponding handler is set to nil. - Added Hoverable Widget - Added hovertarget creation & update functions - added macCalatalyst as compatible for UISlider since it supports it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This will be quite useful for making more interactive apps. I've just requested a few changes around some implementation details but overall your approach to implementing this modifier was great.
Gtk can be pretty weird about availability information. I think the best we can do is add a hardcoded check to filter out the enum case in |
That's interesting that |
# Conflicts: # Sources/GtkCodeGen/GtkCodeGen.swift
I can’t test wether the linux compile bug is fixed because I don’t have a vm with older gtk atm. But I don’t see it in the generated code anymore. hopefully the build will now succeed on WinUIBackend the explicit frame adjustments were indeed not necessary |
The PR froze safari for a few seconds when I tried to view the new changes because there are 266 changed files 😅 I think running |
didn’t help did it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two small changes to make, other than that everything looks ready to merge
added both "GtkPadActionDial" and "PadActionDial" because I couldn't find a definitive answer what its called
added both "GtkPadActionDial" and "PadActionDial" because I couldn't find a definitive answer what its called # Conflicts: # Sources/GtkCodeGen/GtkCodeGen.swift
(I somehow accidentally deleted the member.doc check, just readded it in the Amend) |
Whoops, I somehow finished my review but didn't submit it so my comment has been sitting in limbo hahah |
I’m so sorry. I just didn’t read it correctly… now its correct…. (I hope) (I added a pre commit hook locally to run generate.sh, format_and_lint.sh and test.sh, so it hopefully won't happen again) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahah all good, looks great now
This PR introduces a new .onHover modifier to Views.
Related Issue: #211
Added in this PR:
Extension View
protocol AppBackend
Backend Support
Other changes:
HoverExample erfolgreich getestet auf:
macOS 26 (AppKitBackend, GtkBackend, UIKitBackend (macCatalyst))
iPadOS 26 (UIKitBackend)
Windows 11 (WinUI Backend)
Fedora 44 (GtkBackend)
Notes:
Gtk versions below 4.20.0 may encounter compiling problems. I don’t know why or what caused it, I only used the generate script, but on 4.18.6 on Fedora 42 I got this Error:
I checked and it should’ve been available since 4.0 https://docs.gtk.org/gtk4/enum.PadActionType.html
Maybe someone knows how to fix it and maybe it was just a local issue.
I made the weird Array-in-foreach-decision, since closed ranges didn't seem to be supported yet.
test.sh output