]> Shamusworld >> Repos - architektonas/commitdiff
Small refinements to Add Line tool.
authorShamus Hammons <jlhamm@acm.org>
Tue, 8 Nov 2011 10:26:06 +0000 (10:26 +0000)
committerShamus Hammons <jlhamm@acm.org>
Tue, 8 Nov 2011 10:26:06 +0000 (10:26 +0000)
src/drawlineaction.cpp

index 867970df4d62685e1b87831fe1467d3865d81508..65b9fc1b85e6ced0bb085e53840cd44fda222e05 100644 (file)
@@ -34,6 +34,7 @@ DrawLineAction::~DrawLineAction()
 /*virtual*/ void DrawLineAction::Draw(Painter * painter)
 {
        // Need to fix pen colors, etc...
+       // I think stuff like crosshairs should be done in the DrawingView, tho
        if (state == FIRST_POINT)
        {
                painter->DrawPoint(p1.x, p1.y);
@@ -63,14 +64,18 @@ DrawLineAction::~DrawLineAction()
 /*virtual*/ void DrawLineAction::MouseReleased(void)
 {
        if (state == FIRST_POINT)
+       {
+               p2 = p1;
                state = NEXT_POINT;
+       }
        else if (state == NEXT_POINT)
        {
-               // We create the new object here, and then pass it off to the document.
+               // We create the new object here, and then pass it off to the
+               // DrawingView which stuffs it into the document.
                line = new Line(p1, p2);
                // We don't need no stinkin' sentinels, when we have signals & slots!
                emit ObjectReady(line);
-               
+
                p1 = p2;
        }
 }