Detecting and ignoring zoom mouse clicks

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
NielsUll
Posts: 19
Joined: Thu Jan 19, 2017 8:23 am

Detecting and ignoring zoom mouse clicks

Post by NielsUll » Wed May 10, 2017 1:58 pm

Hi!

When the user clicks the left mouse button inside our ViewXY graph, we want to handle that (e.g. by centering a Band around the click).
We do this by handling MouseClick and it works fine.

We would also like to preserve the zoom functionality. But when the user zooms using press-drag-release, we do NOT want to move the band.
MouseClick still gets called when the mouse button is released and we cannot find out how to determine if this was part of a zoom operation or not?

We tried setting a flag in ViewXY.BeforeZooming and clearing it in ViewXY.Zoomed, but these methods are called after MouseClick.

We are using the Semibindable classes and version 7.2.6 , in case that matters,

Regards,
Niels Harremoës

ArctionKestutis
Posts: 555
Joined: Mon Mar 14, 2016 9:22 am

Re: Detecting and ignoring zoom mouse clicks

Post by ArctionKestutis » Thu May 11, 2017 7:13 am

Hi Niels,

There is not suitable public event in this case. However, the simplest solution is to save mouse-position during _chart.PreviewMouseLeftButtonDown (in WinForms MouseDown) event and compare that position during MouseClick event. If difference between mouse positions bigger than certain value, when it is Zooming operation and Band's movement should be canceled.

Hope this helps.
All the best.
Kestutis

NielsUll
Posts: 19
Joined: Thu Jan 19, 2017 8:23 am

Re: Detecting and ignoring zoom mouse clicks

Post by NielsUll » Mon May 15, 2017 6:58 am

Thanks - that solved the problem.

Post Reply