@@ -1374,30 +1374,25 @@ pub fn Display(comptime T: type) type {
13741374 }
13751375
13761376 if (query == .clickable or query == .clickable_or_scrollable ) {
1377- // Search only clickable entities
1378- if (entity .focus == .never_focus ) continue ;
1379-
1380- switch (entity .type ) {
1377+ if (entity .focus != .never_focus ) switch (entity .type ) {
13811378 .text_input , .checkbox = > return entity ,
13821379 .button = > if (entity .type .button .clickable ()) return entity ,
13831380 .label = > if (entity .type .label .clickable ()) return entity ,
13841381 .sprite = > if (entity .type .sprite .on_click .func != null ) {
13851382 return entity ;
13861383 },
1387- .panel = > if (is_under_cursor and entity . type . panel .on_click .func != null ) {
1384+ .panel = > | p | if (is_under_cursor and p .on_click .func != null ) {
13881385 return entity ;
13891386 },
13901387 .rectangle , .progress_bar , .expander = > {},
1391- }
1392- continue ;
1388+ };
13931389 }
13941390 if (query == .scrollable or query == .clickable_or_scrollable ) {
13951391 if (entity .type == .panel and is_under_cursor ) {
13961392 if (entity .type .panel .scrollable .scroll .x or entity .type .panel .scrollable .scroll .y ) {
13971393 return entity ;
13981394 }
13991395 }
1400- continue ;
14011396 }
14021397 }
14031398 return null ;
@@ -1833,19 +1828,19 @@ pub fn Display(comptime T: type) type {
18331828 .{},
18341829 .clickable_or_scrollable ,
18351830 )) | found | {
1836- if (found .type == .panel and (found .type .panel .scrollable .scroll .x or found .type .panel .scrollable .scroll .y )) {
1837- if (found .type .panel .scrollable .scroll .x or found .type .panel .scrollable .scroll .y ) {
1838- display .scrolling = found ;
1839- // scroll_start is the cursor position when drag
1840- // started, used to calculate drag distance.
1841- display .scroll_start = cursor ;
1842- // If a previos drag occured then this new drag
1843- // adds to the previous drag.
1844- display .scroll_initial_offset = found .offset ;
1845- trace ("begin scrolling {s} at {any}" , .{ found .name , cursor });
1846- }
1847- }
18481831 switch (found .type ) {
1832+ .panel = > {
1833+ if (found .type .panel .scrollable .scroll .x or found .type .panel .scrollable .scroll .y ) {
1834+ display .scrolling = found ;
1835+ // scroll_start is the cursor position when drag
1836+ // started, used to calculate drag distance.
1837+ display .scroll_start = cursor ;
1838+ // If a previos drag occured then this new drag
1839+ // adds to the previous drag.
1840+ display .scroll_initial_offset = found .offset ;
1841+ trace ("begin scrolling {s} at {any}" , .{ found .name , cursor });
1842+ }
1843+ },
18491844 .label = > try found .type .label .on_mouse_down .call (
18501845 gpa ,
18511846 display ,
0 commit comments