RS_Snapper::drawSnapper

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RS_Snapper::drawSnapper

ravas
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
        }
Reply | Threaded
Open this post in threaded view
|

Re: RS_Snapper::drawSnapper

dxli
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
        }
Reply | Threaded
Open this post in threaded view
|

Re: RS_Snapper::drawSnapper

ravas
Maybe we don't need it anymore.
When I comment out that block nothing seems to change.
And we have:

            // Circle to show snap area
            RS_Circle *circle=new RS_Circle(nullptr, RS_CircleData(snapCoord, 4/graphicView->getFactor().x));
            circle->setPen(circle_pen);

            container->addEntity(circle);