From e3f8d2852990d48cdd7bdb89cef47ee630d19f2d Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 8 Mar 2026 22:37:30 -0700 Subject: [PATCH] [Path] improve __lt__ for endcaps --- masque/shapes/path.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/masque/shapes/path.py b/masque/shapes/path.py index 654cfaa..ad6da5d 100644 --- a/masque/shapes/path.py +++ b/masque/shapes/path.py @@ -24,7 +24,16 @@ class PathCap(Enum): # # defined by path.cap_extensions 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