Implement TransformObject for Handle<Curve>

This is preparation for setting curve geometry there.
This commit is contained in:
Hanno Braun 2024-04-30 12:23:02 +02:00
parent 3f4a92e6c9
commit b143ffb8cf

View File

@ -1,19 +1,24 @@
use fj_math::Transform;
use crate::{topology::Curve, Core};
use crate::{
operations::insert::Insert, storage::Handle, topology::Curve, Core,
};
use super::{TransformCache, TransformObject};
impl TransformObject for Curve {
impl TransformObject for Handle<Curve> {
fn transform_with_cache(
&self,
_: &Transform,
_: &mut Core,
_: &mut TransformCache,
core: &mut Core,
cache: &mut TransformCache,
) -> Self {
// There's nothing to actually transform here, as `Curve` holds no data.
// We still need this implementation though, as a new `Curve` object
// must be created to represent the new and transformed curve.
Self::new()
cache
.entry(self)
.or_insert_with(|| Curve::new().insert(core))
.clone()
}
}