[Path] improve __lt__ for endcaps

This commit is contained in:
jan 2026-03-08 22:37:30 -07:00
commit e3f8d28529

View file

@ -24,7 +24,16 @@ class PathCap(Enum):
# # defined by path.cap_extensions # # defined by path.cap_extensions
def __lt__(self, other: Any) -> bool: def __lt__(self, other: Any) -> bool:
return self.value == other.value if self.__class__ is not other.__class__:
return self.__class__.__name__ < other.__class__.__name__
# Order: Flush, Square, Round, SquareCustom, Circle
order = {
PathCap.Flush: 0,
PathCap.Square: 1,
PathCap.Circle: 2,
PathCap.SquareCustom: 3,
}
return order[self] < order[other]
@functools.total_ordering @functools.total_ordering