public override void OnSecondaryClickOverlay()
        {
            if (IsCursorInPanel())
            {
                return;
            }

            switch (GetMarkerSelectionMode())
            {
            case MarkerSelectionMode.None:
            default:
#if DEBUGCONN
                Log._Debug($"TppLaneConnectorTool: OnSecondaryClickOverlay: nothing to do");
#endif
                stayInLaneMode = StayInLaneMode.None;
                break;

            case MarkerSelectionMode.SelectSource:
                // deselect node
#if DEBUGCONN
                Log._Debug($"TppLaneConnectorTool: OnSecondaryClickOverlay: selected node id = 0");
#endif
                SelectedNodeId = 0;
                break;

            case MarkerSelectionMode.SelectTarget:
                // deselect source marker
#if DEBUGCONN
                Log._Debug($"TppLaneConnectorTool: OnSecondaryClickOverlay: switch to selected source mode");
#endif
                selectedMarker = null;
                break;
            }
        }
        public override void OnActivate()
        {
#if DEBUGCONN
            Log._Debug("TppLaneConnectorTool: OnActivate");
#endif
            SelectedNodeId = 0;
            selectedMarker = null;
            hoveredMarker  = null;
            stayInLaneMode = StayInLaneMode.None;
            RefreshCurrentNodeMarkers();
        }
        public static void StayInLane(ushort nodeId, StayInLaneMode stayInLaneMode = StayInLaneMode.Both)
        {
            if (stayInLaneMode != StayInLaneMode.None)
            {
                NetNode[]             nodesBuffer = Singleton <NetManager> .instance.m_nodes.m_buffer;
                List <NodeLaneMarker> nodeMarkers = GetNodeMarkers(
                    nodeId,
                    ref nodesBuffer[nodeId]);

                if (nodeMarkers != null)
                {
                    int forwardSegmentIndex = GetFirstSegmentIndex(nodesBuffer[nodeId]);
                    foreach (NodeLaneMarker sourceLaneMarker in nodeMarkers)
                    {
                        if (!sourceLaneMarker.IsSource)
                        {
                            continue;
                        }
                        if ((stayInLaneMode == StayInLaneMode.Forward) ||
                            (stayInLaneMode == StayInLaneMode.Backward))
                        {
                            if ((sourceLaneMarker.SegmentIndex == forwardSegmentIndex)
                                ^ (stayInLaneMode == StayInLaneMode.Backward))
                            {
                                continue;
                            }
                        }

                        foreach (NodeLaneMarker targetLaneMarker in nodeMarkers)
                        {
                            if (!targetLaneMarker.IsTarget || (targetLaneMarker.SegmentId ==
                                                               sourceLaneMarker.SegmentId))
                            {
                                continue;
                            }

                            if (targetLaneMarker.InnerSimilarLaneIndex
                                == sourceLaneMarker.InnerSimilarLaneIndex)
                            {
                                Log._Debug(
                                    $"Adding lane connection {sourceLaneMarker.LaneId} -> " +
                                    $"{targetLaneMarker.LaneId}");
                                LaneConnectionManager.Instance.AddLaneConnection(
                                    sourceLaneMarker.LaneId,
                                    targetLaneMarker.LaneId,
                                    sourceLaneMarker.StartNode);
                            } // end if
                        }     // end foreach
                    }         // end foreach
                }             // end if
            }                 // end if
        }
        public override void OnActivate()
        {
#if DEBUG
            bool logLaneConn = DebugSwitch.LaneConnections.Get();
            if (logLaneConn)
            {
                Log._Debug("LaneConnectorTool: OnActivate");
            }
#endif
            SelectedNodeId = 0;
            selectedMarker = null;
            hoveredMarker  = null;
            stayInLaneMode = StayInLaneMode.None;
            RefreshCurrentNodeMarkers();
        }
