diff --git a/dash-frontend/assets/gui/tab/apps.xml b/dash-frontend/assets/gui/tab/apps.xml index 6a415bfc..2095745e 100644 --- a/dash-frontend/assets/gui/tab/apps.xml +++ b/dash-frontend/assets/gui/tab/apps.xml @@ -44,7 +44,6 @@ flex_direction="row" flex_wrap="wrap" gap="4" - overflow_y="scroll" /> \ No newline at end of file diff --git a/wgui/src/drawing.rs b/wgui/src/drawing.rs index 8b87a266..e855fce7 100644 --- a/wgui/src/drawing.rs +++ b/wgui/src/drawing.rs @@ -306,29 +306,33 @@ impl PushScissorStackResult { } } -/// Returns true if scissor has been pushed. +/// Returns Some() if scissor has been pushed. pub fn push_scissor_stack( transform_stack: &mut TransformStack, scissor_stack: &mut ScissorStack, scroll_shift: Vec2, info: &Option, style: &taffy::Style, -) -> PushScissorStackResult { +) -> Option { let mut boundary_absolute = drawing::Boundary::construct_absolute(transform_stack); boundary_absolute.pos += scroll_shift; let do_clip = info.is_some() && has_overflow_clip(style); + if !do_clip { + return None; // Don't care + } + scissor_stack.push(ScissorBoundary(boundary_absolute)); if scissor_stack.is_out_of_bounds() { - return PushScissorStackResult::OutOfBounds; + return Some(PushScissorStackResult::OutOfBounds); } if do_clip { - PushScissorStackResult::VisibleAndClip + Some(PushScissorStackResult::VisibleAndClip) } else { - PushScissorStackResult::VisibleDontClip + Some(PushScissorStackResult::VisibleDontClip) } } @@ -380,7 +384,9 @@ fn draw_widget( let starting_scissor_set_count = internal.scissor_set_count; let scissor_result = push_scissor_stack(state.transform_stack, state.scissor_stack, scroll_shift, &info, style); - if scissor_result == PushScissorStackResult::VisibleAndClip { + if let Some(scissor_result) = &scissor_result + && *scissor_result == PushScissorStackResult::VisibleAndClip + { if params.debug_draw { let mut boundary_relative = drawing::Boundary::construct_relative(state.transform_stack); boundary_relative.pos += scroll_shift; @@ -403,12 +409,17 @@ fn draw_widget( style, }; - if scissor_result.should_display() { + if scissor_result + .as_ref() + .is_none_or(PushScissorStackResult::should_display) + { widget_state.draw_all(state, &draw_params); draw_children(params, state, node_id, internal, false); } - state.scissor_stack.pop(); + if scissor_result.is_some() { + state.scissor_stack.pop(); + } let current_scissor_set_count = internal.scissor_set_count; diff --git a/wgui/src/layout.rs b/wgui/src/layout.rs index 4ff0e653..8370e653 100644 --- a/wgui/src/layout.rs +++ b/wgui/src/layout.rs @@ -8,7 +8,9 @@ use std::{ use crate::{ animation::Animations, components::{self, Component, ComponentWeak, FocusChangeData, RefreshData}, - drawing::{self, ANSI_BOLD_CODE, ANSI_RESET_CODE, Boundary, push_scissor_stack, push_transform_stack}, + drawing::{ + self, ANSI_BOLD_CODE, ANSI_RESET_CODE, Boundary, PushScissorStackResult, push_scissor_stack, push_transform_stack, + }, event::{self, CallbackDataCommon, EventAlterables}, globals::WguiGlobals, sound::WguiSoundType, @@ -459,7 +461,10 @@ impl Layout { style, ); - if scissor_result.should_display() { + if scissor_result + .as_ref() + .is_none_or(PushScissorStackResult::should_display) + { // check children first self.push_event_children(node_id, event, event_result, alterables, user_data)?; @@ -476,7 +481,9 @@ impl Layout { } } - alterables.scissor_stack.pop(); + if scissor_result.is_some() { + alterables.scissor_stack.pop(); + } alterables.transform_stack.pop(); Ok(())