diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/widget/canvas/gradient/linear.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/graphics/src/widget/canvas/gradient/linear.rs b/graphics/src/widget/canvas/gradient/linear.rs index 37533e19..1dc7e3a8 100644 --- a/graphics/src/widget/canvas/gradient/linear.rs +++ b/graphics/src/widget/canvas/gradient/linear.rs @@ -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 })) } } |