Skip to main content

SpawnTooltipChild

Trait SpawnTooltipChild 

Source
pub trait SpawnTooltipChild {
    // Required methods
    fn spawn_with_tooltip<B: Bundle>(
        &mut self,
        tooltip_text: impl Into<String>,
        bundle: B,
    );
    fn spawn_with_positioned_tooltip<B: Bundle>(
        &mut self,
        tooltip_text: impl Into<String>,
        position: TooltipPosition,
        bundle: B,
    );
}
Expand description

Extension trait to attach tooltips to spawned elements

§Example:

use bevy::prelude::*;
use bevy_material_ui::tooltip::SpawnTooltipChild;

fn setup(mut commands: Commands) {
    commands.spawn(Node::default()).with_children(|children| {
        children.spawn_with_tooltip("Hover me for help", (Button, Text::new("?")));
    });
}

Required Methods§

Source

fn spawn_with_tooltip<B: Bundle>( &mut self, tooltip_text: impl Into<String>, bundle: B, )

Spawn an element with a plain tooltip attached

Source

fn spawn_with_positioned_tooltip<B: Bundle>( &mut self, tooltip_text: impl Into<String>, position: TooltipPosition, bundle: B, )

Spawn an element with a positioned tooltip

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SpawnTooltipChild for ChildSpawnerCommands<'_>

Source§

fn spawn_with_tooltip<B: Bundle>( &mut self, tooltip_text: impl Into<String>, bundle: B, )

Source§

fn spawn_with_positioned_tooltip<B: Bundle>( &mut self, tooltip_text: impl Into<String>, position: TooltipPosition, bundle: B, )

Implementors§