Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions crates/bevy_ui/src/widget/viewport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ use bevy_picking::{
use bevy_platform::collections::HashMap;
use bevy_reflect::Reflect;
#[cfg(feature = "bevy_ui_picking_backend")]
use bevy_transform::components::GlobalTransform;
#[cfg(feature = "bevy_ui_picking_backend")]
use uuid::Uuid;

#[cfg(feature = "bevy_ui_picking_backend")]
use crate::UiGlobalTransform;
use crate::{ComputedNode, Node};

/// Component used to render a [`Camera::target`] to a node.
Expand Down Expand Up @@ -73,7 +73,7 @@ pub fn viewport_picking(
&PointerId,
&mut PointerLocation,
&ComputedNode,
&GlobalTransform,
&UiGlobalTransform,
)>,
camera_query: Query<&Camera>,
hover_map: Res<HoverMap>,
Expand Down Expand Up @@ -123,10 +123,8 @@ pub fn viewport_picking(
};

// Create a `Rect` in *physical* coordinates centered at the node's GlobalTransform
let node_rect = Rect::from_center_size(
global_transform.translation().truncate(),
computed_node.size(),
);
let node_rect =
Rect::from_center_size(global_transform.translation.trunc(), computed_node.size());
// Location::position uses *logical* coordinates
let top_left = node_rect.min * computed_node.inverse_scale_factor();
let logical_size = computed_node.size() * computed_node.inverse_scale_factor();
Expand Down