-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Implement focus and keyboard controls for slider #3531
Conversation
This is really nice. |
Hmm. I don't know why there is a gap in the middle. I am just using the circle stroke. Shouldn't that just be outside of the fill? |
Stroke is half inside half outside the fill. To make it fully outside set the stroke to half the size and increase the circle diameter by stroke (and move it up/left by stroke/2) |
Hmm. I don't think that will work as the stroke colour is partly transparent. Will revert back to using two circles instead. |
I have one strange issue that I don't know why it is happening. The focus circle seems to be one pixel too far to the right on my screen. Any ideas why? Rounding error? |
Looking at the markup test files they don't have the same centre point |
@@ -321,6 +387,11 @@ func (s *sliderRenderer) Layout(size fyne.Size) { | |||
|
|||
s.thumb.Move(thumbPos) | |||
s.thumb.Resize(fyne.NewSize(diameter, diameter)) | |||
|
|||
focusIndicatorSize := fyne.NewSize(theme.IconInlineSize()+theme.InnerPadding(), theme.IconInlineSize()+theme.InnerPadding()) |
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.
Maybe if this was coded relative to the calculated diameter
(i.e. diameter+theme.InnerPadding()
) the issue may be resolved? Just wondering as it could be a rounding error somewhere and that might work around 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.
I tried that initially but had some issues with getting the size to match the radio buttons. Will have a shot at it again though :)
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.
Tried a lot of things to work around the possible rounding error but to no avail (even tried using theme.InnerPadding() + 1.75
which the delta
variable becomes if simplified). I have no idea how to take this further with this issue unfortunately. I would appreciate some help if you have the time 😅
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.
I believe that the code should be mostly fine in all other areas though. I have just added the remaining comments, moved some methods around to be in alphabetical order and fixed tap focus to work correctly.
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.
This looks to be solved now thanks to your slider wobble fix :)
6449c77
to
d2f7409
Compare
I will rebase (and fix the merge conflicts) once #3651 has landed :) |
d2f7409
to
36aeab6
Compare
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.
Looks good now thanks.
I wonder though - should we have "since" headers on methods that are just added for getting signals from the driver? Not sure so accepting in case it's not a thing to add.
36aeab6
to
108c364
Compare
I had to rebase onto develop to get the workflows to pass. I also added the "Since 2.4" comments. I think it makes sense to be consistent even though they are mostly meant to be used by the driver :) |
Description:
This implements focus and hover for the slider widget to make it follow the material design guidelines better.
I have also added support for moving the slider using the arrow keys.
For #1515
Opening as draft for now until I have fixed some things and added tests.
Checklist: