Update builder method

This commit is contained in:
Hanno Braun 2022-11-11 16:56:12 +01:00
parent 674d33a6ba
commit 73a411d902
2 changed files with 12 additions and 16 deletions

View File

@ -43,11 +43,10 @@ pub trait GlobalVertexBuilder {
) -> Self;
/// Update partial global vertex from the given surface and position on it
fn update_from_surface_and_position(
&mut self,
fn from_surface_and_position(
surface: &Surface,
position: impl Into<Point<2>>,
) -> &mut Self;
) -> Self;
}
impl GlobalVertexBuilder for PartialGlobalVertex {
@ -66,18 +65,15 @@ impl GlobalVertexBuilder for PartialGlobalVertex {
let position_surface = path.point_from_path_coords(position);
let mut global_vertex = PartialGlobalVertex::default();
global_vertex
.update_from_surface_and_position(&surface, position_surface);
global_vertex
Self::from_surface_and_position(&surface, position_surface)
}
fn update_from_surface_and_position(
&mut self,
fn from_surface_and_position(
surface: &Surface,
position: impl Into<Point<2>>,
) -> &mut Self {
self.position = Some(surface.point_from_surface_coords(position));
self
) -> Self {
PartialGlobalVertex {
position: Some(surface.point_from_surface_coords(position)),
}
}
}

View File

@ -107,10 +107,10 @@ impl PartialSurfaceVertex {
let global_form = self
.global_form
.update_partial(|mut global_form| {
global_form
.update_from_surface_and_position(&surface, position);
global_form
.update_partial(|_| {
PartialGlobalVertex::from_surface_and_position(
&surface, position,
)
})
.into_full(objects)?;