Fix font scaling slider not working on touchscreens#4682
Open
Dhananjay-JSR wants to merge 1 commit into
Open
Conversation
Drive the slider value from touch events so the thumb follows the finger; WPF sliders only respond to mouse drag otherwise.
Contributor
|
which device do you have is it a convertible or a tablet |
Contributor
|
Could you test a simpler XAML-only approach? WPF sliders usually ignore touch because the parent ScrollViewer intercepts them for panning. Instead of manually capturing touch events and calculating the slider value in PowerShell, you can drop the PowerShell code entirely and just add ScrollViewer.PanningMode="VerticalOnly" to the element in inputXML.xaml (alongside your other additions). This stops the ScrollViewer from stealing touch events, allowing the slider's native touch behavior to work automatically |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the Font Scaling slider usable on touchscreen devices.
Why
WPF
Sliderthumbs only respond to mouse drag. On touch-only devices (handhelds, tablets, 2-in-1s) on my Asus Rog ally x it doesn't work , touch isn't promoted to the mouse input the thumb relies on, so the slider can't be moved by finger at all.How
Set-WinUtilSliderFromTouch, which maps a horizontal touch position onto the slider's range and snaps to the nearest tick.PreviewTouchDown/Move/Upevents to capture the touch and drive the value as the finger moves.IsMoveToPointEnabledand disabled the press-and-hold stylus gesture so tapping the track jumps to that point without a long-press delay.Testing
Compiled with
.\Compile.ps1 -Runand confirmed on a touchscreen handheld: the slider now drags and snaps by touch. Mouse and keyboard behavior is unchanged.