-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
[4.1] Add option to configure mouse-wheel-zoom-step-size in Blazor and Avalonia #2507
Conversation
I looked at the variable speed of the mouse wheel event, and while it is quite a good feature for the mouse wheel, It doesn't seem to be so good for the trackpad users -so it is just an idea. private DateTime lastScrollTime = DateTime.Now;
private double accumulatedDeltaY = 0;
protected void OnMouseWheel(WheelEventArgs e)
{
TimeSpan elapsed = DateTime.Now - lastScrollTime;
// Check if the time elapsed is quick or not
// This doesn't work well with a touchpad for some reason?
if (elapsed.TotalMilliseconds < 500)
{
Console.WriteLine($"MouseWheel speed < 500 (: {elapsed.TotalMilliseconds}");
Map.Navigator.MouseWheelZoomContinuous(Math.Pow(2, e.DeltaY > 0 ? 0.25 : -0.25), e.ToLocation(_clientRect));
} else
{
Console.WriteLine($"MouseWheelDelta speed > 500: {elapsed.TotalMilliseconds}");
Map.Navigator.MouseWheelZoomContinuous(Math.Pow(2, e.DeltaY > 0 ? 0.08 : -0.08), e.ToLocation(_clientRect));
}
// Update last scroll time for the next event
lastScrollTime = DateTime.Now;
//if (UseContinuousMouseWheelZoom)
//{
// var mouseWheelDelta = Math.Pow(2, e.DeltaY);
// Console.WriteLine($"MouseWheelDelta: {mouseWheelDelta}");
// var currentMousePosition = e.ToLocation(_clientRect);
// Map.Navigator.MouseWheelZoomContinuous(mouseWheelDelta, currentMousePosition);
//}
//else
//{
// var mouseWheelDelta = (int)e.DeltaY * -1; // so that it zooms like on windows
// var currentMousePosition = e.ToLocation(_clientRect);
// Map.Navigator.MouseWheelZoom(mouseWheelDelta, currentMousePosition);
//}
} |
… into feature/blazor-mouse-wheel
…lazor-mouse-wheel
This fixes #2033. It makes the mouse wheel step configurable, which makes touchpad on Mac usable. For touchpad Windows it is also an improvement. Pads simulate the mouse wheel by triggering an event but are more frequent than a real mouse wheel. By making is configurable it becomes manageable, better would be if we could detect if it is a real mouse wheel or a pad. |
This PR fixed touchpad but the mouse wheel now feels too slow. Perhaps we should use something to detect the device: |
Hi Paul
Yes Paul. We discussed the same. We could look at this Wednesday?
Robert Greenwood
Quintham.com
On 15 Mar 2024, at 19:16, Paul den Dulk ***@***.***> wrote:
This PR fixed touchpad but the mouse wheel now feels too slow. Perhaps we should use something to detect the device:
https://stackoverflow.com/questions/10744645/detect-touchpad-vs-mouse-in-javascript
—
Reply to this email directly, view it on GitHub<#2507 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AXZNGQKV5FR42RLQ44ZZJRDYYNCIVAVCNFSM6AAAAABDTEJ222VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBQGMYDIMBUHE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
These properties have been added to Blazor and Avalonia: