void parent_MouseUp(object sender, MouseEventArgs e) { invalidationList.Clear(); if (e.Button == MouseButtons.Right) return; blnSuspendHitTest = false; blnFoundHit = false; blnEndShortLoop = false; if (intCurIndex != -1)// && !blnShapeHasMoved) { eventData = shapes[intCurIndex].MouseUp(e); if (eventData.NeedsPainted) invalidationList.Add((short)intCurIndex); blnFoundHit = (eventData.WasHit); blnSuspendHitTest = (_isAddingShape || blnShapeHasMoved || (intPrevIndex != intCurIndex) || shapes[intCurIndex].EditingOn || eventData.HoldPosition); for (short i = (short)(intCurIndex == 0? (shapes.Count-1) : intCurIndex); i > -1; i--) { if (!blnSuspendHitTest && i != intCurIndex && shapes[i].HitTest(e)) { intCurIndex = i; blnSuspendHitTest = true; blnFoundHit = true; shapes[intCurIndex].isSelected = true; shapes[intCurIndex].EditingOn = curTool == Tools.eTool.Edit; invalidationList.Add(intCurIndex); i = -1; //exit loop } if (i - 1 == -1 && !blnEndShortLoop) { blnEndShortLoop = true; i = (short)(shapes.Count); //loop will decrement it to a zero based index } if (blnSuspendHitTest) i = -1; } } if (!blnFoundHit) intCurIndex = -1; if (intPrevIndex != -1 && intPrevIndex != intCurIndex) { shapes[intPrevIndex].isSelected = false; invalidationList.Add((short)intPrevIndex); } if (intCurIndex != -1 && !blnFoundHit && !shapes[intCurIndex].EditingOn) { intCurIndex = -1; intPrevIndex = -1; } else intPrevIndex = intCurIndex; DoInvalidation(); }
public void RestoreNonSerializable() { ResizeHandles = new Handle(); eventData = new EventData(); invalidationArea = GetShapeBounds(true); Restore_NonSerialized(); }
void parent_MouseDown(object sender, MouseEventArgs e) { invalidationList.Clear(); if (e.Button == MouseButtons.Left) { blnFoundHit = false; blnSuspendHitTest = false; if (intCurIndex != -1) { eventData = shapes[intCurIndex].MouseDown(e); if (eventData.NeedsPainted || eventData.FinalizeShape) invalidationList.Add((short)intCurIndex); blnSuspendHitTest = eventData.WasHit; if (eventData.FinalizeShape) FinalizeShape(); } if (!blnSuspendHitTest) { for (short i = (short)(shapes.Count - 1); i > -1; i--) { if (!blnSuspendHitTest && shapes[i].HitTest(e)) { intCurIndex = i; shapes[intCurIndex].EditingOn = curTool == Tools.eTool.Edit; shapes[intCurIndex].MouseDown(e); invalidationList.Add(intCurIndex); blnSuspendHitTest = true; i = -1; //terminate the loop } } } } DoInvalidation(); }