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
@ -467,9 +467,9 @@ impl<'w, 's, const N: usize, T: GizmoConfigGroup> GizmoPrimitive2d<Polygon<N>>
|
|||||||
|
|
||||||
// Check if the polygon needs a closing point
|
// Check if the polygon needs a closing point
|
||||||
let closing_point = {
|
let closing_point = {
|
||||||
let last = primitive.vertices.last();
|
let first = primitive.vertices.first();
|
||||||
(primitive.vertices.first() != last)
|
(primitive.vertices.last() != first)
|
||||||
.then_some(last)
|
.then_some(first)
|
||||||
.flatten()
|
.flatten()
|
||||||
.cloned()
|
.cloned()
|
||||||
};
|
};
|
||||||
@ -503,9 +503,9 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive2d<BoxedPolygon> for Gizmos<'w,
|
|||||||
}
|
}
|
||||||
|
|
||||||
let closing_point = {
|
let closing_point = {
|
||||||
let last = primitive.vertices.last();
|
let first = primitive.vertices.first();
|
||||||
(primitive.vertices.first() != last)
|
(primitive.vertices.last() != first)
|
||||||
.then_some(last)
|
.then_some(first)
|
||||||
.flatten()
|
.flatten()
|
||||||
.cloned()
|
.cloned()
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user