Skip to content

Commit

Permalink
[composer] Fix calculation of mouse action for position for mouse han…
Browse files Browse the repository at this point in the history
…dles (refs #10143, tentative fix)
  • Loading branch information
nyalldawson committed May 31, 2014
1 parent 711aa16 commit 6dd4346
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/core/composer/qgscomposermousehandles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,17 @@ QgsComposerMouseHandles::MouseAction QgsComposerMouseHandles::mouseActionForPosi
bool nearLowerBorder = false;
bool nearUpperBorder = false;

bool withinWidth = false;
bool withinHeight = false;
if ( itemCoordPos.x() >= 0 && itemCoordPos.x() <= rect().width() )
{
withinWidth = true;
}
if ( itemCoordPos.y() >= 0 && itemCoordPos.y() <= rect().height() )
{
withinHeight = true;
}

double borderTolerance = rectHandlerBorderTolerance();

if ( itemCoordPos.x() >= 0 && itemCoordPos.x() < borderTolerance )
Expand Down Expand Up @@ -474,19 +485,19 @@ QgsComposerMouseHandles::MouseAction QgsComposerMouseHandles::mouseActionForPosi
{
return QgsComposerMouseHandles::ResizeRightDown;
}
else if ( nearLeftBorder )
else if ( nearLeftBorder && withinHeight )
{
return QgsComposerMouseHandles::ResizeLeft;
}
else if ( nearRightBorder )
else if ( nearRightBorder && withinHeight )
{
return QgsComposerMouseHandles::ResizeRight;
}
else if ( nearUpperBorder )
else if ( nearUpperBorder && withinWidth )
{
return QgsComposerMouseHandles::ResizeUp;
}
else if ( nearLowerBorder )
else if ( nearLowerBorder && withinWidth )
{
return QgsComposerMouseHandles::ResizeDown;
}
Expand Down

0 comments on commit 6dd4346

Please sign in to comment.