]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingview.cpp
Fixes for the Layer widget.
[architektonas] / src / drawingview.cpp
index 8c581bfc1df8e904ccb41bd2b724b26b3c3ae7d5..54e3b342daf6c26b45fd5214f72c92d3a1bcb8db 100644 (file)
@@ -49,8 +49,8 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent),
        useAntialiasing(true), numSelected(0), numHovered(0), shiftDown(false),
        ctrlDown(false),
        gridBackground(BACKGROUND_MAX_SIZE, BACKGROUND_MAX_SIZE),
-       scale(1.0), offsetX(-10), offsetY(-10),// document(Vector(0, 0)),
-       gridPixels(0), collided(false)//, toolAction(NULL)
+       scale(1.0), offsetX(-10), offsetY(-10),
+       gridPixels(0), collided(false), hoveringIntersection(false)
 {
 //     document.isTopLevelContainer = true;
 //wtf? doesn't work except in c++11??? document = { 0 };
@@ -324,6 +324,9 @@ void DrawingView::paintEvent(QPaintEvent * /*event*/)
                painter.DrawRect(Global::selection);
        }
 
+       if (hoveringIntersection)
+               painter.DrawHandle(intersectionPoint);
+
        if (!informativeText.isEmpty())
                painter.DrawInformativeText(informativeText);
 }
@@ -1174,6 +1177,7 @@ void DrawingView::mouseMoveEvent(QMouseEvent * event)
        Global::selection.setBottomRight(QPointF(point.x, point.y));
        // Only needs to be done here, as mouse down is always preceded by movement
        Global::snapPointIsValid = false;
+       hoveringIntersection = false;
 
        // Scrolling...
        if (event->buttons() & Qt::MiddleButton)
@@ -1226,8 +1230,13 @@ void DrawingView::mouseMoveEvent(QMouseEvent * event)
 
                if (numIntersecting > 0)
                {
-                       QString text = tr("Intersection t=%1, u=%2");
-                       informativeText = text.arg(t).arg(u);
+                       Vector v1 = Geometry::GetPointForParameter((Object *)hover[0], t);
+                       Vector v2 = Geometry::GetPointForParameter((Object *)hover[1], u);
+                       QString text = tr("Intersection t=%1 (%3, %4), u=%2 (%5, %6)");
+                       informativeText = text.arg(t).arg(u).arg(v1.x).arg(v1.y).arg(v2.x).arg(v2.y);
+
+                       hoveringIntersection = true;
+                       intersectionPoint = v1;
                }
        }