Fixed a minor merge screw-up and corrected IndicatorButtonPanel dragging to work...
[situare] / src / ui / indicatorbuttonpanel.cpp
index a34369e..041f1c1 100644 (file)
@@ -39,7 +39,7 @@ IndicatorButtonPanel::IndicatorButtonPanel(QWidget *parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    const int DIRECTION_INDICATOR_POSITION_X = 10 + PANEL_PEEK_AMOUNT;
+    const int DIRECTION_INDICATOR_POSITION_X = 10;
     const int DIRECTION_INDICATOR_POSITION_Y = 290;
 
     const int INDICATOR_BUTTON_PANEL_SPACING = 5;
@@ -125,10 +125,10 @@ void IndicatorButtonPanel::mouseMoveEvent(QMouseEvent *event)
         if (event->buttons() & Qt::LeftButton) {
             QPoint newLocation = mapToParent(event->pos()) - m_dragPosition;
 
-            if (newLocation.x() < SIDEBAR_WIDTH)
-                newLocation.rx() = SIDEBAR_WIDTH;
-            else if (newLocation.x() > m_screenSize.width() - width() - SIDEBAR_WIDTH)
-                newLocation.rx() =  m_screenSize.width() - width() - SIDEBAR_WIDTH;
+            if (newLocation.x() < 0)
+                newLocation.rx() = 0;
+            else if (newLocation.x() > m_screenSize.width() - width() - PANEL_BAR_WIDTH)
+                newLocation.rx() =  m_screenSize.width() - width() - PANEL_BAR_WIDTH;
 
             if (newLocation.y() < 0)
                 newLocation.ry() = 0;
@@ -226,19 +226,21 @@ void IndicatorButtonPanel::screenResized(const QSize &newSize)
     m_screenSize = newSize;
 
     QPoint resizedPosition = pos();
-    if(resizedPosition.x() > (newSize.width() - rect().width()))
-        resizedPosition.rx() = newSize.width() - rect().width();
-    else if (resizedPosition.x() < SIDEBAR_WIDTH)
-        resizedPosition.rx() = SIDEBAR_WIDTH;
-    if(resizedPosition.y() > (newSize.height() - rect().height()))
-        resizedPosition.ry() = newSize.height() - rect().height();
-    else if (resizedPosition.y() < 0)
+
+    if (resizedPosition.x() < 0)
+        resizedPosition.rx() = 0;
+    else if(resizedPosition.x() > newSize.width() - rect().width() - PANEL_BAR_WIDTH)
+        resizedPosition.rx() = newSize.width() - rect().width() - PANEL_BAR_WIDTH;
+
+    if (resizedPosition.y() < 0)
         resizedPosition.ry() = 0;
+    else if(resizedPosition.y() > newSize.height() - rect().height())
+        resizedPosition.ry() = newSize.height() - rect().height();
 
-    if((pos().y() + rect().center().y()) > (oldHeight/2))
+    if(pos().y() + rect().center().y() > oldHeight / 2)
         resizedPosition.ry() = newSize.height() - (oldHeight - pos().y());
 
-    if((pos().x() + rect().center().x()) > (oldWidth/2))
+    if(pos().x() + rect().center().x() > oldWidth / 2)
         resizedPosition.rx() = newSize.width() - (oldWidth - pos().x());
 
     move(resizedPosition);