Repository: bevyengine/bevy
File: examples/ui/render_ui_to_texture.rs (Rust)

Code before:
                width: Val::Percent(100.),
                height: Val::Percent(100.),
                flex_direction: FlexDirection::Column,
                justify_content: JustifyContent::Center,
                align_items: AlignItems::Center,
                ..default()
            },
            BackgroundColor(GRAY.into()),
            UiTargetCamera(texture_camera),
        ))
        .with_children(|parent| {
            parent
                .spawn((
                    Node {
                        position_type: PositionType::Absolute,
                        width: Val::Auto,
                        height: Val::Auto,
                        align_items: AlignItems::Center,
                        padding: UiRect::all(Val::Px(20.)),
                        ..default()
                    },
                    BorderRadius::all(Val::Px(10.)),
                    BackgroundColor(BLUE.into()),
                ))
                .observe(
                    |pointer: Trigger<Pointer<Drag>>,
                     mut nodes: Query<(&mut Node, &ComputedNode)>| {
                        let (mut node, computed) = nodes.get_mut(pointer.target()).unwrap();
                        node.left =
                            Val::Px(pointer.pointer_location.position.x - computed.size.x / 2.0);
                        node.top = Val::Px(pointer.pointer_location.position.y - 50.0);
                    },
                )
                .observe(
                    |pointer: Trigger<Pointer<Over>>, mut colors: Query<&mut BackgroundColor>| {
                        colors.get_mut(pointer.target()).unwrap().0 = RED.into();
                    },
                )
                .observe(
                    |pointer: Trigger<Pointer<Out>>, mut colors: Query<&mut BackgroundColor>| {
                        colors.get_mut(pointer.target()).unwrap().0 = BLUE.into();
                    },
                )
                .with_children(|parent| {
                    parent.spawn((
                        Text::new("Drag Me!"),
                        TextFont {
                            font_size: 40.0,
                            ..default()
                        },
                        TextColor::WHITE,

Review comment (suggestion):
```suggestion
                    |pointer: On<Pointer<Drag>>,
```

Code after:
                justify_content: JustifyContent::Center,
                align_items: AlignItems::Center,
                ..default()
            },
            BackgroundColor(GRAY.into()),
            UiTargetCamera(texture_camera),
        ))
        .with_children(|parent| {
            parent
                .spawn((
                    Node {
                        position_type: PositionType::Absolute,
                        width: Val::Auto,
                        height: Val::Auto,
                        align_items: AlignItems::Center,
                        padding: UiRect::all(Val::Px(20.)),
                        ..default()
                    },
                    BorderRadius::all(Val::Px(10.)),
                    BackgroundColor(BLUE.into()),
                ))
                .observe(
                    |pointer: On<Pointer<Drag>>, mut nodes: Query<(&mut Node, &ComputedNode)>| {
                        let (mut node, computed) = nodes.get_mut(pointer.target()).unwrap();
                        node.left =
                            Val::Px(pointer.pointer_location.position.x - computed.size.x / 2.0);
                        node.top = Val::Px(pointer.pointer_location.position.y - 50.0);
                    },
                )
                .observe(
                    |pointer: On<Pointer<Over>>, mut colors: Query<&mut BackgroundColor>| {
                        colors.get_mut(pointer.target()).unwrap().0 = RED.into();
                    },
                )
                .observe(
                    |pointer: On<Pointer<Out>>, mut colors: Query<&mut BackgroundColor>| {
                        colors.get_mut(pointer.target()).unwrap().0 = BLUE.into();
                    },
                )
                .with_children(|parent| {
                    parent.spawn((
                        Text::new("Drag Me!"),
                        TextFont {
                            font_size: 40.0,
                            ..default()
                        },
                        TextColor::WHITE,
                    ));
                });
        });