Re: RS_Snapper::drawSnapper

Posted by dxli on
URL: https://forum.librecad.org/RS-Snapper-drawSnapper-tp5712450p5712451.html

our ugly way of drawing a small circle around the the snap spot.

it's actually a square with side size of 5*sqrt(2)

ravas wrote
What is this for
        if (snapCoord.valid && snapCoord!=snapSpot)
        {            
            RS_OverlayLine *line=new RS_OverlayLine(nullptr,
            {graphicView->toGui(snapSpot)+RS_Vector{-5.,0.},
             graphicView->toGui(snapSpot)+RS_Vector{-1.,4.}});
            line->setPen(line_pen);
            container->addEntity(line);
            line=new RS_OverlayLine(nullptr,
            {graphicView->toGui(snapSpot)+RS_Vector{0.,5.},
             graphicView->toGui(snapSpot)+RS_Vector{4.,1.}});
            line->setPen(line_pen);
            container->addEntity(line);
            line=new RS_OverlayLine(nullptr,
            {graphicView->toGui(snapSpot)+RS_Vector{5.,0.},
             graphicView->toGui(snapSpot)+RS_Vector{1.,-4.}});
            line->setPen(line_pen);
            container->addEntity(line);
            line=new RS_OverlayLine(nullptr,
            {graphicView->toGui(snapSpot)+RS_Vector{0.,-5.},
             graphicView->toGui(snapSpot)+RS_Vector{-4.,-1.}});
            line->setPen(line_pen);
            container->addEntity(line);

            graphicView->redraw(RS2::RedrawOverlay); // redraw will happen in the mouse movement event
        }