protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
_dragPointID = _shapeControl.GetPoint(MouseToReal(e.Location));
if (_dragPointID >= 0)
{
return;
}
Primitive overPrimitive = GetPrimitiveAt(MouseToReal(e.Location));
if (overPrimitive != null &&
(ModifierKeys == Keys.Shift ||
(SelectedPrimitive == overPrimitive && _selectedTool == PrimitiveTool(overPrimitive)) ||
_selectedTool == TpTool.Select))
{
if (SelectionExists)
SelectedPrimitive.ShapeToolLost();
SelectedPrimitive = overPrimitive;
_shapeControl.Dragging = true;
UpdateCurrentTool();
Invalidate();
}
else
{
if (ModifierKeys == Keys.Shift)
return;
if (SelectionExists)
{
SelectedPrimitive.ShapeToolLost();
ResetSelectedPrimitive();
Invalidate();
}
_isPenDown = true;
if (_selectedTool == TpTool.FreeLine)
{
_currentPrimitive = new FreeLine();
}
else if (_selectedTool == TpTool.Line)
{
_currentPrimitive = new Line();
}
else if (_selectedTool == TpTool.TextBox)
{
_currentPrimitive = new DecoratedTextBox();
}
else if (_selectedTool == TpTool.Box)
{
_currentPrimitive = new Box();
}
else if (_selectedTool == TpTool.Select)
{
_currentPrimitive = null;
}
if (_currentPrimitive != null)
_currentPrimitive.CreationMouseDownHandler(MouseToReal(e.Location));
}
if (!SelectionExists)
RemoveAllProperties();
}