Make logprobs draggable, fix conflicts between moving UI and maximization, fix z-fighting

This commit is contained in:
Cohee
2024-03-19 01:40:02 +02:00
parent c8f84bd413
commit 5b7b06aba8
6 changed files with 40 additions and 7 deletions

View File

@ -945,6 +945,9 @@ function peekSpoilerMode() {
function switchMovingUI() {
$('.drawer-content.maximized').each(function () {
$(this).find('.inline-drawer-maximize').trigger('click');
});
const movingUI = localStorage.getItem(storage_keys.movingUI);
power_user.movingUI = movingUI === null ? false : movingUI == 'true';
$('body').toggleClass('movingUI', power_user.movingUI);
@ -2162,6 +2165,22 @@ async function saveMovingUI() {
}
}
/**
* Resets the movable styles of the given element to their unset values.
* @param {string} id Element ID
*/
export function resetMovableStyles(id) {
const panelStyles = ['top', 'left', 'right', 'bottom', 'height', 'width', 'margin'];
const panel = document.getElementById(id);
if (panel) {
panelStyles.forEach((style) => {
panel.style[style] = '';
});
}
}
async function resetMovablePanels(type) {
const panelIds = [
'sheld',
@ -2173,6 +2192,8 @@ async function resetMovablePanels(type) {
'groupMemberListPopout',
'summaryExtensionPopout',
'gallery',
'logprobsViewer',
'cfgConfig',
];
const panelStyles = ['top', 'left', 'right', 'bottom', 'height', 'width', 'margin'];