Skip to content

Commit 5d5993b

Browse files
authored
Fix opacity not being included in alpha of Fill type when converted from Table<Color> (#3785)
* Fix opacity not being included in alpha of Fill type when converted from Table<Color> * Avoid unwrap, I guess
1 parent e5827f2 commit 5d5993b

File tree

1 file changed

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

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
pub use crate::gradient::*;
44
use core_types::Color;
5+
use core_types::color::Alpha;
56
use core_types::table::Table;
67
use dyn_any::DynAny;
78
use glam::DAffine2;
@@ -123,7 +124,9 @@ impl From<Option<Color>> for Fill {
123124

124125
impl From<Table<Color>> for Fill {
125126
fn from(color: Table<Color>) -> Fill {
126-
Fill::solid_or_none(color.into())
127+
let alpha = color.get(0).map(|c| c.alpha_blending.opacity).unwrap_or(1.);
128+
let color: Option<Color> = color.into();
129+
Fill::solid_or_none(color.map(|c| c.with_alpha(c.alpha() * alpha)))
127130
}
128131
}
129132

0 commit comments

Comments
 (0)