protected override void OnMouseMove(MouseEventArgs e)
{
Primitive overPrimitive = GetPrimitiveAt(MouseToReal(e.Location));
Cursor cursor = _shapeControl.GetCursor(MouseToReal(e.Location), _dragPointID);
if (cursor != null)
{
Cursor = cursor;
}
else if (_shapeControl != null && _shapeControl.PointIn(MouseToReal(e.Location)))
{
if (SelectionExists)
Cursor = SelectedPrimitive.GetCursor(MouseToReal(e.Location));
}
else if (overPrimitive != null && ModifierKeys == Keys.Shift)
{
Cursor = Cursors.Hand;
}
else
{
Cursor = Cursors.Default;
}
if (e.Button == MouseButtons.Left)
{
if (_dragPointID >= 0 && SelectionExists)
{
_shapeControl.MovePoint(_dragPointID, MouseToReal(e.Location));
SelectedPrimitive.OnResize(false);
_resizeMode = true;
Invalidate();
}
else if (_shapeControl.Dragging && SelectionExists)
{
float dx = ((_lastMousePosition.X - e.X)/_zoom);
float dy = ((_lastMousePosition.Y - e.Y)/_zoom);
_shapeControl.MoveBy(dx, dy);
Invalidate();
}
else if (_isPenDown && _currentPrimitive != null)
{
_currentPrimitive.CreationMouseMoveHandler(MouseToReal(e.Location));
Invalidate();
}
}
if (e.Button == MouseButtons.Right)
{
float dx = _lastMousePosition.X - e.X;
float dy = _lastMousePosition.Y - e.Y;
PointF tpt = new PointF(_offsetX + dx, _offsetY + dy);
RectangleF rc = CalculateGlobalBounds();
rc.Offset(-Width, -Height);
rc.Size = new SizeF(rc.Width + Width*2, rc.Height + Height*2);
if (rc.Contains(tpt))
{
_offsetX += dx;
_offsetY += dy;
Invalidate();
}
}
//if (SelectionExists)
// NormalizeEx();
_lastMousePosition = e.Location;
}