Skip to content

Commit fc64742

Browse files
committed
fix the bbox
1 parent 81248da commit fc64742

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/pages/Tree.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,16 @@ static CCRect getActualMenuRect(CCNode* menu) {
121121
CCPoint topRight{};
122122

123123
for (auto node : CCArrayExt<CCNode>(menu->getChildren())) {
124-
auto bbox = node->boundingBox();
124+
CCRect bbox;
125+
126+
if (typeinfo_cast<CCMenu*>(node)) {
127+
auto basepos = node->getPosition() - (node->getAnchorPoint() * node->getScaledContentSize() * !node->isIgnoreAnchorPointForPosition());
128+
129+
bbox = getActualMenuRect(node);
130+
bbox.origin += basepos;
131+
} else {
132+
bbox = node->boundingBox();
133+
}
125134

126135
if (bbox.origin.x < bottomLeft.x) {
127136
bottomLeft.x = bbox.origin.x;

0 commit comments

Comments
 (0)