public void ResizeObjects(Point dest) { Point offset; offset = new Point(dest.X - MovingPoint.X, dest.Y - MovingPoint.Y); foreach (DrawableObject obj in SelectedObjects) { obj.ResizeCheck(ref offset, ResizingType); } foreach (DrawableObject obj in SelectedObjects) { if (obj is Transition) { PreviousObject = OnObject; OnObject = draw.GetOnObject(dest); OnTransition = (Transition)obj; if (OnObject == null) { offset = new Point(dest.X - MovingPoint.X, dest.Y - MovingPoint.Y); OnTransition.Resize(offset, ResizingType); if (ResizingType == ResizingTypes.Spline0) { OnTransition.StartObject = null; } else if (ResizingType == ResizingTypes.Spline3) { OnTransition.EndObject = null; } } else if (ResizingType == ResizingTypes.Spline0) { if ((obj is Transition && (OnObject is End || OnObject is Abort || OnObject is Relation)) || (obj is SuperTransition && (OnObject is Alias || OnObject is SimpleState || OnObject is StateAlias)) || (OnObject is Origin && OnObject.OutTransitions.Length != 0 && OnTransition != OnObject.OutTransitions.First())) { OnObject = null; return; } else { double angle; OnObject.Intersect(dest, ref StartDrawPoint, ref OnTransition.StartAngle); offset = new Point(StartDrawPoint.X - MovingPoint.X, StartDrawPoint.Y - MovingPoint.Y); OnTransition.Resize(offset, ResizingType); OnTransition.OutDir(OnObject.OutDir(StartDrawPoint, out angle), 1); } if (PreviousObject != OnObject) { OnTransition.StartObject = OnObject; } } else if (ResizingType == ResizingTypes.Spline3) { if (OnObject is Origin || OnObject is Relation) { OnObject = null; return; } else { double angle; OnObject.Intersect(dest, ref StartDrawPoint, ref OnTransition.EndAngle); offset = new Point(StartDrawPoint.X - MovingPoint.X, StartDrawPoint.Y - MovingPoint.Y); OnTransition.Resize(offset, ResizingType); OnTransition.OutDir(OnObject.OutDir(StartDrawPoint, out angle), 2); } if (PreviousObject != OnObject) { OnTransition.EndObject = OnObject; } } } else if (obj is SimpleState || obj is StateAlias) { State oState = (State)obj; obj.Resize(offset, ResizingType); foreach (Transition oTransition in oState.InTransitions) { oTransition.MoveEndTo(oState.PointFromAngle(oTransition.EndAngle)); } foreach (Transition oTransition in oState.OutTransitions) { oTransition.MoveStartTo(oState.PointFromAngle(oTransition.StartAngle)); } } else if (obj is SuperState) { SuperState oState = (SuperState)obj; obj.Resize(offset, ResizingType); foreach (Transition oTransition in oState.InTransitions) { oTransition.MoveEndTo(oState.PointFromOffset(ResizingType, oTransition.EndPoint, oTransition.EndAngle)); } foreach (Transition oTransition in oState.OutTransitions) { oTransition.MoveStartTo(oState.PointFromOffset(ResizingType, oTransition.StartPoint, oTransition.StartAngle)); } } else if (obj is Nested) { Nested oState = (Nested)obj; obj.Resize(offset, ResizingType); foreach (Transition oTransition in oState.InTransitions) { oTransition.MoveEndTo(oState.PointFromOffset(ResizingType, oTransition.EndPoint, oTransition.EndAngle)); } foreach (Transition oTransition in oState.OutTransitions) { oTransition.MoveStartTo(oState.PointFromOffset(ResizingType, oTransition.StartPoint, oTransition.StartAngle)); } } else { obj.Resize(offset, ResizingType); } } MovingPoint.Offset(offset); }