Skip to content

Commit f600ee9

Browse files
committed
is this better?
1 parent e274eae commit f600ee9

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/FLAlertLayer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class $modify(DeltaruneAlertLayer, FLAlertLayer) {
7272
void onBtn1(CCObject*);
7373
void clickedOnButton(CCMenuItemSpriteExtra*, ButtonSprite*, int);
7474
bool ccTouchBegan(CCTouch*, CCEvent*) override;
75+
void fixTouchPrio();
7576

7677
#if defined(DISABLE_KEYBOARD)
7778
void keyDown(enumKeyCodes) override;

src/changeDesign.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ void DeltaruneAlertLayer::changeSingleButton(CCMenuItemSpriteExtra* btn, ButtonS
9090
}
9191
}
9292

93+
void DeltaruneAlertLayer::fixTouchPrio() {
94+
auto& buttonMenu = this->m_buttonMenu;
95+
96+
int parentTouchPrio = this->getTouchPriority();
97+
int menuTouchPrio = buttonMenu->getTouchPriority();
98+
99+
if (parentTouchPrio >= menuTouchPrio) {
100+
buttonMenu->setTouchPriority(parentTouchPrio + 1);
101+
}
102+
}
103+
93104
void DeltaruneAlertLayer::changeButtons() {
94105
if (!m_buttonMenu) return;
95106
m_buttonMenu->setPositionY(32);
@@ -117,16 +128,9 @@ void DeltaruneAlertLayer::changeButtons() {
117128
// fix handleTouchPrio breaking the buttons
118129
Loader::get()->queueInMainThread([popup = Ref(this)] {
119130
Loader::get()->queueInMainThread([popup] {
120-
auto& buttonMenu = popup->m_buttonMenu;
121-
122-
int parentTouchPrio = popup->getTouchPriority();
123-
int menuTouchPrio = buttonMenu->getTouchPriority();
124-
125-
if (parentTouchPrio >= menuTouchPrio) {
126-
buttonMenu->setTouchPriority(parentTouchPrio + 1);
127-
}
131+
popup->fixTouchPrio();
132+
});
128133
});
129-
});
130134
}
131135

132136
void DeltaruneAlertLayer::changeTitle() {

0 commit comments

Comments
 (0)