From 331cb4703db27ba0ba4347bee271daa7613ac264 Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Wed, 25 Oct 2023 18:27:11 +0200 Subject: [PATCH] Fixed camera issues --- CHANGELOG.md | 4 ++ module.json | 6 +-- modules/component/hotbar.js | 93 +++++++++++++++------------------ modules/component/navigation.js | 20 ++++--- modules/component/players.js | 23 +++++++- package-lock.json | 4 +- package.json | 2 +- styles/component/hotbar.css | 2 +- styles/component/players.css | 5 +- 9 files changed, 89 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 066b2be..a7894e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 1.6.6 +* Bugfix: Fixed several issues with Minimal UI when using Camera views +* Compatibility: Fixed player list overlapping with other mods in general + ### 1.6.4 * Bugfix: Fixed an issue in Foundry that top buttons shadows are cut-off * Bugfix: Fixed alternating colors when locking hotbar macros diff --git a/module.json b/module.json index ae77bc6..0063c5c 100644 --- a/module.json +++ b/module.json @@ -10,10 +10,10 @@ } ], "description": "Minimal UI allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.", - "version": "1.6.5", + "version": "1.6.6", "compatibility": { "minimum": "10", - "verified": "11.305", + "verified": "11.313", "maximum": "11" }, "minimumCoreVersion": "10", @@ -49,7 +49,7 @@ ], "url": "https://github.com/saif-ellafi/foundryvtt-minimal-ui.git", "manifest": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/latest/download/module.json", - "download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/download/1.6.5/foundryvtt-minimal-ui_1.6.5.zip", + "download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/download/1.6.6/foundryvtt-minimal-ui_1.6.6.zip", "readme": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/blob/main/README.md", "license": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/blob/main/LICENSE.md", "changelog": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/blob/main/CHANGELOG.md" diff --git a/modules/component/hotbar.js b/modules/component/hotbar.js index 426b880..6f1adf2 100644 --- a/modules/component/hotbar.js +++ b/modules/component/hotbar.js @@ -1,5 +1,6 @@ import {debouncedReload, rootStyle} from '../util.js'; import '../../styles/component/hotbar.css'; +import MinimalUIPlayers from "./players"; export default class MinimalUIHotbar { @@ -17,14 +18,7 @@ export default class MinimalUIHotbar { static cssHotbarControlsMargin = '0px'; static cssHotbarCustomHotbarCompatHover = '10px'; - static cssHotbarPlayerBottom = '-5px'; - static cssHotbarPlayerBottomAdj = '60px' - - static cssHotbarPlayerBottomWinTop = '1px'; - static cssHotbarPlayerBottomAdjWinTop = '65px' - - static cssHotbarPlayerBottomWinBottom = '33px' - static cssHotbarPlayerBottomAdjWinBottom = '95px' + static cssHotbarBottomWinBottom = '33px' static htmlHotbarLockButton = ` @@ -34,7 +28,7 @@ export default class MinimalUIHotbar { ` static lockHotbar(unlock) { - if ((game.modules.get("custom-hotbar")?.active) || (game.modules.get('monks-hotbar-expansion')?.active)) + if ((game.modules.get("custom-hotbar")?.active) || (game.modules.get('monks-hotbar-expansion')?.active) || (game.webrtc.mode > 0 && game.webrtc.settings.client.dockPosition === 'bottom')) return; const barLock = $("#bar-lock > i"); if (MinimalUIHotbar.hotbarLocked && unlock) { @@ -54,76 +48,67 @@ export default class MinimalUIHotbar { let availableWidth = canvas.app?.screen.width; if (!availableWidth) return; - let webtrcAdjust = 0; - if (game.webrtc.mode > 0) - webtrcAdjust = (ui.webrtc.hidden ? 0 : ui.webrtc.position.width) - else if (game.webrtc?.mode === 0 || ui.webrtc?.hidden) - if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentTop') - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomWinTop); - else if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom') - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomWinBottom); - else - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottom); - else - if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentTop') - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomAdjWinTop); - else if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom') - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomAdjWinBottom); + let webrtcAdjust = 0; + let webrtcVAdjust = 0; + + if (game.webrtc.mode > 0 && !ui.webrtc.element.hasClass('hidden')) { + if (game.webrtc.settings.client.dockPosition === 'left') + webrtcAdjust = (ui.webrtc.hidden ? 0 : ui.webrtc.position.width) + if (game.webrtc.settings.client.dockPosition === 'bottom') { + webrtcVAdjust = 187; + } + } + + const autoHideOrLock = !game.settings.get('minimal-ui', 'hotbar') === 'autohide' || ((game.webrtc.mode > 0 && game.webrtc.settings.client.dockPosition === 'bottom') || + (game.modules.get('window-controls')?.active && + game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom')); + + if (game.modules.get('window-controls')?.active && autoHideOrLock) + if (game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom') + rootStyle.setProperty('--hotbarypos', webrtcVAdjust + 40 + 'px'); + else if (game.settings.get('window-controls', 'organizedMinimize') === 'persistentTop') + rootStyle.setProperty('--hotbarypos', webrtcVAdjust + 5 + 'px'); else - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomAdj); + rootStyle.setProperty('--hotbarypos', webrtcVAdjust + 'px'); + switch (game.settings.get('minimal-ui', 'hotbarPosition')) { case 'default': { - rootStyle.setProperty('--hotbarxpos', (330 - webtrcAdjust)+'px'); + rootStyle.setProperty('--hotbarxpos', (330 + webrtcAdjust)+'px'); break; } case 'extremeLeft': { if ( !(game.modules.get("custom-hotbar")?.active) && availableWidth >= 1200 - ) { - rootStyle.setProperty('--hotbarxpos', '8px'); - if (!(game.modules.get('sidebar-macros')?.active && game.settings.get('sidebar-macros', 'hideMacroHotbar'))) - if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentTop') - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomAdjWinTop); - else if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom') - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomAdjWinBottom); - else - rootStyle.setProperty('--playerbot', MinimalUIHotbar.cssHotbarPlayerBottomAdj); - } + ) + rootStyle.setProperty('--hotbarxpos', 8 + webrtcAdjust + 'px'); break; } case 'left': { - rootStyle.setProperty('--hotbarxpos', ((availableWidth / 2.5) - (availableWidth / 9) - (availableWidth / 9) - webtrcAdjust) + 'px'); + rootStyle.setProperty('--hotbarxpos', ((availableWidth / 2.5) - (availableWidth / 9) - (availableWidth / 9) + webrtcAdjust) + 'px'); break; } case 'center': { - rootStyle.setProperty('--hotbarxpos', ((availableWidth / 2.5) - (availableWidth / 9) - webtrcAdjust) + 'px'); + rootStyle.setProperty('--hotbarxpos', ((availableWidth / 2.5) - (availableWidth / 9) + webrtcAdjust) + 'px'); break; } case 'right': { - rootStyle.setProperty('--hotbarxpos', ((availableWidth / 2.5) - webtrcAdjust) + 'px'); + rootStyle.setProperty('--hotbarxpos', ((availableWidth / 2.5) + webrtcAdjust) + 'px'); break; } case 'manual': { - rootStyle.setProperty('--hotbarxpos', (game.settings.get('minimal-ui', 'hotbarPixelPosition') - webtrcAdjust) + 'px'); + rootStyle.setProperty('--hotbarxpos', (game.settings.get('minimal-ui', 'hotbarPixelPosition') + webrtcAdjust) + 'px'); break; } } - + MinimalUIPlayers.positionPlayers(); } static configureHotbar() { - if (game.modules.get('window-controls')?.active && - game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom') { - rootStyle.setProperty('--hotbarypos', MinimalUIHotbar.cssHotbarPlayerBottomWinBottom); - rootStyle.setProperty('--hotbarhv', MinimalUIHotbar.cssHotbarPlayerBottomWinBottom); - } else if (game.settings.get('minimal-ui', 'hotbar') === 'autohide') { + const autoHideBlocked = (game.webrtc.mode > 0 && game.webrtc.settings.client.dockPosition === 'bottom') || + (game.modules.get('window-controls')?.active && + game.settings.get('window-controls', 'organizedMinimize') === 'persistentBottom'); + if (game.settings.get('minimal-ui', 'hotbar') === 'autohide' && !autoHideBlocked) { if (!(game.modules.get("custom-hotbar")?.active || game.modules.get('monks-hotbar-expansion')?.active)) { rootStyle.setProperty('--hotbarypos', MinimalUIHotbar.cssHotbarHidden); rootStyle.setProperty('--hotbarlh1', MinimalUIHotbar.cssHotbarLeftControlsLineHeight); @@ -222,6 +207,10 @@ export default class MinimalUIHotbar { } }); + Hooks.on('renderCameraViews', function() { + MinimalUIHotbar.positionHotbar(); + }) + Hooks.once('renderHotbar', function() { const hotbarSetting = game.settings.get('minimal-ui', 'hotbar'); if (hotbarSetting === 'collapsed') diff --git a/modules/component/navigation.js b/modules/component/navigation.js index 14e4419..a33702d 100644 --- a/modules/component/navigation.js +++ b/modules/component/navigation.js @@ -11,6 +11,15 @@ export default class MinimalUINavigation { await ui.nav.collapse(); } + static positionNav() { + if (game.webrtc.mode > 0 && !ui.webrtc.element.hasClass('hidden')) + rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavNoLogoStartRtc); + else if (game.system.id === 'sfrpg') // starfinder has something, ugly fix + rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavNoLogoStartStarfinder); + else + rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavNoLogoStart); + } + static initSettings() { game.settings.register('minimal-ui', 'sceneNavigation', { @@ -95,18 +104,17 @@ export default class MinimalUINavigation { switch (game.settings.get('minimal-ui', 'foundryLogoSize')) { case 'hidden': { - if (ui.webrtc?.rendered && game.webrtc.settings.client.dockPosition === 'left') - rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavNoLogoStartRtc); - else if (game.system.id === 'sfrpg') // starfinder has something, ugly fix - rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavNoLogoStartStarfinder); - else - rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavNoLogoStart); + MinimalUINavigation.positionNav(); break; } } }); + Hooks.on('renderCameraViews', function () { + MinimalUINavigation.positionNav(); + }); + } } \ No newline at end of file diff --git a/modules/component/players.js b/modules/component/players.js index 4f6a4b8..6532fd7 100644 --- a/modules/component/players.js +++ b/modules/component/players.js @@ -1,6 +1,5 @@ import {debouncedReload, rootStyle} from '../util.js'; import '../../styles/component/players.css'; -import MinimalUIHotbar from "./hotbar"; export default class MinimalUIPlayers { @@ -10,6 +9,9 @@ export default class MinimalUIPlayers { static cssPlayersStandardFontSize = 'inherit'; static cssPlayersStandardWidth = '200px'; + static cssHotbarPlayerBottom = 5; + static cssHotbarPlayerBottomAdj = 70; + static initSettings() { game.settings.register('minimal-ui', 'playerList', { name: game.i18n.localize("MinimalUI.PlayersBehaviourName"), @@ -59,6 +61,24 @@ export default class MinimalUIPlayers { } } + static positionPlayers() { + if (!(game.modules.get('sidebar-macros')?.active && game.settings.get('sidebar-macros', 'hideMacroHotbar'))) { + let playerbot = 0; + + if (!(game.settings.get('minimal-ui', 'hotbar') === 'hidden') && game.settings.get('minimal-ui', 'hotbarPosition') === 'extremeLeft') + playerbot = MinimalUIPlayers.cssHotbarPlayerBottomAdj; + else + playerbot = MinimalUIPlayers.cssHotbarPlayerBottom; + + if (game.modules.get('window-controls')?.active && + game.settings.get('window-controls', 'organizedMinimize') === 'persistentTop') + rootStyle.setProperty('--playerbot', (playerbot - 5) + 'px'); + else + rootStyle.setProperty('--playerbot', playerbot + 'px'); + + } + } + static initHooks() { Hooks.on('renderPlayerList', async function () { @@ -72,7 +92,6 @@ export default class MinimalUIPlayers { plSize = 'standard'; plSetting = 'default'; } - MinimalUIHotbar.positionHotbar(); } switch (plSetting) { diff --git a/package-lock.json b/package-lock.json index 977aa24..58a3c2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "foundryvtt-minimal-ui", - "version": "1.6.5", + "version": "1.6.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "foundryvtt-minimal-ui", - "version": "1.6.5", + "version": "1.6.6", "license": "MIT", "dependencies": { "@rollup/plugin-json": "^4.1.0", diff --git a/package.json b/package.json index c7b69ac..3abd56e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foundryvtt-minimal-ui", - "version": "1.6.5", + "version": "1.6.6", "description": "Minimal UI allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.", "main": "minimalui.js", "scripts": { diff --git a/styles/component/hotbar.css b/styles/component/hotbar.css index 61f93e6..387469f 100644 --- a/styles/component/hotbar.css +++ b/styles/component/hotbar.css @@ -4,7 +4,7 @@ --hotbarxpos: 510px; --hotbarlh1: 24px; --hotbarlh2: 8px; - --hotbarhv: -5px; + --hotbarhv: var(--hotbarypos); --hotbarmg: 0px; --hotbarhh: 100%; --hotbarshp: 0px; diff --git a/styles/component/players.css b/styles/component/players.css index c92b9d4..b03af37 100644 --- a/styles/component/players.css +++ b/styles/component/players.css @@ -6,19 +6,18 @@ --playerslh: 20px; --playerbennies: none; --playerh3w: unset; - --playerbot: -5px; + --playerbot: 5px; --playerleft: -5px; --playerpingdisplay: initial; } #players { - bottom: var(--playerbot); + margin-bottom: var(--playerbot); left: var(--playerleft); font-size: var(--playerfsize); visibility: var(--playervis); opacity: var(--opacity); box-shadow: 0 var(--hotbarshp) var(--shadowstrength) 2px var(--shadowcolor); - position: fixed; border: 1px solid var(--bordercolor); }