Drag select doesn't work with Pan in new version of Nevron Chart


https://www.nevron.com/Forum/Topic12537.aspx
Print Topic | Close Window

By Stuart Jones - 6 Years Ago
Following an update from 18.4.26.12 to 18.7.18.12 drag select doesn't work for one of our charts.
We want to drag select when the left mouse button is down and pan when the middle mouse button is down.
It now also pans with the left mouse button down, you can't drag select.
By Nevron Support - 6 Years Ago
Hi Stuart,
Can you post the code that you use to configure the control for review?
By Stuart Jones - 6 Years Ago
Hi,
We add the pan tool first, with MouseButton.Middle as a parameter. It seems to try to pan with the left / right buttons pressed too. I have just tried to work around the problem by subclassing NDataPanTool. It seems to work:

public class NDataPanTooFix : NDataPanTool
{
    public override bool CanBeginDrag(object sender, NMouseEventArgs e)
    {
          if ( e.Button != BeginDragMouseCommand.MouseButton )
              return false;
          return base.CanBeginDrag(sender, e);
    }
}

This is how we configure the tools:

var dataPanTool = new NDataPanTool();
 dataPanTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Down, MouseButton.Middle, 1);
 dataPanTool.EndDragMouseCommand = new NMouseCommand(MouseAction.Up, MouseButton.Middle, 1);
 dataPanTool.EndDrag -= dataZoomOrPanTool_EndDrag;
 dataPanTool.EndDrag += dataZoomOrPanTool_EndDrag;
_nWpfChartControl.Controller.Tools.Add(dataPanTool);

var boxSelectTool = new NDragSelectPointsTool();
    boxSelectTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Down, MouseButton.Left, 1);
    boxSelectTool.EndDragMouseCommand = new NMouseCommand(MouseAction.Up, MouseButton.Left, 1);
    boxSelectTool.EndDrag -= boxSelectTool_EndDrag;
    boxSelectTool.EndDrag += boxSelectTool_EndDrag;
_nWpfChartControl.Controller.Tools.Add(boxSelectTool);
By Nevron Support - 6 Years Ago
Hi Stuart,

Thank you for posting the code. We've been able to replicate the problem and will publish a SP today or tomorrow.