Skip to content

Commit 4fa3ee2

Browse files
committed
Fix lerp function in Fill enum to handle None cases correctly
1 parent 513f51e commit 4fa3ee2

File tree

1 file changed

+3
-3
lines changed
  • node-graph/libraries/vector-types/src/vector

1 file changed

+3
-3
lines changed

node-graph/libraries/vector-types/src/vector/style.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl Fill {
6464

6565
pub fn lerp(&self, other: &Self, time: f64) -> Self {
6666
let transparent = Self::solid(Color::TRANSPARENT);
67-
let a = if *self == Self::None { &transparent } else { self };
68-
let b = if *other == Self::None { &transparent } else { other };
67+
let a = if *self == Self::None && *other != Self::None { &transparent } else { self };
68+
let b = if *other == Self::None && *self != Self::None { &transparent } else { other };
6969

7070
match (a, b) {
7171
(Self::Solid(a), Self::Solid(b)) => Self::Solid(a.lerp(b, time as f32)),
@@ -82,7 +82,7 @@ impl Fill {
8282
Self::Gradient(a.lerp(b, time))
8383
}
8484
(Self::Gradient(a), Self::Gradient(b)) => Self::Gradient(a.lerp(b, time)),
85-
_ => Self::None,
85+
(Self::None, _) | (_, Self::None) => Self::None,
8686
}
8787
}
8888

0 commit comments

Comments
 (0)