To reproduce: run the attached sample project and follow the steps in the gif file. When you start dragging, (i.e. when MouseMove first fires) there is a large jump to the position of the image.
This is not a bug. In order to avoid canvas jump when using the PanToPosition method, you must include Current GraphPosition property which calculate radDiagram1.DiagramElement.Position, resulting in smooth canvas movement.
using Telerik.Windows.Diagrams.Core;
private Point originalGraphPosition = new Point(double.NaN, double.NaN);
private Point currentGraphPosition = new Point(double.NaN, double.NaN);
private Point updatedGraphPosition = new Point(double.NaN, double.NaN);
private Point currentPoint;
private void radDiagram1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)// && mouseDown != Point.Empty)
{
this.radDiagram1.DiagramElement.IsMouseCaptured = true;
var currentPoint = e.Location;
double newX = this.currentGraphPosition.X + currentPoint.X - this.currentPoint.X;
double newY = this.currentGraphPosition.Y + currentPoint.Y - this.currentPoint.Y;
this.updatedGraphPosition = new Point(newX, newY);
this.radDiagram1.PanToPosition(updatedGraphPosition);
this.currentPoint = currentPoint;
this.currentGraphPosition = this.updatedGraphPosition;
}
}
private void radDiagram1_MouseDown(object sender, MouseEventArgs e)
{
this.originalGraphPosition = this.radDiagram1.DiagramElement.Position;
this.currentGraphPosition = this.originalGraphPosition;
this.currentPoint = e.Location;
}