mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-02-17 12:10:49 +01:00
Put safeguards on dragging and dropping into invalid positions
This commit is contained in:
parent
3e0b1a9e63
commit
85aa180a90
@ -1029,6 +1029,10 @@ function sortableOnStop(event, ui) {
|
|||||||
next_sibling = ui.item.next().next().attr("num");
|
next_sibling = ui.item.next().next().attr("num");
|
||||||
}
|
}
|
||||||
next_sibling = parseInt(next_sibling);
|
next_sibling = parseInt(next_sibling);
|
||||||
|
if(Number.isNaN(next_sibling)) {
|
||||||
|
$(this).sortable("cancel");
|
||||||
|
return;
|
||||||
|
}
|
||||||
socket.send({'cmd': 'wimoveitem', 'destination': next_sibling, 'data': parseInt(ui.item.attr("num"))});
|
socket.send({'cmd': 'wimoveitem', 'destination': next_sibling, 'data': parseInt(ui.item.attr("num"))});
|
||||||
} else {
|
} else {
|
||||||
// Do the same thing for WI folders
|
// Do the same thing for WI folders
|
||||||
@ -1038,6 +1042,10 @@ function sortableOnStop(event, ui) {
|
|||||||
} else {
|
} else {
|
||||||
next_sibling = parseInt(next_sibling);
|
next_sibling = parseInt(next_sibling);
|
||||||
}
|
}
|
||||||
|
if(Number.isNaN(next_sibling)) {
|
||||||
|
$(this).sortable("cancel");
|
||||||
|
return;
|
||||||
|
}
|
||||||
socket.send({'cmd': 'wimovefolder', 'destination': next_sibling, 'data': parseInt(ui.item.attr("folder-uid"))});
|
socket.send({'cmd': 'wimovefolder', 'destination': next_sibling, 'data': parseInt(ui.item.attr("folder-uid"))});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1873,6 +1881,7 @@ $(document).ready(function(){
|
|||||||
start: sortableOnStart,
|
start: sortableOnStart,
|
||||||
stop: sortableOnStop,
|
stop: sortableOnStop,
|
||||||
placeholder: "wisortable-placeholder",
|
placeholder: "wisortable-placeholder",
|
||||||
|
delay: 2,
|
||||||
cursor: "move",
|
cursor: "move",
|
||||||
tolerance: "pointer",
|
tolerance: "pointer",
|
||||||
opacity: 0.21,
|
opacity: 0.21,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user