private void Control_OnMouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { var pos = e.GetPosition(this); if (_lastMovePosition == new Point()) { _lastMovePosition = pos; } var d = pos.Y - _lastMovePosition.Y; _lastMovePosition = pos; var r = ViewportModelRect; var y = VerticalAxis.ClientToModel(VerticalAxis.ModelToClient(r.Y) - d); if (VerticalAxis is Log10Axis) { r.Height *= y / r.Y; } r.Y = y; if (!double.IsNaN(r.X) && !double.IsNaN(r.Y) && !double.IsNaN(r.Width) && !double.IsNaN(r.Height)) { ViewportModelRect = r; } } else { _lastMovePosition = new Point(); } }