MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / render_debug_view_category_header

Method render_debug_view_category_header

src/engine.rs:7312–7385  ·  view source on GitHub ↗

Render a category header badge with arbitrary label and color.

(
        &mut self,
        label: &str,
        label_color: Color,
        element_id_string: StringId,
    )

Source from the content-addressed store, hash-verified

7310
7311 /// Render a category header badge with arbitrary label and color.
7312 fn render_debug_view_category_header(
7313 &mut self,
7314 label: &str,
7315 label_color: Color,
7316 element_id_string: StringId,
7317 ) {
7318 let bg = Color::rgba(label_color.r, label_color.g, label_color.b, 90.0);
7319 self.debug_open(&ElementDeclaration {
7320 layout: LayoutConfig {
7321 sizing: SizingConfig {
7322 width: SizingAxis { type_: SizingType::Grow, ..Default::default() },
7323 ..Default::default()
7324 },
7325 padding: PaddingConfig {
7326 left: Self::DEBUG_VIEW_OUTER_PADDING,
7327 right: Self::DEBUG_VIEW_OUTER_PADDING,
7328 top: Self::DEBUG_VIEW_OUTER_PADDING,
7329 bottom: Self::DEBUG_VIEW_OUTER_PADDING,
7330 },
7331 child_alignment: ChildAlignmentConfig { x: AlignX::Left, y: AlignY::CenterY },
7332 ..Default::default()
7333 },
7334 ..Default::default()
7335 });
7336 {
7337 // Badge
7338 self.debug_open(&ElementDeclaration {
7339 layout: LayoutConfig {
7340 padding: PaddingConfig { left: 8, right: 8, top: 2, bottom: 2 },
7341 ..Default::default()
7342 },
7343 background_color: bg,
7344 corner_radius: CornerRadius { top_left: 4.0, top_right: 4.0, bottom_left: 4.0, bottom_right: 4.0 },
7345 border: BorderConfig {
7346 color: label_color,
7347 width: BorderWidth { left: 1, right: 1, top: 1, bottom: 1, between_children: 0 },
7348 ..Default::default()
7349 },
7350 ..Default::default()
7351 });
7352 {
7353 let tc = self.store_text_element_config(TextConfig {
7354 color: Self::DEBUG_COLOR_4,
7355 font_size: 16,
7356 ..Default::default()
7357 });
7358 self.debug_raw_text(label, tc);
7359 }
7360 self.close_element();
7361 // Spacer
7362 self.debug_open(&ElementDeclaration {
7363 layout: LayoutConfig {
7364 sizing: SizingConfig {
7365 width: SizingAxis { type_: SizingType::Grow, ..Default::default() },
7366 ..Default::default()
7367 },
7368 ..Default::default()
7369 },

Calls 6

debug_openMethod · 0.80
debug_raw_textMethod · 0.80
close_elementMethod · 0.80
is_emptyMethod · 0.80
as_strMethod · 0.80

Tested by

no test coverage detected