mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-03 04:37:40 +01:00
fix movingUI observer states
This commit is contained in:
parent
31feaee805
commit
a837b1e2fb
@ -534,12 +534,14 @@ export function dragElement(elmnt) {
|
||||
|
||||
if (elmntHeader.length) {
|
||||
elmntHeader.off('mousedown').on('mousedown', (e) => {
|
||||
|
||||
hasBeenDraggedByUser = true
|
||||
observer.observe(elmnt.get(0), { attributes: true, attributeFilter: ['style'] });
|
||||
dragMouseDown(e);
|
||||
});
|
||||
$(elmnt).off('mousedown').on('mousedown', () => { isMouseDown = true })
|
||||
} else {
|
||||
elmnt.off('mousedown').on('mousedown', dragMouseDown);
|
||||
$(elmnt).off('mousedown').on('mousedown', () => {
|
||||
isMouseDown = true
|
||||
observer.observe(elmnt.get(0), { attributes: true, attributeFilter: ['style'] });
|
||||
})
|
||||
}
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
@ -618,7 +620,7 @@ export function dragElement(elmnt) {
|
||||
}
|
||||
|
||||
//prevent resizing from top left into the top bar
|
||||
if (top <= 40 && maxX >= topBarFirstX && left <= topBarFirstX
|
||||
if (top < 40 && maxX >= topBarFirstX && left <= topBarFirstX
|
||||
) {
|
||||
console.debug('prevent topbar underlap resize')
|
||||
elmnt.css('width', width - 1 + "px");
|
||||
@ -674,8 +676,6 @@ export function dragElement(elmnt) {
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(elmnt.get(0), { attributes: true, attributeFilter: ['style'] });
|
||||
|
||||
function dragMouseDown(e) {
|
||||
|
||||
if (e) {
|
||||
@ -745,6 +745,7 @@ export function dragElement(elmnt) {
|
||||
$("body").css("overflow", "");
|
||||
// Clear the "data-dragged" attribute
|
||||
elmnt.attr('data-dragged', 'false');
|
||||
observer.disconnect()
|
||||
console.debug(`Saving ${elmntName} UI position`)
|
||||
saveSettingsDebounced();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user