pub struct Gizmo { /* private fields */ }
Expand description
A 3D transformation gizmo.
Implementations§
Source§impl Gizmo
impl Gizmo
Sourcepub fn new(config: GizmoConfig) -> Self
pub fn new(config: GizmoConfig) -> Self
Creates a new gizmo from given configuration
Sourcepub fn config(&self) -> &GizmoConfig
pub fn config(&self) -> &GizmoConfig
Current configuration used by the gizmo.
Sourcepub fn update_config(&mut self, config: GizmoConfig)
pub fn update_config(&mut self, config: GizmoConfig)
Updates the configuration used by the gizmo.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Was this gizmo focused after the latest Gizmo::update
call.
Sourcepub fn update(
&mut self,
interaction: GizmoInteraction,
targets: &[Transform],
) -> Option<(GizmoResult, Vec<Transform>)>
pub fn update( &mut self, interaction: GizmoInteraction, targets: &[Transform], ) -> Option<(GizmoResult, Vec<Transform>)>
Updates the gizmo based on given interaction information.
§Examples
let interaction = GizmoInteraction {
cursor_pos,
hovered,
drag_started,
dragging
};
if let Some((_result, new_transforms)) = gizmo.update(interaction, &transforms) {
for (new_transform, transform) in
// Update transforms
new_transforms.iter().zip(&mut transforms)
{
*transform = *new_transform;
}
}
Returns the result of the interaction with the updated transformation.
Some
is returned when any of the subgizmos is being dragged, None
otherwise.
Sourcepub fn draw(&self) -> GizmoDrawData
pub fn draw(&self) -> GizmoDrawData
Return all the necessary data to draw the latest gizmo interaction.
The gizmo draw data consists of vertices in viewport coordinates.
Sourcepub fn pick_preview(&self, cursor_pos: (f32, f32)) -> bool
pub fn pick_preview(&self, cursor_pos: (f32, f32)) -> bool
Checks all sub-gizmos for intersections with the cursor. If there is one, return true.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Gizmo
impl RefUnwindSafe for Gizmo
impl Send for Gizmo
impl Sync for Gizmo
impl Unpin for Gizmo
impl UnwindSafe for Gizmo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more