Fix hitting grip if grip overlaps with other elements

This commit is contained in:
Casper Jeukendrup 2022-03-31 16:15:57 +02:00
parent 7fa89d396f
commit c7397bb00f
No known key found for this signature in database
GPG key ID: 6C571BEF59E722DD
2 changed files with 6 additions and 0 deletions

View file

@ -507,6 +507,7 @@ void NotationViewInputController::mousePressEvent(QMouseEvent* event)
ctx.logicClickPos = logicPos;
ctx.hitElement = hitElement;
ctx.prevHitElement = prevHitElement;
ctx.isHitGrip = viewInteraction()->isHitGrip(logicPos);
ctx.event = event;
if (needSelect(ctx)) {
@ -533,6 +534,10 @@ void NotationViewInputController::mousePressEvent(QMouseEvent* event)
bool NotationViewInputController::needSelect(const ClickContext& ctx) const
{
if (ctx.isHitGrip && ctx.event->button() == Qt::LeftButton) {
return false;
}
if (!ctx.hitElement) {
return false;
}

View file

@ -153,6 +153,7 @@ private:
const QMouseEvent* event = nullptr;
Ms::EngravingItem* hitElement = nullptr;
const Ms::EngravingItem* prevHitElement = nullptr;
bool isHitGrip = false;
};
bool needSelect(const ClickContext& ctx) const;