mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
geometry: Profile: Fix delete command undo point order.
This commit is contained in:
1 parent
b3a6d0713d
commit
ff9c47eb83
4 files changed
+42
-15
No files matched your search
@@ -140,19 +140,47 @@ class Profile(object):
|
||||
self._points.insert(index, point)
|
||||
|
||||
|
||||
def delete(self, index: int):
|
||||
"""Delete the point at index
|
||||
def delete(self, indexes: int):
|
||||
"""Delete points at index
|
||||
|
||||
Args:
|
||||
index: Index of point.
|
||||
indexes: List of index of points.
|
||||
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
try:
|
||||
self._points.pop(index)
|
||||
except IndexError:
|
||||
raise IndexError(f"Invalid point index: {index}")
|
||||
points = set(
|
||||
map(
|
||||
lambda e: e[1],
|
||||
filter(
|
||||
lambda e: e[0] in indexes,
|
||||
enumerate(self.points)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
self._points = list(
|
||||
filter(
|
||||
lambda p: p not in points,
|
||||
self.points
|
||||
)
|
||||
)
|
||||
|
||||
def delete_points(self, points):
|
||||
"""Delete some elements in profile list
|
||||
|
||||
Args:
|
||||
points: The list of profile to delete
|
||||
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
self._points = list(
|
||||
filter(
|
||||
lambda p: p not in points,
|
||||
self.points
|
||||
)
|
||||
)
|
||||
|
||||
# Move
|
||||
|
||||
|
||||
Reference in new issue
Block a user