// Mouse moves
        public override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (panning)
            {
                return;                     //mxd. Skip all this jass while panning
            }
            if (curControlHandle != -1)
            {
                ControlHandle handle = controlHandles[curControlHandle];

                handle.Position = (snaptogrid ? General.Map.Grid.SnappedToGrid(mousemappos) : mousemappos);

                if (form.MirrorMode)
                {
                    Vector2D pos = handle.RelativePosition;
                    //handle angle
                    float angle = (float)Math.Atan2(-pos.y, -pos.x) + Angle2D.PIHALF;
                    //angle of line, connecting handles ControlledPoints
                    float dirAngle      = -(float)Math.Atan2(handle.Pair.ControlledPoint.y - handle.ControlledPoint.y, handle.Pair.ControlledPoint.x - handle.ControlledPoint.x);
                    float length        = (float)Math.Sqrt(Math.Pow(Math.Abs(pos.x), 2.0) + Math.Pow(Math.Abs(pos.y), 2.0));
                    float mirroredAngle = angle + dirAngle * 2.0f;

                    handle.Pair.RelativePosition = new Vector2D((float)Math.Sin(mirroredAngle) * length, (float)Math.Cos(mirroredAngle) * length);
                }
                else if (form.CopyMode)
                {
                    handle.Pair.RelativePosition = handle.RelativePosition;
                }
                Update();
            }
        }
        //this checks if initial data is valid
        private bool Setup(List <Line> lines)
        {
            if (!SetupPointGroups(lines))
            {
                return(false);
            }

            //setup control handles
            Vector2D center1 = CurveTools.GetPointOnLine(pointGroup1[0], pointGroup1[segmentsCount - 1], 0.5f);
            Vector2D center2 = CurveTools.GetPointOnLine(pointGroup2[0], pointGroup2[segmentsCount - 1], 0.5f);

            Vector2D loc1 = GetHandleLocation(pointGroup1[0], pointGroup1[segmentsCount - 1], center2);
            Vector2D loc2 = GetHandleLocation(pointGroup2[0], pointGroup2[segmentsCount - 1], center1);

            ControlHandle ch1 = new ControlHandle {
                ControlledPoint = pointGroup1[0], RelativePosition = loc1
            };
            ControlHandle ch2 = new ControlHandle {
                ControlledPoint = pointGroup2[0], RelativePosition = loc2
            };
            ControlHandle ch3 = new ControlHandle {
                ControlledPoint = pointGroup1[segmentsCount - 1], RelativePosition = loc1
            };
            ControlHandle ch4 = new ControlHandle {
                ControlledPoint = pointGroup2[segmentsCount - 1], RelativePosition = loc2
            };

            ch1.Pair = ch3;
            ch2.Pair = ch4;
            ch3.Pair = ch1;
            ch4.Pair = ch2;

            controlHandles = new[] { ch1, ch2, ch3, ch4 };

            //setup relative segments lengths
            relLenGroup1 = GetRelativeLengths(pointGroup1);
            relLenGroup2 = GetRelativeLengths(pointGroup2);

            return(true);
        }