Skip to content

Commit

Permalink
Implement SetColor for Handle<Region> instead
Browse files Browse the repository at this point in the history
This is required to extract appearance into a separate layer, as
associating attributes to objects can only work, if we have a unique
`Handle` to that object.
  • Loading branch information
hannobraun committed Jan 26, 2024
1 parent 5bf90b3 commit 2bfb010
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/fj-core/src/operations/presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

use fj_interop::Color;

use crate::objects::Region;
use crate::{
objects::{IsObject, Region},
storage::Handle,
};

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

impl SetColor for Region {
fn set_color(&self, color: impl Into<Color>) -> Self {
impl SetColor for Handle<Region> {
fn set_color(&self, color: impl Into<Color>) -> Self::BareObject {
Region::new(
self.exterior().clone(),
self.interiors().into_iter().cloned(),
Expand Down

0 comments on commit 2bfb010

Please sign in to comment.