3030void ekg::ui::recursive_self_destroy_abs_popup (
3131 ekg::popup_t &popup
3232) {
33- if (popup.parent_popup_at == ekg::at_t ::not_found) {
34- ekg::ui::recursive_children_set_visible (
35- popup,
36- false
37- );
33+ if (popup == ekg::popup_t ::not_found) {
3834 return ;
3935 }
4036
37+ ekg::property_t &property {ekg::query<ekg::property_t >(popup.property_at )};
38+ ekg::ui::set_visible (
39+ property,
40+ false
41+ );
42+
43+ property.widget .should_buffering = false ;
44+
4145 ekg::ui::recursive_self_destroy_abs_popup (
4246 ekg::query<ekg::popup_t >(popup.parent_popup_at )
4347 );
@@ -99,10 +103,19 @@ void ekg::ui::splash_popup_just_opened(
99103 const ekg::vec2_t <float > &pos
100104) {
101105 ekg::property_t &property {ekg::query<ekg::property_t >(popup.property_at )};
102- if (popup == ekg::popup_t ::not_found || property == ekg::property_t ::not_found) {
106+ if (
107+ popup == ekg::popup_t ::not_found
108+ ||
109+ property == ekg::property_t ::not_found
110+ ) {
103111 return ;
104112 }
105113
114+ ekg::ui::recursive_children_set_visible (
115+ popup,
116+ false
117+ );
118+
106119 property.states .is_visible = true ;
107120 popup.widget .was_visible = true ;
108121 ekg::gui.ui .redraw = true ;
@@ -174,11 +187,13 @@ void ekg::ui::event(
174187 ekg::input_info_t &input {ekg::p_core->handler_input .input };
175188 ekg::vec2_t <float > interact {static_cast <ekg::vec2_t <float >>(input.interact )};
176189
190+ bool skip_this_tick_self_destruction {};
177191 if (
178192 popup.widget .just_opened
179193 &&
180194 input.was_released
181195 ) {
196+ skip_this_tick_self_destruction = true ;
182197 popup.widget .just_opened = false ;
183198 }
184199
@@ -204,7 +219,6 @@ void ekg::ui::event(
204219 bool should_unset_visibility {};
205220 bool is_linked_hovering {};
206221 bool is_this_popup_being_hovered {};
207- bool should_self_recursive_destroy {};
208222 bool is_hovering_any_linked_widget {};
209223
210224 ekg::rect_t <float > rect_position {};
@@ -354,34 +368,26 @@ void ekg::ui::event(
354368 );
355369 }
356370
357- should_self_recursive_destroy = (
358- (
359- input.was_released
360- &&
361- is_this_popup_being_hovered
362- &&
363- popup.links .empty ()
364- )
365- ||
366- (
367- input.was_released
368- &&
369- is_this_popup_being_hovered
370- &&
371- !is_hovering_any_linked_widget
372- )
373- ||
371+ if (
374372 (
375- input.was_pressed
376- &&
377- !is_hovering_a_popup
373+ (
374+ input.was_released
375+ &&
376+ is_this_popup_being_hovered
377+ &&
378+ !is_hovering_any_linked_widget
379+ )
380+ ||
381+ (
382+ input.was_released
383+ &&
384+ !is_hovering_a_popup
385+ )
378386 )
379- );
380-
381- if (should_self_recursive_destroy) {
382- ekg::ui::recursive_self_destroy_abs_popup (
383- popup
384- );
387+ &&
388+ !skip_this_tick_self_destruction
389+ ) {
390+ popup.widget .should_self_recursive_destroy = true ;
385391 }
386392
387393 break ;
@@ -403,6 +409,14 @@ void ekg::ui::pass(
403409 ekg::property_t &property,
404410 ekg::popup_t &popup
405411) {
412+ if (popup.widget .should_self_recursive_destroy ) {
413+ ekg::ui::recursive_self_destroy_abs_popup (
414+ popup
415+ );
416+
417+ popup.widget .should_self_recursive_destroy = false ;
418+ }
419+
406420 ekg::ui::pass (property, popup.widget .frame );
407421}
408422
0 commit comments