Hi, thanks for describing you requirement better. We recommend you create a class that inherits the mouse wheel tool:
public class MyWheelTool : NMouseWheelScrollAndZoomTool
{
public MyWheelTool()
{
this.Enabled = true;
this.ScrollByDefault = false;
m_Location = NPointF.Empty;
}
protected override bool DoWheelZoom(int delta)
{
if (AllowWheelZooming == false)
return false;
float zoom = View.ScaleX;
zoom += delta > 0 ? Document.Settings.ZoomStep : -Document.Settings.ZoomStep;
if (View.IsValidScaleFactor(zoom) == false)
return false;
if (View.IsValidScaleFactor(zoom) == false)
return false;
NPointF p1 = View.GetMousePositionInScene();
if (m_Location == NPointF.Empty ||
m_Location.Distance(p1) > 300)
{
m_Location = p1;
}
// Zoom the view
View.Zoom(zoom, m_Location);
return true;
}
private NPointF m_Location;
}
Then all you have to do is to replace the default mouse wheel tool with your custom tool:
private void ApplyMouseWheelTool()
{
// replace the default mouse wheel tool
NTool tool = view.Controller.Tools.GetToolByName(NDWFR.ToolMouseWheelScrollAndZoom);
int index = view.Controller.Tools.IndexOf(tool);
view.Controller.Tools.RemoveAt(index);
view.Controller.Tools.Insert(index, new MyWheelTool());
}
Best Regards,
Nevron Support Team