X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdrawingview.cpp;h=bd4bb4638612a895ecb99185e28abbca7a05ecb5;hb=a14390c31519388a3e4f01bc53c0e4572708940c;hp=55b56e7d87e02ae0aa5cbd1b1e4c428ffca9ebb2;hpb=c51c02d23ddd4423882da2c54b76f8f2c90c1c99;p=architektonas diff --git a/src/drawingview.cpp b/src/drawingview.cpp index 55b56e7..bd4bb46 100644 --- a/src/drawingview.cpp +++ b/src/drawingview.cpp @@ -20,7 +20,7 @@ // Uncomment this for debugging... //#define DEBUG -//#define DEBUGFOO // Various tool debugging... +//#define DEBUGFOO // Various tool debugging... //#define DEBUGTP // Toolpalette debugging... #include "drawingview.h" @@ -58,10 +58,15 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent), document.Add(new Circle(Vector(50, 150), 49, &document)); document.Add(new Arc(Vector(300, 300), 32, PI / 4.0, PI * 1.3, &document)), document.Add(new Arc(Vector(200, 200), 60, PI / 2.0, PI * 1.5, &document)); +#if 1 Dimension * dimension = new Dimension(Vector(0, 0), Vector(0, 0), &document); - line->SetDimensionOnPoint1(dimension); - line->SetDimensionOnPoint2(dimension); + line->SetDimensionOnLine(dimension); +// line->SetDimensionOnPoint2(dimension); document.Add(dimension); +#else + // Alternate way to do the above... + line->SetDimensionOnLine(); +#endif } QPoint DrawingView::GetAdjustedMousePosition(QMouseEvent * event) @@ -158,12 +163,15 @@ void DrawingView::mouseMoveEvent(QMouseEvent * event) // snap to the one before it. So we add half of the grid spacing to the // point, then divide by it so that we can remove the fractional part, then // multiply it back to get back to the correct answer. - point += gridSpacing / 2.0; // *This* adds to Z!!! - point /= gridSpacing; - point.x = floor(point.x);//need to fix this for negative numbers... - point.y = floor(point.y); - point.z = 0; // Make *sure* Z doesn't go anywhere!!! - point *= gridSpacing; + if (event->buttons() & Qt::LeftButton) + { + point += gridSpacing / 2.0; // *This* adds to Z!!! + point /= gridSpacing; + point.x = floor(point.x);//need to fix this for negative numbers... + point.y = floor(point.y); + point.z = 0; // Make *sure* Z doesn't go anywhere!!! + point *= gridSpacing; + } #endif //we should keep track of the last point here and only pass this down *if* the point //changed...