fix: boundary error when deleting elements backwards #606

pr675
Hufe921 2 years ago
parent af9efec382
commit 500626498f

@ -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

Loading…
Cancel
Save