]> git.sesse.net Git - kdenlive/blobdiff - src/onmonitoritems/onmonitorrectitem.cpp
Merge branch 'master' into feature/pkey
[kdenlive] / src / onmonitoritems / onmonitorrectitem.cpp
index acf5c1faf673aa219afdceb31ab1c9543e874676..20152e6fca4de6e398ec38d44008ea7a546e0999 100644 (file)
@@ -56,10 +56,13 @@ rectActions OnMonitorRectItem::getMode(QPointF pos)
     right.lineTo(pol.at(2));
 
     QPainterPath mouseArea;
-    qreal size = 8;
-    if (getView())
-        size /= m_view->matrix().m11();
-    mouseArea.addRect(pos.x() - size / 2, pos.y() - size / 2, size, size);
+    qreal xsize = 12;
+    qreal ysize = 12;
+    if (getView()) {
+        xsize /= m_view->matrix().m11();
+       ysize /= m_view->matrix().m22();
+    }
+    mouseArea.addRect(pos.x() - xsize / 2, pos.y() - ysize / 2, xsize, ysize);
 
     // Check for collisions between the mouse and the borders
     if (mouseArea.contains(pol.at(0)))
@@ -262,15 +265,24 @@ void OnMonitorRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem*
 
     painter->setPen(pen());
     painter->drawRect(option->rect);
-
+    const QRectF r = painter->worldTransform().mapRect(option->rect);
+    painter->setWorldMatrixEnabled(false);
     if (isEnabled()) {
-        double handleSize = 6 / painter->worldTransform().m11();
-        double halfHandleSize = handleSize / 2;
-        painter->fillRect(-halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
-        painter->fillRect(option->rect.width() - halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
-        painter->fillRect(option->rect.width() - halfHandleSize, option->rect.height() - halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
-        painter->fillRect(-halfHandleSize, option->rect.height() - halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
+       QRectF handle(0, 0, 6, 6);
+       handle.moveTopLeft(r.topLeft());
+        painter->fillRect(handle, QColor(Qt::yellow));
+       handle.moveTopRight(r.topRight());
+        painter->fillRect(handle, QColor(Qt::yellow));
+       handle.moveBottomLeft(r.bottomLeft());
+        painter->fillRect(handle, QColor(Qt::yellow));
+       handle.moveBottomRight(r.bottomRight());
+        painter->fillRect(handle, QColor(Qt::yellow));
     }
+    
+    // Draw cross at center
+    QPointF center = r.center();
+    painter->drawLine(center + QPointF(-6, 0), center + QPointF(6, 0));
+    painter->drawLine(center + QPointF(0, 6), center + QPointF(0, -6));
 }
 
 bool OnMonitorRectItem::getView()