]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondrawarctangential.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / actions / actiondrawarctangential.cpp
index f1691fcf6fc051780e875b49ef6c50b2979a5270..a8a16c6d505c14c25a1517e4625a86fdb19e2163 100644 (file)
@@ -12,6 +12,7 @@
 // Who  When        What
 // ---  ----------  -----------------------------------------------------------
 // JLH  06/03/2010  Added this text. :-)
+// JLH  09/17/2010  Fixed preview/snapper rendering.
 //
 
 #include "actiondrawarctangential.h"
@@ -22,8 +23,8 @@
 #include "graphicview.h"
 #include "preview.h"
 
-ActionDrawArcTangential::ActionDrawArcTangential(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs tangential",
-               container, graphicView)
+ActionDrawArcTangential::ActionDrawArcTangential(EntityContainer & container, GraphicView & graphicView):
+       ActionInterface("Draw arcs tangential", container, graphicView)
 {
        reset();
 }
@@ -68,26 +69,26 @@ void ActionDrawArcTangential::trigger()
        container->addEntity(arc);
 
        // upd. undo list:
-       if (document != NULL)
+       if (document)
        {
                document->startUndoCycle();
                document->addUndoable(arc);
                document->endUndoCycle();
        }
 
-       deleteSnapper();
-       graphicView->moveRelativeZero(Vector(0.0, 0.0));
-       graphicView->drawEntity(arc);
+//     deleteSnapper();
+//     graphicView->moveRelativeZero(Vector(0.0, 0.0));
+//     graphicView->drawEntity(arc);
        graphicView->moveRelativeZero(arc->getCenter());
-       drawSnapper();
-
+//     drawSnapper();
+       graphicView->redraw();  //hm.
        setStatus(SetBaseEntity);
        reset();
 }
 
 void ActionDrawArcTangential::preparePreview()
 {
-       if (baseEntity != NULL && point.valid)
+       if (baseEntity && point.valid)
        {
                Vector startPoint;
                double direction;
@@ -129,6 +130,9 @@ void ActionDrawArcTangential::mouseMoveEvent(QMouseEvent * e)
 //                     clearPreview();
 //                     preview->addEntity(arc);
 //                     drawPreview();
+                       graphicView->preview.clear();
+                       graphicView->preview.addEntity(new Arc(&(graphicView->preview), data));
+                       graphicView->redraw();
                }
                break;
 
@@ -149,7 +153,7 @@ void ActionDrawArcTangential::mouseReleaseEvent(QMouseEvent * e)
                        Vector coord = graphicView->toGraph(e->x(), e->y());
                        Entity * entity = catchEntity(coord, RS2::ResolveAll);
 
-                       if (entity != NULL)
+                       if (entity)
                        {
                                if (entity->isAtomic())
                                {
@@ -184,9 +188,10 @@ void ActionDrawArcTangential::mouseReleaseEvent(QMouseEvent * e)
        }
        else if (e->button() == Qt::RightButton)
        {
-               deletePreview();
-               deleteSnapper();
+//             deletePreview();
+       //      deleteSnapper();
                init(getStatus() - 1);
+               graphicView->redraw();  //hm.
        }
 }