/// <summary>
/// Overridden. Do auto-panning even when the mouse is not moving.
/// </summary>
/// <param name="sender">The source of the drag event.</param>
/// <param name="e">A PInputEventArgs that contains the event data.</param>
protected override void OnDragActivityStep(object sender, PInputEventArgs e)
{
base.OnDragActivityStep(sender, e);
if (!autopan)
{
return;
}
PCamera c = e.Camera;
RectangleF b = c.Bounds;
PointF l = e.GetPositionRelativeTo(c);
PUtil.OutCode outcode = PUtil.RectangleOutCode(l, b);
SizeF delta = SizeF.Empty;
if ((outcode & PUtil.OutCode.Top) != 0)
{
delta.Height = ValidatePanningDelta(-1.0f - (0.5f * Math.Abs(l.Y - b.Y)));
}
else if ((outcode & PUtil.OutCode.Bottom) != 0)
{
delta.Height = ValidatePanningDelta(1.0f + (0.5f * Math.Abs(l.Y - (b.Y + b.Height))));
}
if ((outcode & PUtil.OutCode.Right) != 0)
{
delta.Width = ValidatePanningDelta(1.0f + (0.5f * Math.Abs(l.X - (b.X + b.Width))));
}
else if ((outcode & PUtil.OutCode.Left) != 0)
{
delta.Width = ValidatePanningDelta(-1.0f - (0.5f * Math.Abs(l.X - b.X)));
}
delta = c.LocalToView(delta);
if (delta.Width != 0 || delta.Height != 0)
{
c.TranslateViewBy(delta.Width, delta.Height);
}
}