Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
  • Loading branch information
mxgrey committed Aug 27, 2024
1 parent 223f6de commit 281c33a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
21 changes: 13 additions & 8 deletions rmf_site_editor/src/interaction/select/select_anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use bevy::prelude::*;
use bevy_impulse::*;

use crate::{site::CurrentLevel, interaction::select::*};
use rmf_site_format::{Fiducial, Floor, Location, Path, Point, LevelElevation};
use crate::{interaction::select::*, site::CurrentLevel};
use rmf_site_format::{Fiducial, Floor, LevelElevation, Location, Path, Point};

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Resource)]
pub enum AnchorScope {
Expand Down Expand Up @@ -151,7 +151,10 @@ impl<'w, 's> AnchorSelection<'w, 's> {
}

pub fn create_walls(&mut self) {
self.create_edges_with_texture::<Wall<Entity>>(EdgeContinuity::Continuous, AnchorScope::General);
self.create_edges_with_texture::<Wall<Entity>>(
EdgeContinuity::Continuous,
AnchorScope::General,
);
}

pub fn create_door(&mut self) {
Expand Down Expand Up @@ -207,7 +210,9 @@ impl<'w, 's> AnchorSelection<'w, 's> {
) {
let state = self
.commands
.spawn(SelectorInput(CreateEdges::new_with_texture::<T>(continuity, scope)))
.spawn(SelectorInput(CreateEdges::new_with_texture::<T>(
continuity, scope,
)))
.id();

self.send(RunSelector {
Expand Down Expand Up @@ -536,9 +541,9 @@ pub struct AnchorFilter<'w, 's> {

impl<'w, 's> SelectionFilter for AnchorFilter<'w, 's> {
fn filter_pick(&mut self, select: Entity) -> Option<Entity> {
self.inspect.filter_pick(select).and_then(|e| {
self.filter_target(e)
})
self.inspect
.filter_pick(select)
.and_then(|e| self.filter_target(e))
}

fn filter_select(&mut self, target: Entity) -> Option<Entity> {
Expand Down Expand Up @@ -607,7 +612,7 @@ impl<'w, 's> SelectionFilter for AnchorFilter<'w, 's> {
}
}

impl<'w, 's> AnchorFilter<'w ,'s> {
impl<'w, 's> AnchorFilter<'w, 's> {
fn filter_anchor(&mut self, target: Entity) -> Option<Entity> {
if self.anchors.contains(target) {
Some(target)
Expand Down
15 changes: 8 additions & 7 deletions rmf_site_editor/src/site/fiducial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,14 @@ pub fn update_fiducial_for_moved_anchors(
for dependents in &changed_anchors {
for dependent in dependents.iter() {
if let Ok((e, point, mut tf)) = fiducials.get_mut(*dependent) {
let position = match anchors.point_in_parent_frame_of(point.0, Category::Fiducial, e) {
Ok(position) => position,
Err(err) => {
error!("failed to update fiducial: {err}");
continue;
}
};
let position =
match anchors.point_in_parent_frame_of(point.0, Category::Fiducial, e) {
Ok(position) => position,
Err(err) => {
error!("failed to update fiducial: {err}");
continue;
}
};
tf.translation = position;
}
}
Expand Down
11 changes: 8 additions & 3 deletions rmf_site_editor/src/widgets/inspector/inspect_fiducial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

use crate::{
site::{
Affiliation, Change, FiducialGroup, FiducialMarker, FiducialUsage,
Group, NameInSite, NameOfSite,
Affiliation, Change, FiducialGroup, FiducialMarker, FiducialUsage, Group, NameInSite,
NameOfSite,
},
widgets::{prelude::*, Icons, Inspect, InspectionPlugin},
};
Expand Down Expand Up @@ -99,7 +99,12 @@ impl<'w, 's> WidgetSystem<Inspect> for InspectFiducial<'w, 's> {
error!(
"Unable to find usage tracker for parent {:?} [{}] of fiducial {:?}",
parent.get(),
params.names.get(parent.get()).ok().map(|n| n.0.as_str()).unwrap_or("<name missing>"),
params
.names
.get(parent.get())
.ok()
.map(|n| n.0.as_str())
.unwrap_or("<name missing>"),
selection,
);
return;
Expand Down

0 comments on commit 281c33a

Please sign in to comment.