Skip to content

Commit 6dd4346

Browse files
committed
[composer] Fix calculation of mouse action for position for mouse handles (refs #10143, tentative fix)
1 parent 711aa16 commit 6dd4346

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/core/composer/qgscomposermousehandles.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,17 @@ QgsComposerMouseHandles::MouseAction QgsComposerMouseHandles::mouseActionForPosi
439439
bool nearLowerBorder = false;
440440
bool nearUpperBorder = false;
441441

442+
bool withinWidth = false;
443+
bool withinHeight = false;
444+
if ( itemCoordPos.x() >= 0 && itemCoordPos.x() <= rect().width() )
445+
{
446+
withinWidth = true;
447+
}
448+
if ( itemCoordPos.y() >= 0 && itemCoordPos.y() <= rect().height() )
449+
{
450+
withinHeight = true;
451+
}
452+
442453
double borderTolerance = rectHandlerBorderTolerance();
443454

444455
if ( itemCoordPos.x() >= 0 && itemCoordPos.x() < borderTolerance )
@@ -474,19 +485,19 @@ QgsComposerMouseHandles::MouseAction QgsComposerMouseHandles::mouseActionForPosi
474485
{
475486
return QgsComposerMouseHandles::ResizeRightDown;
476487
}
477-
else if ( nearLeftBorder )
488+
else if ( nearLeftBorder && withinHeight )
478489
{
479490
return QgsComposerMouseHandles::ResizeLeft;
480491
}
481-
else if ( nearRightBorder )
492+
else if ( nearRightBorder && withinHeight )
482493
{
483494
return QgsComposerMouseHandles::ResizeRight;
484495
}
485-
else if ( nearUpperBorder )
496+
else if ( nearUpperBorder && withinWidth )
486497
{
487498
return QgsComposerMouseHandles::ResizeUp;
488499
}
489-
else if ( nearLowerBorder )
500+
else if ( nearLowerBorder && withinWidth )
490501
{
491502
return QgsComposerMouseHandles::ResizeDown;
492503
}

0 commit comments

Comments
 (0)