Example #1
0
        /// <summary>
        /// Operations to perform on MouseMove:
        ///     If we're moving a waypoint, update the waypoint location (for rendering) to the mouse location
        ///     Otherwise, don't do anything
        /// </summary>
        /// <param name="r"></param>
        /// <param name="e"></param>
        #region Operations to perform on MouseMove
        public void OnMouseMove(Renderer r, MouseEventArgs e)
        {
            mousePoint = new PointF(e.X, e.Y);
            PointF p = r.ScreenToWorld(e.Location);

            if (shouldMove == true)
            {
                foreach (WaypointRenderer wp in newPath.WaypointList)
                {
                    if (movePointWP.Equals(wp))
                    {
                        WaypointRenderer mouseWP = wp;
                        mouseWP.X = p.X;
                        mouseWP.Y = p.Y;
                        clonePathWP.AddWaypoint(mouseWP);
                        movePointWP = mouseWP;
                    }
                    else
                    {
                        clonePathWP.AddWaypoint(wp);
                    }
                }
                newPath     = clonePathWP;
                clonePathWP = new PathToRobotRenderer();
            }
        }