Skip to content

Commit

Permalink
fix: tool selection for delegate frame handles
Browse files Browse the repository at this point in the history
- the handles on a delegate frame may be stacked on each other
  if the delegate frame is small in one or the other direction
- determine tool from mouse position by asking the topmost
  handle first
- use isUnderCursor() to be sure that the tool matches the
  currently shown cursor
- remove unreachable "return"
  • Loading branch information
letsfindaway committed Sep 24, 2024
1 parent dea6925 commit ba0eedd
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/domain/UBGraphicsDelegateFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,39 +1003,39 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF
{
if(mDelegate->isLocked())
return None;
else if (bottomRightResizeGripRect().contains(pos) && ResizingHorizontally != mOperationMode && mDelegate->testUBFlags(GF_SCALABLE_X_AXIS) && mDelegate->testUBFlags(GF_SCALABLE_Y_AXIS))
return ResizeBottomRight;
else if (bottomResizeGripRect().contains(pos) && ResizingHorizontally != mOperationMode && mDelegate->testUBFlags(GF_SCALABLE_Y_AXIS)){
// check handles in reverse order of creation to account for z order
else if (mRotateButton && mRotateButton->isUnderMouse() && mDelegate && mDelegate->testUBFlags(GF_REVOLVABLE))
return Rotate;
else if (mTopResizeGrip && mTopResizeGrip->isUnderMouse() && ResizingHorizontally != mOperationMode && mDelegate->testUBFlags(GF_SCALABLE_Y_AXIS)){
if(mMirrorY){
return ResizeTop;
}else{
return ResizeBottom;
}else{
return ResizeTop;
}
}
else if (leftResizeGripRect().contains(pos) && mDelegate->testUBFlags(GF_SCALABLE_X_AXIS)){
else if (mRightResizeGrip && mRightResizeGrip->isUnderMouse() && mDelegate->testUBFlags(GF_SCALABLE_X_AXIS)){
if(mMirrorX){
return ResizeRight;
}else{
return ResizeLeft;
}else{
return ResizeRight;
}
return ResizeLeft;
}
else if (rightResizeGripRect().contains(pos) && mDelegate->testUBFlags(GF_SCALABLE_X_AXIS)){
else if (mLeftResizeGrip && mLeftResizeGrip->isUnderMouse() && mDelegate->testUBFlags(GF_SCALABLE_X_AXIS)){
if(mMirrorX){
return ResizeLeft;
}else{
return ResizeRight;
}else{
return ResizeLeft;
}
}
else if (topResizeGripRect().contains(pos) && ResizingHorizontally != mOperationMode && mDelegate->testUBFlags(GF_SCALABLE_Y_AXIS)){
else if (mBottomResizeGrip && mBottomResizeGrip->isUnderMouse() && ResizingHorizontally != mOperationMode && mDelegate->testUBFlags(GF_SCALABLE_Y_AXIS)){
if(mMirrorY){
return ResizeBottom;
}else{
return ResizeTop;
}else{
return ResizeBottom;
}
}
else if (rotateButtonBounds().contains(pos) && mDelegate && mDelegate->testUBFlags(GF_REVOLVABLE))
return Rotate;
else if (mBottomRightResizeGrip && mBottomRightResizeGrip->isUnderMouse() && ResizingHorizontally != mOperationMode && mDelegate->testUBFlags(GF_SCALABLE_X_AXIS) && mDelegate->testUBFlags(GF_SCALABLE_Y_AXIS))
return ResizeBottomRight;
else
return Move;
}
Expand Down

0 comments on commit ba0eedd

Please sign in to comment.