Skip to content

Commit

Permalink
Implement SetColor for Region
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jan 17, 2024
1 parent 5312f4c commit 854e561
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/fj-core/src/operations/presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@
use fj_interop::Color;

use crate::objects::Region;

/// Set the color of an object
pub trait SetColor {
/// Set the color of the object
fn set_color(&self, color: impl Into<Color>) -> Self;
}

impl SetColor for Region {
fn set_color(&self, color: impl Into<Color>) -> Self {
Region::new(
self.exterior().clone(),
self.interiors().into_iter().cloned(),
Some(color.into()),
)
}
}

0 comments on commit 854e561

Please sign in to comment.