diff --git a/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue b/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue index 813d0c7..a501dbe 100644 --- a/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue +++ b/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue @@ -133,9 +133,13 @@ >
History -
- -
+
@@ -146,9 +150,6 @@ >
Current -
- -
@@ -520,6 +521,25 @@ const handleDownload = () => { message.error(t('Failed to download image')) } } + +const removeHistoryItem = (index: number) => { + if (index < 0 || index >= historyList.value.length) return + + const removingCurrent = currentHistoryIndex.value === index + historyList.value.splice(index, 1) + + if (historyList.value.length === 0) { + currentHistoryIndex.value = -1 + return + } + + if (removingCurrent) { + const nextIndex = Math.min(index, historyList.value.length - 1) + selectHistoryItem(nextIndex) + } else if (currentHistoryIndex.value > index) { + currentHistoryIndex.value -= 1 + } +}