I've got a SciChartSurface where I support zooming as follows:
- Zoom x-axis on regular scrolling.
- Zoom y-axis on scrolling +
CTRL
- Pan x-axis on scrolling +
Shift
I'd like to also enable panning in the X-direction when the user either scrolls horizontally on a trackpad or uses a horizontal scroll wheel (thumb-wheel). However, I'm not sure how to go about doing this.
Here's the extended MouseWheelZoomModifier I've been using. Can I somehow send it information about my scrolling behavior? Can I somehow just treat the sideways/horizontal scrolling as Shift
+ scroll? Thanks!
/// <summary>
/// Extended <see cref="MouseWheelZoomModifier"/> which modifies zoom
/// behavior based on modifier keys so that scrolling while holding CTRL
/// zooms vertically and doing so while holding SHIFT pans horizontally.
/// </summary>
class MouseWheelZoomModifierEx : MouseWheelZoomModifier {
public override void OnModifierMouseWheel(ModifierMouseArgs e) {
switch (e.Modifier) {
case MouseModifier.Ctrl:
ActionType = ActionType.Zoom;
XyDirection = XyDirection.YDirection;
break;
case MouseModifier.Shift:
ActionType = ActionType.Pan;
XyDirection = XyDirection.XDirection;
break;
default:
ActionType = ActionType.Zoom;
XyDirection = XyDirection.XDirection;
break;
}
// e.Modifier is set to None so that the base implementation of
// OnModifierMouseWheel doesn't change ActionType and XyDirection again.
e.Modifier = MouseModifier.None;
base.OnModifierMouseWheel(e);
}
}