Skip to content

WpfPlot mouse wheel zoom with custom DPI #490

@nashilnik

Description

@nashilnik

Describe the bug
If the screen scaling is set to a custom value (anything but 100%) the zoom point is wrong when you zoom with mouse wheel.

To Reproduce

  1. Set screen scaling to 125%
  2. Launch any plot in the demo
  3. Zoom to a point using mouse wheel
  4. Verify that the zoom point is wrong

Screenshots
wJbP2BIPlh

Fix
To fix it you need to change https://github.com/swharden/ScottPlot/blob/404105e5d7ae8399b2e40e9bd64b246d3b3b80dd/src/ScottPlot.WPF/WpfPlot.xaml.cs#L448
From
var mousePixel = GetPixelPosition(e);
to
var mousePixel = e.GetPosition(this);

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions