|
@ -1309,12 +1309,32 @@ impl Tessellator { |
|
|
rect.min = rect.min.at_least(pos2(-1e7, -1e7)); |
|
|
rect.min = rect.min.at_least(pos2(-1e7, -1e7)); |
|
|
rect.max = rect.max.at_most(pos2(1e7, 1e7)); |
|
|
rect.max = rect.max.at_most(pos2(1e7, 1e7)); |
|
|
|
|
|
|
|
|
let path = &mut self.scratchpad_path; |
|
|
if rect.width() < self.feathering { |
|
|
path.clear(); |
|
|
// Very thin - approximate by a vertial line-segment:
|
|
|
path::rounded_rectangle(&mut self.scratchpad_points, rect, rounding); |
|
|
let line = [rect.center_top(), rect.center_bottom()]; |
|
|
path.add_line_loop(&self.scratchpad_points); |
|
|
if fill != Color32::TRANSPARENT { |
|
|
path.fill(self.feathering, fill, out); |
|
|
self.tessellate_line(line, Stroke::new(rect.width(), fill), out); |
|
|
path.stroke_closed(self.feathering, stroke, out); |
|
|
} |
|
|
|
|
|
if !stroke.is_empty() { |
|
|
|
|
|
self.tessellate_line(line, stroke, out); |
|
|
|
|
|
} |
|
|
|
|
|
} else if rect.height() < self.feathering { |
|
|
|
|
|
// Very thin - approximate by a horizontal line-segment:
|
|
|
|
|
|
let line = [rect.left_center(), rect.right_center()]; |
|
|
|
|
|
if fill != Color32::TRANSPARENT { |
|
|
|
|
|
self.tessellate_line(line, Stroke::new(rect.width(), fill), out); |
|
|
|
|
|
} |
|
|
|
|
|
if !stroke.is_empty() { |
|
|
|
|
|
self.tessellate_line(line, stroke, out); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
let path = &mut self.scratchpad_path; |
|
|
|
|
|
path.clear(); |
|
|
|
|
|
path::rounded_rectangle(&mut self.scratchpad_points, rect, rounding); |
|
|
|
|
|
path.add_line_loop(&self.scratchpad_points); |
|
|
|
|
|
path.fill(self.feathering, fill, out); |
|
|
|
|
|
path.stroke_closed(self.feathering, stroke, out); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Tessellate a single [`TextShape`] into a [`Mesh`].
|
|
|
/// Tessellate a single [`TextShape`] into a [`Mesh`].
|
|
|