Fixed issue where stops could be declared out of order in the builder but must be sorted before being passed to shader.
This commit is contained in:
parent
91b5ab6ab3
commit
734557bda5
1 changed files with 8 additions and 8 deletions
|
|
@ -57,17 +57,17 @@ impl Builder {
|
|||
return None;
|
||||
}
|
||||
|
||||
let mut stops: Vec<ColorStop> = self.stops.clone().into_iter().map(|f| ColorStop {
|
||||
offset: f.0,
|
||||
color: f.1
|
||||
}).collect();
|
||||
|
||||
stops.sort_by(|a, b| a.offset.partial_cmp(&b.offset).unwrap());
|
||||
|
||||
Some(Gradient::Linear(Linear {
|
||||
start: self.start,
|
||||
end: self.end,
|
||||
color_stops: self
|
||||
.stops
|
||||
.into_iter()
|
||||
.map(|f| ColorStop {
|
||||
offset: f.0,
|
||||
color: f.1,
|
||||
})
|
||||
.collect(),
|
||||
color_stops: stops
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue