mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
fix(primitives): fix polygon gizmo rendering bug (#11699)
This is just a minor fix extracted from #11697 A logic error. We tried to close the polygon shape, if the user specifies an unclosed polygon. The closing linestring previously didn't close the polygon though, but instead added a zero length line at the last coordinate. Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
56076b7b0c
commit
381f3d3fa5
1 changed files with 6 additions and 6 deletions
|
@ -467,9 +467,9 @@ impl<'w, 's, const N: usize, T: GizmoConfigGroup> GizmoPrimitive2d<Polygon<N>>
|
|||
|
||||
// Check if the polygon needs a closing point
|
||||
let closing_point = {
|
||||
let last = primitive.vertices.last();
|
||||
(primitive.vertices.first() != last)
|
||||
.then_some(last)
|
||||
let first = primitive.vertices.first();
|
||||
(primitive.vertices.last() != first)
|
||||
.then_some(first)
|
||||
.flatten()
|
||||
.cloned()
|
||||
};
|
||||
|
@ -503,9 +503,9 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive2d<BoxedPolygon> for Gizmos<'w,
|
|||
}
|
||||
|
||||
let closing_point = {
|
||||
let last = primitive.vertices.last();
|
||||
(primitive.vertices.first() != last)
|
||||
.then_some(last)
|
||||
let first = primitive.vertices.first();
|
||||
(primitive.vertices.last() != first)
|
||||
.then_some(first)
|
||||
.flatten()
|
||||
.cloned()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue