From 7bfc53eb90239b0e95755df8f02c8b7191718a74 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 24 Jan 2026 22:53:38 -0600 Subject: [PATCH] little more setup for the slide_text custom widget --- src/ui/widgets/slide_text.rs | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/ui/widgets/slide_text.rs b/src/ui/widgets/slide_text.rs index e710c92..c97ffbc 100644 --- a/src/ui/widgets/slide_text.rs +++ b/src/ui/widgets/slide_text.rs @@ -4,6 +4,7 @@ use cosmic::iced::advanced::widget::{self, Widget}; use cosmic::iced::border; use cosmic::iced::mouse; use cosmic::iced::{Color, Element, Length, Rectangle, Size}; +use cosmic::iced_wgpu::Primitive; use cosmic::iced_wgpu::primitive::Renderer as PrimitiveRenderer; pub struct SlideText { @@ -60,6 +61,8 @@ where _cursor: mouse::Cursor, _viewport: &Rectangle, ) { + renderer + .draw_primitive(layout.bounds(), TextPrimitive::new()); renderer.fill_quad( renderer::Quad { bounds: layout.bounds(), @@ -82,3 +85,39 @@ where Self::new(slide_text) } } + +#[derive(Debug, Clone)] +pub(crate) struct TextPrimitive { + text_id: u64, + size: (u32, u32), +} + +impl TextPrimitive { + pub fn new() -> Self { + todo!() + } +} + +impl Primitive for TextPrimitive { + fn prepare( + &self, + device: &cosmic::iced::wgpu::Device, + queue: &cosmic::iced::wgpu::Queue, + format: cosmic::iced::wgpu::TextureFormat, + storage: &mut cosmic::iced_widget::shader::Storage, + bounds: &Rectangle, + viewport: &cosmic::iced_wgpu::graphics::Viewport, + ) { + todo!() + } + + fn render( + &self, + encoder: &mut cosmic::iced::wgpu::CommandEncoder, + storage: &cosmic::iced_widget::shader::Storage, + target: &cosmic::iced::wgpu::TextureView, + clip_bounds: &Rectangle, + ) { + todo!() + } +}