Ejemplo n.º 5
0
        public override void OnActivate()
        {
#if DEBUGCONN
            bool debug = GlobalConfig.Instance.Debug.Switches[23];
            if (debug)
            {
                Log._Debug("TppLaneConnectorTool: OnActivate");
            }
#endif
            SelectedNodeId = 0;
            selectedMarker = null;
            hoveredMarker  = null;
            stayInLaneMode = StayInLaneMode.None;
            RefreshCurrentNodeMarkers();
        }
        public override void OnSecondaryClickOverlay()
        {
#if DEBUG
            bool logLaneConn = DebugSwitch.LaneConnections.Get();
#else
            const bool logLaneConn = false;
#endif

            if (IsCursorInPanel())
            {
                return;
            }

            switch (GetMarkerSelectionMode())
            {
            // also: case MarkerSelectionMode.None:
            default: {
                Log._DebugIf(
                    logLaneConn,
                    () => "LaneConnectorTool: OnSecondaryClickOverlay: nothing to do");
                stayInLaneMode = StayInLaneMode.None;
                break;
            }

            case MarkerSelectionMode.SelectSource: {
                // deselect node
                Log._DebugIf(
                    logLaneConn,
                    () => "LaneConnectorTool: OnSecondaryClickOverlay: selected node id = 0");
                SelectedNodeId = 0;
                break;
            }

            case MarkerSelectionMode.SelectTarget: {
                // deselect source marker
                Log._DebugIf(
                    logLaneConn,
                    () => "LaneConnectorTool: OnSecondaryClickOverlay: switch to selected source mode");
                selectedMarker = null;
                break;
            }
            }
        }
        public override void OnPrimaryClickOverlay()
        {
#if DEBUG
            bool logLaneConn = DebugSwitch.LaneConnections.Get();
#else
            const bool logLaneConn = false;
#endif
            Log._DebugIf(
                logLaneConn,
                () => $"LaneConnectorTool: OnPrimaryClickOverlay. SelectedNodeId={SelectedNodeId} " +
                $"SelectedSegmentId={SelectedSegmentId} HoveredNodeId={HoveredNodeId} " +
                $"HoveredSegmentId={HoveredSegmentId}");

            if (IsCursorInPanel())
            {
                return;
            }

            if (GetMarkerSelectionMode() == MarkerSelectionMode.None)
            {
                if (HoveredNodeId != 0)
                {
                    Log._DebugIf(
                        logLaneConn,
                        () => "LaneConnectorTool: HoveredNode != 0");

                    if (NetManager.instance.m_nodes.m_buffer[HoveredNodeId].CountSegments() < 2)
                    {
                        // this node cannot be configured (dead end)
                        Log._DebugIf(
                            logLaneConn,
                            () => "LaneConnectorTool: Node is a dead end");

                        SelectedNodeId = 0;
                        selectedMarker = null;
                        stayInLaneMode = StayInLaneMode.None;
                        return;
                    }

                    if (SelectedNodeId != HoveredNodeId)
                    {
                        Log._DebugIf(
                            logLaneConn,
                            () => $"Node {HoveredNodeId} has been selected. Creating markers.");

                        // selected node has changed. create markers
                        List <NodeLaneMarker> markers = GetNodeMarkers(
                            HoveredNodeId,
                            ref Singleton <NetManager> .instance.m_nodes.m_buffer[HoveredNodeId]);

                        if (markers != null)
                        {
                            SelectedNodeId = HoveredNodeId;
                            selectedMarker = null;
                            stayInLaneMode = StayInLaneMode.None;

                            currentNodeMarkers[SelectedNodeId] = markers;
                        }

                        // this.allNodeMarkers[SelectedNodeId] = GetNodeMarkers(SelectedNodeId);
                    }
                }
                else
                {
                    Log._DebugIf(
                        logLaneConn,
                        () => $"LaneConnectorTool: Node {SelectedNodeId} has been deselected.");

                    // click on free spot. deselect node
                    SelectedNodeId = 0;
                    selectedMarker = null;
                    stayInLaneMode = StayInLaneMode.None;
                    return;
                }
            }

            if (hoveredMarker == null)
            {
                return;
            }

            //-----------------------------------
            // Hovered Marker
            //-----------------------------------
            stayInLaneMode = StayInLaneMode.None;

            Log._DebugIf(
                logLaneConn,
                () => $"LaneConnectorTool: hoveredMarker != null. selMode={GetMarkerSelectionMode()}");

            // hovered marker has been clicked
            if (GetMarkerSelectionMode() == MarkerSelectionMode.SelectSource)
            {
                // select source marker
                selectedMarker = hoveredMarker;
                Log._DebugIf(
                    logLaneConn,
                    () => "LaneConnectorTool: set selected marker");
            }
            else if (GetMarkerSelectionMode() == MarkerSelectionMode.SelectTarget)
            {
                // select target marker
                // bool success = false;
                if (LaneConnectionManager.Instance.RemoveLaneConnection(
                        selectedMarker.LaneId,
                        hoveredMarker.LaneId,
                        selectedMarker.StartNode))
                {
                    // try to remove connection
                    selectedMarker.ConnectedMarkers.Remove(hoveredMarker);
                    Log._DebugIf(
                        logLaneConn,
                        () => $"LaneConnectorTool: removed lane connection: {selectedMarker.LaneId}, " +
                        $"{hoveredMarker.LaneId}");

                    // success = true;
                }
                else if (LaneConnectionManager.Instance.AddLaneConnection(
                             selectedMarker.LaneId,
                             hoveredMarker.LaneId,
                             selectedMarker.StartNode))
                {
                    // try to add connection
                    selectedMarker.ConnectedMarkers.Add(hoveredMarker);
                    Log._DebugIf(
                        logLaneConn,
                        () => $"LaneConnectorTool: added lane connection: {selectedMarker.LaneId}, " +
                        $"{hoveredMarker.LaneId}");

                    // success = true;
                }

                /*if (success) {
                 *          // connection has been modified. switch back to source marker selection
                 *          Log._Debug($"LaneConnectorTool: switch back to source marker selection");
                 *          selectedMarker = null;
                 *          selMode = MarkerSelectionMode.SelectSource;
                 *  }*/
            }
        }
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo)
        {
            // Log._Debug($"LaneConnectorTool: RenderOverlay. SelectedNodeId={SelectedNodeId}
            //     SelectedSegmentId={SelectedSegmentId} HoveredNodeId={HoveredNodeId}
            //     HoveredSegmentId={HoveredSegmentId} IsInsideUI={MainTool.GetToolController().IsInsideUI}");

            // draw lane markers and connections
            hoveredMarker = null;

            ShowOverlay(false, cameraInfo);

            // draw bezier from source marker to mouse position in target marker selection
            if (SelectedNodeId != 0)
            {
                if (GetMarkerSelectionMode() == MarkerSelectionMode.SelectTarget)
                {
                    Vector3 selNodePos =
                        NetManager.instance.m_nodes.m_buffer[SelectedNodeId].m_position;

                    // Draw a currently dragged curve
                    var pos = HitPos;
                    if (hoveredMarker == null)
                    {
                        float hitH = TrafficManagerTool.GetAccurateHitHeight();
                        pos.y = hitH; // fix height.
                        float mouseH = MousePosition.y;
                        if (hitH < mouseH - MAX_HIT_ERROR)
                        {
                            // for metros lane curve is projected on the ground.
                            pos = MousePosition;
                        }
                    }
                    else
                    {
                        // snap to hovered:
                        pos = hoveredMarker.SecondaryPosition;
                    }
                    DrawLaneCurve(
                        cameraInfo,
                        selectedMarker.Position,
                        pos,
                        selNodePos,
                        Color.Lerp(selectedMarker.Color, Color.white, 0.33f),
                        Color.white,
                        size: 0.11f);
                }

                bool deleteAll =
                    (frameClearPressed > 0) && ((Time.frameCount - frameClearPressed) < 20); // 0.33 sec

                NetNode[] nodesBuffer = Singleton <NetManager> .instance.m_nodes.m_buffer;

                // Must press Shift+S (or another shortcut) within last 20 frames for this to work
                bool stayInLane = (frameStayInLanePressed > 0) &&
                                  ((Time.frameCount - frameStayInLanePressed) < 20) && // 0.33 sec
                                  (nodesBuffer[SelectedNodeId].CountSegments() == 2);

                if (stayInLane)
                {
                    frameStayInLanePressed = 0; // not pressed anymore (consumed)
                    deleteAll = true;
                }

                if (deleteAll)
                {
                    frameClearPressed = 0; // consumed
                    // remove all connections at selected node
                    LaneConnectionManager.Instance.RemoveLaneConnectionsFromNode(SelectedNodeId);
                    RefreshCurrentNodeMarkers(SelectedNodeId);
                }

                if (stayInLane)
                {
                    // "stay in lane"
                    switch (stayInLaneMode)
                    {
                    case StayInLaneMode.None: {
                        stayInLaneMode = StayInLaneMode.Both;
                        break;
                    }

                    case StayInLaneMode.Both: {
                        stayInLaneMode = StayInLaneMode.Forward;
                        break;
                    }

                    case StayInLaneMode.Forward: {
                        stayInLaneMode = StayInLaneMode.Backward;
                        break;
                    }

                    case StayInLaneMode.Backward: {
                        stayInLaneMode = StayInLaneMode.None;
                        break;
                    }
                    }

                    if (stayInLaneMode != StayInLaneMode.None)
                    {
                        selectedMarker = null;
                        StayInLane(SelectedNodeId, stayInLaneMode);
                        RefreshCurrentNodeMarkers(SelectedNodeId);
                    }
                } // if stay in lane
            }     // if selected node

            if ((GetMarkerSelectionMode() == MarkerSelectionMode.None) && (HoveredNodeId != 0))
            {
                // draw hovered node
                MainTool.DrawNodeCircle(cameraInfo, HoveredNodeId, Input.GetMouseButton(0));
            }
        }
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo)
        {
            //Log._Debug($"LaneConnectorTool: RenderOverlay. SelectedNodeId={SelectedNodeId} SelectedSegmentId={SelectedSegmentId} HoveredNodeId={HoveredNodeId} HoveredSegmentId={HoveredSegmentId} IsInsideUI={MainTool.GetToolController().IsInsideUI}");
            // draw lane markers and connections

            hoveredMarker = null;

            ShowOverlay(false, cameraInfo);

            // draw bezier from source marker to mouse position in target marker selection
            if (SelectedNodeId != 0)
            {
                if (GetMarkerSelectionMode() == MarkerSelectionMode.SelectTarget)
                {
                    Vector3 selNodePos = NetManager.instance.m_nodes.m_buffer[SelectedNodeId].m_position;

                    ToolBase.RaycastOutput output;
                    if (RayCastSegmentAndNode(out output))
                    {
                        RenderLane(cameraInfo, selectedMarker.position, output.m_hitPos, selNodePos, selectedMarker.color);
                    }
                }

                var deleteAll = frameClearPressed > 0 && (Time.frameCount - frameClearPressed) < 20; // 0.33 sec

                // Must press Shift+S (or another shortcut) within last 20 frames for this to work
                var stayInLane = frameStayInLanePressed > 0 &&
                                 (Time.frameCount - frameStayInLanePressed) < 20 && // 0.33 sec
                                 Singleton <NetManager> .instance.m_nodes.m_buffer[SelectedNodeId].CountSegments() == 2;

                if (stayInLane)
                {
                    frameStayInLanePressed = 0; // not pressed anymore (consumed)
                    deleteAll = true;
                }

                if (deleteAll)
                {
                    frameClearPressed = 0; // consumed
                    // remove all connections at selected node
                    LaneConnectionManager.Instance.RemoveLaneConnectionsFromNode(SelectedNodeId);
                    RefreshCurrentNodeMarkers(SelectedNodeId);
                }

                if (stayInLane)
                {
                    // "stay in lane"
                    switch (stayInLaneMode)
                    {
                    case StayInLaneMode.None:
                        stayInLaneMode = StayInLaneMode.Both;
                        break;

                    case StayInLaneMode.Both:
                        stayInLaneMode = StayInLaneMode.Forward;
                        break;

                    case StayInLaneMode.Forward:
                        stayInLaneMode = StayInLaneMode.Backward;
                        break;

                    case StayInLaneMode.Backward:
                        stayInLaneMode = StayInLaneMode.None;
                        break;
                    }

                    if (stayInLaneMode != StayInLaneMode.None)
                    {
                        List <NodeLaneMarker> nodeMarkers = GetNodeMarkers(SelectedNodeId, ref Singleton <NetManager> .instance.m_nodes.m_buffer[SelectedNodeId]);
                        if (nodeMarkers != null)
                        {
                            selectedMarker = null;
                            foreach (NodeLaneMarker sourceLaneMarker in nodeMarkers)
                            {
                                if (!sourceLaneMarker.isSource)
                                {
                                    continue;
                                }

                                if (stayInLaneMode == StayInLaneMode.Forward || stayInLaneMode == StayInLaneMode.Backward)
                                {
                                    if (sourceLaneMarker.segmentIndex == 0 ^ stayInLaneMode == StayInLaneMode.Backward)
                                    {
                                        continue;
                                    }
                                }

                                foreach (NodeLaneMarker targetLaneMarker in nodeMarkers)
                                {
                                    if (!targetLaneMarker.isTarget || targetLaneMarker.segmentId == sourceLaneMarker.segmentId)
                                    {
                                        continue;
                                    }

                                    if (targetLaneMarker.innerSimilarLaneIndex == sourceLaneMarker.innerSimilarLaneIndex)
                                    {
                                        Log._Debug($"Adding lane connection {sourceLaneMarker.laneId} -> {targetLaneMarker.laneId}");
                                        LaneConnectionManager.Instance.AddLaneConnection(sourceLaneMarker.laneId, targetLaneMarker.laneId, sourceLaneMarker.startNode);
                                    }
                                }
                            }
                        }
                        RefreshCurrentNodeMarkers(SelectedNodeId);
                    }
                }
            }

            if (GetMarkerSelectionMode() == MarkerSelectionMode.None && HoveredNodeId != 0)
            {
                // draw hovered node
                MainTool.DrawNodeCircle(cameraInfo, HoveredNodeId, Input.GetMouseButton(0));
            }
        }
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo)
        {
            //Log._Debug($"TppLaneConnectorTool: RenderOverlay. SelectedNodeId={SelectedNodeId} SelectedSegmentId={SelectedSegmentId} HoveredNodeId={HoveredNodeId} HoveredSegmentId={HoveredSegmentId} IsInsideUI={MainTool.GetToolController().IsInsideUI}");
            // draw lane markers and connections

            hoveredMarker = null;

            ShowOverlay(false, cameraInfo);

            // draw bezier from source marker to mouse position in target marker selection
            if (SelectedNodeId != 0)
            {
                if (GetMarkerSelectionMode() == MarkerSelectionMode.SelectTarget)
                {
                    Vector3 selNodePos = NetManager.instance.m_nodes.m_buffer[SelectedNodeId].m_position;

                    ToolBase.RaycastOutput output;
                    if (RayCastSegmentAndNode(out output))
                    {
                        RenderLane(cameraInfo, selectedMarker.position, output.m_hitPos, selNodePos, selectedMarker.color);
                    }
                }

                bool deleteAll  = Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace);
                bool stayInLane = Input.GetKeyDown(KeyCode.S) && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Singleton <NetManager> .instance.m_nodes.m_buffer[SelectedNodeId].CountSegments() == 2;
                if (stayInLane)
                {
                    deleteAll = true;
                }

                if (deleteAll)
                {
                    // remove all connections at selected node
                    LaneConnectionManager.Instance.RemoveLaneConnectionsFromNode(SelectedNodeId);
                    RefreshCurrentNodeMarkers(SelectedNodeId);
                }

                if (stayInLane)
                {
                    // "stay in lane"
                    switch (stayInLaneMode)
                    {
                    case StayInLaneMode.None:
                        stayInLaneMode = StayInLaneMode.Both;
                        break;

                    case StayInLaneMode.Both:
                        stayInLaneMode = StayInLaneMode.Forward;
                        break;

                    case StayInLaneMode.Forward:
                        stayInLaneMode = StayInLaneMode.Backward;
                        break;

                    case StayInLaneMode.Backward:
                        stayInLaneMode = StayInLaneMode.None;
                        break;
                    }

                    if (stayInLaneMode != StayInLaneMode.None)
                    {
                        List <NodeLaneMarker> nodeMarkers = GetNodeMarkers(SelectedNodeId, ref Singleton <NetManager> .instance.m_nodes.m_buffer[SelectedNodeId]);
                        if (nodeMarkers != null)
                        {
                            selectedMarker = null;
                            foreach (NodeLaneMarker sourceLaneMarker in nodeMarkers)
                            {
                                if (!sourceLaneMarker.isSource)
                                {
                                    continue;
                                }

                                if (stayInLaneMode == StayInLaneMode.Forward || stayInLaneMode == StayInLaneMode.Backward)
                                {
                                    if (sourceLaneMarker.finalDirection == NetInfo.Direction.Backward ^ stayInLaneMode == StayInLaneMode.Backward)
                                    {
                                        continue;
                                    }
                                }

                                foreach (NodeLaneMarker targetLaneMarker in nodeMarkers)
                                {
                                    if (!targetLaneMarker.isTarget || targetLaneMarker.segmentId == sourceLaneMarker.segmentId)
                                    {
                                        continue;
                                    }

                                    if (targetLaneMarker.innerSimilarLaneIndex == sourceLaneMarker.innerSimilarLaneIndex)
                                    {
                                        Log._Debug($"Adding lane connection {sourceLaneMarker.laneId} -> {targetLaneMarker.laneId}");
                                        LaneConnectionManager.Instance.AddLaneConnection(sourceLaneMarker.laneId, targetLaneMarker.laneId, sourceLaneMarker.startNode);
                                    }
                                }
                            }
                        }
                        RefreshCurrentNodeMarkers(SelectedNodeId);
                    }
                }
            }

            if (GetMarkerSelectionMode() == MarkerSelectionMode.None && HoveredNodeId != 0)
            {
                // draw hovered node
                MainTool.DrawNodeCircle(cameraInfo, HoveredNodeId, Input.GetMouseButton(0));
            }
        }
