mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
anti-Tav tactics (MovingUI resets on page zoom)
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
|||||||
|
|
||||||
import { registerSlashCommand } from "./slash-commands.js";
|
import { registerSlashCommand } from "./slash-commands.js";
|
||||||
|
|
||||||
import { delay } from "./utils.js";
|
import { delay, debounce } from "./utils.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
loadPowerUserSettings,
|
loadPowerUserSettings,
|
||||||
@@ -983,7 +983,7 @@ async function saveTheme() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resetMovablePanels() {
|
async function resetMovablePanels(type) {
|
||||||
const panelIds = [
|
const panelIds = [
|
||||||
'sheld',
|
'sheld',
|
||||||
'left-nav-panel',
|
'left-nav-panel',
|
||||||
@@ -1025,9 +1025,12 @@ async function resetMovablePanels() {
|
|||||||
|
|
||||||
eventSource.once(event_types.SETTINGS_UPDATED, () => {
|
eventSource.once(event_types.SETTINGS_UPDATED, () => {
|
||||||
$(".resizing").removeClass('resizing');
|
$(".resizing").removeClass('resizing');
|
||||||
toastr.success('Panel positions reset');
|
if (type === 'resize') {
|
||||||
|
toastr.warning('Panel positions reset due to zoom/resize');
|
||||||
|
} else {
|
||||||
|
toastr.success('Panel positions reset');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doNewChat() {
|
function doNewChat() {
|
||||||
@@ -1121,6 +1124,18 @@ function doResetPanels() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
|
|
||||||
|
$(window).on('resize', async () => {
|
||||||
|
//console.log('Window resized!');
|
||||||
|
const zoomLevel = Number(window.devicePixelRatio).toFixed(2);
|
||||||
|
const winWidth = window.innerWidth;
|
||||||
|
const winHeight = window.innerHeight;
|
||||||
|
console.debug(`Zoom: ${zoomLevel}, X:${winWidth}, Y:${winHeight}`);
|
||||||
|
|
||||||
|
resetMovablePanels('resize');
|
||||||
|
// Adjust layout and styling here
|
||||||
|
});
|
||||||
|
|
||||||
// Settings that go to settings.json
|
// Settings that go to settings.json
|
||||||
$("#collapse-newlines-checkbox").change(function () {
|
$("#collapse-newlines-checkbox").change(function () {
|
||||||
power_user.collapse_newlines = !!$(this).prop("checked");
|
power_user.collapse_newlines = !!$(this).prop("checked");
|
||||||
|
Reference in New Issue
Block a user