Skip to content

Commit

Permalink
Refs #4397: line overlay is not shown double when panning
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Jan 5, 2012
1 parent 0a6b49b commit ce20282
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace SliceViewer
QPointF m_dragStart_PointB;

/// Marker that the middle mouse button is pressed (panning)
bool m_middleButton;
bool m_rightButton;

/// Is snap-to-grid enabled?
bool m_snapEnabled;
Expand Down
16 changes: 8 additions & 8 deletions Code/Mantid/MantidQt/SliceViewer/src/LineOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace SliceViewer

{
m_creation = true; // Will create with the mouse
m_middleButton = false;
m_rightButton = false;
m_dragHandle = HandleNone;

m_pointA = QPointF(0.0, 0.0);
Expand All @@ -54,7 +54,7 @@ namespace SliceViewer
void LineOverlay::reset()
{
m_creation = true; // Will create with the mouse
m_middleButton = false;
m_rightButton = false;
m_dragHandle = HandleNone;
this->update();
}
Expand Down Expand Up @@ -229,8 +229,8 @@ namespace SliceViewer
void LineOverlay::paintEvent(QPaintEvent */*event*/)
{
// Don't paint until created
// Also, don't paint while middle-click dragging (panning) the underlying pic
if (m_creation || m_middleButton)
// Also, don't paint while right-click dragging (panning) the underlying pic
if (m_creation || m_rightButton)
return;

QPainter painter(this);
Expand Down Expand Up @@ -432,8 +432,8 @@ namespace SliceViewer
* @param event mouse event info */
void LineOverlay::mouseMoveEvent(QMouseEvent * event)
{
if (event->buttons() & Qt::MidButton)
m_middleButton = true;
if (event->buttons() & Qt::RightButton)
m_rightButton = true;

// --- Initial creation mode - wait for first click ----
if (m_creation)
Expand Down Expand Up @@ -521,8 +521,8 @@ namespace SliceViewer
* @param event mouse event info */
void LineOverlay::mouseReleaseEvent(QMouseEvent * event)
{
if (!(event->buttons() & Qt::MidButton))
m_middleButton = false;
if (!(event->buttons() & Qt::RightButton))
m_rightButton = false;

if (m_dragHandle != HandleNone)
{
Expand Down

0 comments on commit ce20282

Please sign in to comment.