Ejemplo n.º 11
0
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo)
        {
            // Log._Debug($"LaneConnectorTool: RenderOverlay. SelectedNodeId={SelectedNodeId}
            //     SelectedSegmentId={SelectedSegmentId} HoveredNodeId={HoveredNodeId}
            //     HoveredSegmentId={HoveredSegmentId} IsInsideUI={MainTool.GetToolController().IsInsideUI}");

            // draw lane markers and connections
            hoveredMarker = null;

            ShowOverlay(false, cameraInfo);

            // draw bezier from source marker to mouse position in target marker selection
            if (SelectedNodeId != 0)
            {
                if (GetMarkerSelectionMode() == MarkerSelectionMode.SelectTarget)
                {
                    Vector3 selNodePos =
                        NetManager.instance.m_nodes.m_buffer[SelectedNodeId].m_position;

                    ToolBase.RaycastOutput output;
                    // Draw a currently dragged curve
                    if (RayCastSegmentAndNode(out output))
                    {
                        DrawLaneCurve(
                            cameraInfo,
                            selectedMarker.Position,
                            output.m_hitPos,
                            selNodePos,
                            Color.Lerp(selectedMarker.Color, Color.white, 0.33f),
                            Color.white);
                    }
                }

                bool deleteAll =
                    (frameClearPressed > 0) && ((Time.frameCount - frameClearPressed) < 20); // 0.33 sec

                NetNode[] nodesBuffer = Singleton <NetManager> .instance.m_nodes.m_buffer;

                // Must press Shift+S (or another shortcut) within last 20 frames for this to work
                bool stayInLane = (frameStayInLanePressed > 0) &&
                                  ((Time.frameCount - frameStayInLanePressed) < 20) && // 0.33 sec
                                  (nodesBuffer[SelectedNodeId].CountSegments() == 2);

                if (stayInLane)
                {
                    frameStayInLanePressed = 0; // not pressed anymore (consumed)
                    deleteAll = true;
                }

                if (deleteAll)
                {
                    frameClearPressed = 0; // consumed
                    // remove all connections at selected node
                    LaneConnectionManager.Instance.RemoveLaneConnectionsFromNode(SelectedNodeId);
                    RefreshCurrentNodeMarkers(SelectedNodeId);
                }

                if (stayInLane)
                {
                    // "stay in lane"
                    switch (stayInLaneMode)
                    {
                    case StayInLaneMode.None: {
                        stayInLaneMode = StayInLaneMode.Both;
                        break;
                    }

                    case StayInLaneMode.Both: {
                        stayInLaneMode = StayInLaneMode.Forward;
                        break;
                    }

                    case StayInLaneMode.Forward: {
                        stayInLaneMode = StayInLaneMode.Backward;
                        break;
                    }

                    case StayInLaneMode.Backward: {
                        stayInLaneMode = StayInLaneMode.None;
                        break;
                    }
                    }

                    if (stayInLaneMode != StayInLaneMode.None)
                    {
                        selectedMarker = null;
                        StayInLane(SelectedNodeId, stayInLaneMode);
                        RefreshCurrentNodeMarkers(SelectedNodeId);
                    }
                } // if stay in lane
            }     // if selected node

            if ((GetMarkerSelectionMode() == MarkerSelectionMode.None) && (HoveredNodeId != 0))
            {
                // draw hovered node
                MainTool.DrawNodeCircle(cameraInfo, HoveredNodeId, Input.GetMouseButton(0));
            }
        }