-
Notifications
You must be signed in to change notification settings - Fork 981
Description
ScottPlot Version: 5.0.55
Platform: WinUI 3
Environment: .NET 8
Hi! I'm working on a WinUI application using ScottPlot and have encountered issues that I'd like to address properly using ScottPlot's built-in systems:
I'm trying to create a custom mouse wheel behavior where:
- Normal mouse wheel: No plot interaction (let parent ScrollViewer handle it)
- Ctrl + mouse wheel: Plot zoom only
I've created a custom IUserActionResponse but can't get keyboard modifier detection to work properly. The control doesn't receive KeyDown/KeyUp events, so KeyboardState.IsPressed() always returns false.
public class CtrlOnlyMouseWheelZoom : IUserActionResponse
{
public ResponseInfo Execute(IPlotControl plotControl, IUserAction userInput, KeyboardState keys)
{
// This always returns false, even when Ctrl is pressed
bool isCtrlPressed = keys.IsPressed(StandardKeys.Control);
if (userInput is MouseWheelUp && isCtrlPressed)
{
// Handle zoom in
}
else if (userInput is MouseWheelDown && isCtrlPressed)
{
// Handle zoom out
}
return ResponseInfo.NoActionRequired;
}
}Questions:
- Is
KeyboardState.IsPressed()the correct way to detect modifiers in UserActionResponse? - Are there any platform-specific issues with keyboard state detection in WinUI?
- How does the built-in
KeyboardPanAndZoomclass detectZoomModifierKey- should I follow that pattern?
Additional observation:
The built-in KeyboardPanAndZoom also seems to have the same issue with Ctrl key detection - this suggests the keyboard modifier detection might have broader issues in WinUI.
Current workaround:
Using WinUI's PointerWheelChanged with e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control), but I'd prefer to use ScottPlot's interaction system.
Any guidance on the proper approach would be greatly appreciated!