mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
character expressions are now draggable
This commit is contained in:
@ -315,6 +315,9 @@ function OpenNavPanels() {
|
||||
dragElement(document.getElementById("sheld"));
|
||||
dragElement(document.getElementById("left-nav-panel"));
|
||||
dragElement(document.getElementById("right-nav-panel"));
|
||||
setTimeout(function () {
|
||||
dragElement(document.getElementById("expression-holder"))
|
||||
}, 2000);
|
||||
|
||||
|
||||
function dragElement(elmnt) {
|
||||
@ -342,6 +345,7 @@ function dragElement(elmnt) {
|
||||
//disable scrollbars when dragging to prevent jitter
|
||||
$("body").css("overflow", "hidden");
|
||||
|
||||
|
||||
//get window size
|
||||
let winWidth = window.innerWidth;
|
||||
let winHeight = window.innerHeight;
|
||||
@ -387,6 +391,9 @@ function dragElement(elmnt) {
|
||||
|
||||
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
|
||||
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
|
||||
$(elmnt).css("bottom", "unset");
|
||||
$(elmnt).css("right", "unset");
|
||||
|
||||
|
||||
}
|
||||
}, 50)
|
||||
@ -403,6 +410,7 @@ function dragElement(elmnt) {
|
||||
document.onmousemove = null;
|
||||
//revert scrolling to normal after drag to allow recovery of vastly misplaced elements
|
||||
$("body").css("overflow", "auto");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user