fix: boundary error when deleting elements backwards #606
This commit is contained in:
@@ -682,7 +682,7 @@ export class Draw {
|
||||
if (!this.control.getActiveControl()) {
|
||||
let deleteIndex = endIndex - 1
|
||||
while (deleteIndex >= start) {
|
||||
if (elementList[deleteIndex].control?.deletable !== false) {
|
||||
if (elementList[deleteIndex]?.control?.deletable !== false) {
|
||||
elementList.splice(deleteIndex, 1)
|
||||
}
|
||||
deleteIndex--
|
||||
|
||||
@@ -26,6 +26,7 @@ export function del(evt: KeyboardEvent, host: CanvasEvent) {
|
||||
if (!isCollapsed) {
|
||||
draw.spliceElementList(elementList, startIndex + 1, endIndex - startIndex)
|
||||
} else {
|
||||
if (!elementList[index + 1]) return
|
||||
draw.spliceElementList(elementList, index + 1, 1)
|
||||
}
|
||||
curIndex = isCollapsed ? index : startIndex
|
||||
|
||||
Reference in New Issue
Block a user