@@ -226,34 +226,13 @@ impl Item for TouchArea {
226226 self_rc : & ItemRc ,
227227 size : LogicalSize ,
228228 ) -> RenderingResult {
229- if let Some ( color) = ( * backend) . window ( ) . debug_touch_area . get ( ) {
230- let d = DebugTouchArea { color } ;
231- let debug = Pin :: new ( & d) ;
232- ( * backend) . draw_border_rectangle ( debug, self_rc, size, & self . cached_rendering_data ) ;
229+ if let Some ( color) = ( * backend) . window ( ) . debug_touch . get ( ) {
230+ debug_rect ( color, backend, self_rc, size, & self . cached_rendering_data ) ;
233231 }
234232 RenderingResult :: ContinueRenderingChildren
235233 }
236234}
237235
238- struct DebugTouchArea {
239- color : crate :: Color ,
240- }
241-
242- impl crate :: item_rendering:: RenderBorderRectangle for DebugTouchArea {
243- fn background ( self : Pin < & Self > ) -> crate :: Brush {
244- crate :: Brush :: SolidColor ( self . color )
245- }
246- fn border_width ( self : Pin < & Self > ) -> LogicalLength {
247- LogicalLength :: new ( 0.0 )
248- }
249- fn border_radius ( self : Pin < & Self > ) -> crate :: lengths:: LogicalBorderRadius {
250- crate :: lengths:: LogicalBorderRadius :: new ( 0.0 , 0.0 , 0.0 , 0.0 )
251- }
252- fn border_color ( self : Pin < & Self > ) -> crate :: Brush {
253- crate :: Brush :: SolidColor ( crate :: Color :: from_argb_u8 ( 0 , 0 , 0 , 0 ) )
254- }
255- }
256-
257236impl ItemConsts for TouchArea {
258237 const cached_rendering_data_offset: const_field_offset:: FieldOffset <
259238 TouchArea ,
@@ -545,10 +524,14 @@ impl Item for SwipeGestureHandler {
545524
546525 fn render (
547526 self : Pin < & Self > ,
548- _backend : & mut ItemRendererRef ,
549- _self_rc : & ItemRc ,
550- _size : LogicalSize ,
527+ backend : & mut ItemRendererRef ,
528+ self_rc : & ItemRc ,
529+ size : LogicalSize ,
551530 ) -> RenderingResult {
531+ if let Some ( color) = ( * backend) . window ( ) . debug_swipe . get ( ) {
532+ debug_rect ( color, backend, self_rc, size, & self . cached_rendering_data ) ;
533+ }
534+
552535 RenderingResult :: ContinueRenderingChildren
553536 }
554537}
@@ -587,3 +570,34 @@ pub unsafe extern "C" fn slint_swipegesturehandler_cancel(
587570 let self_rc = ItemRc :: new ( self_component. clone ( ) , self_index) ;
588571 s. cancel ( window_adapter, & self_rc) ;
589572}
573+
574+ fn debug_rect (
575+ color : crate :: Color ,
576+ backend : & mut ItemRendererRef ,
577+ self_rc : & ItemRc ,
578+ size : LogicalSize ,
579+ cached_rendering_data : & CachedRenderingData ,
580+ ) {
581+ let d = DebugTouchArea { color } ;
582+ let debug = Pin :: new ( & d) ;
583+ ( * backend) . draw_border_rectangle ( debug, self_rc, size, cached_rendering_data) ;
584+ }
585+
586+ struct DebugTouchArea {
587+ color : crate :: Color ,
588+ }
589+
590+ impl crate :: item_rendering:: RenderBorderRectangle for DebugTouchArea {
591+ fn background ( self : Pin < & Self > ) -> crate :: Brush {
592+ crate :: Brush :: SolidColor ( self . color )
593+ }
594+ fn border_width ( self : Pin < & Self > ) -> LogicalLength {
595+ LogicalLength :: new ( 0.0 )
596+ }
597+ fn border_radius ( self : Pin < & Self > ) -> crate :: lengths:: LogicalBorderRadius {
598+ crate :: lengths:: LogicalBorderRadius :: new ( 0.0 , 0.0 , 0.0 , 0.0 )
599+ }
600+ fn border_color ( self : Pin < & Self > ) -> crate :: Brush {
601+ crate :: Brush :: SolidColor ( crate :: Color :: from_argb_u8 ( 0 , 0 , 0 , 0 ) )
602+ }
603+ }
0 commit comments