From 05a99994d86758d50c8d50b1adb648bad0d06f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Fri, 30 Aug 2024 21:55:50 +0200 Subject: [PATCH] Timeline/Graph: selected bug fix --- src/core/Properties/property.cpp | 17 ++++++++++++++++- src/core/Properties/property.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/core/Properties/property.cpp b/src/core/Properties/property.cpp index 90acd79cd..45949c00e 100644 --- a/src/core/Properties/property.cpp +++ b/src/core/Properties/property.cpp @@ -367,7 +367,22 @@ bool Property::prp_isParentBoxContained() const const auto pBox = getFirstAncestor(); if (pBox && mParentScene) { const auto contained = mParentScene->getContainedBoxes(); - for (const auto &box : contained) { if (box == pBox) { return true; } } + for (const auto &box : contained) { + if (box == pBox) { return true; } + if (prp_isParentBoxContained(box, pBox)) { return true; } + } + } + return false; +} + +bool Property::prp_isParentBoxContained(BoundingBox *box, + eBoxOrSound *ebox) const +{ + if (box == ebox) { return true; } + if (const auto cbox = enve_cast(box)) { + for (const auto &bbox : cbox->getContainedBoxes()) { + if (prp_isParentBoxContained(bbox, ebox)) { return true; } + } } return false; } diff --git a/src/core/Properties/property.h b/src/core/Properties/property.h index eb586aed9..e692d7304 100644 --- a/src/core/Properties/property.h +++ b/src/core/Properties/property.h @@ -250,6 +250,8 @@ class CORE_EXPORT Property : public SingleWidgetTarget { bool prp_isParentBoxSelected() const; bool prp_isParentBoxContained() const; + bool prp_isParentBoxContained(BoundingBox *box, + eBoxOrSound *ebox) const; bool prp_drawsOnCanvas() const { return mDrawOnCanvas; }