Skip to content

Commit

Permalink
Update boxsinglewidget.cpp
Browse files Browse the repository at this point in the history
Middle-click to rename layer.

Ref: #233
  • Loading branch information
rodlie committed Aug 30, 2024
1 parent 0d411f2 commit 5df5899
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/app/GUI/BoxesList/boxsinglewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "BlendEffects/blendeffectcollection.h"
#include "BlendEffects/blendeffectboxshadow.h"
#include "Sound/eindependentsound.h"

#include "GUI/propertynamedialog.h"
#include "Animators/SmartPath/smartpathcollection.h"

#include "typemenu.h"
Expand Down Expand Up @@ -707,19 +707,29 @@ void BoxSingleWidget::mouseMoveEvent(QMouseEvent *event) {
drag->exec(Qt::CopyAction | Qt::MoveAction);
}

void BoxSingleWidget::mouseReleaseEvent(QMouseEvent *event) {
if(!mTarget) return;
if(event->x() < mFillWidget->x() ||
event->x() > mFillWidget->x() + mFillWidget->width()) return;
void BoxSingleWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (!mTarget) { return; }
const auto target = mTarget->getTarget();

const auto bbox = enve_cast<BoundingBox*>(target);
if (event->button() == Qt::MidButton && bbox) {
PropertyNameDialog::sRenameBox(bbox, this);
return;
}

if (event->x() < mFillWidget->x() ||
event->x() > mFillWidget->x() + mFillWidget->width()) { return; }
setSelected(false);
if(pointToLen(event->pos() - mDragStartPos) > eSizesUI::widget/2) return;

if (pointToLen(event->pos() - mDragStartPos) > eSizesUI::widget/2) { return; }

const bool shiftPressed = event->modifiers() & Qt::ShiftModifier;
const auto target = mTarget->getTarget();
if(enve_cast<BoundingBox*>(target) || enve_cast<eIndependentSound*>(target)) {
if (enve_cast<BoundingBox*>(target) || enve_cast<eIndependentSound*>(target)) {
const auto boxTarget = static_cast<eBoxOrSound*>(target);
boxTarget->selectionChangeTriggered(shiftPressed);
Document::sInstance->actionFinished();
} else if(const auto pTarget = enve_cast<Property*>(target)) {
} else if (const auto pTarget = enve_cast<Property*>(target)) {
pTarget->prp_selectionChangeTriggered(shiftPressed);
}
}
Expand Down

0 comments on commit 5df5899

Please sign in to comment.