From 0c29c3b1273d0c6954142ef561fb6360875b8c39 Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Mon, 8 Mar 2021 17:43:06 +0100 Subject: [PATCH] Fixed behavior and hover detection of autohide and stability of visible components --- CHANGELOG.md | 6 ++++++ minimalui.css | 8 +++++--- minimalui.js | 32 +++++++++++++++++++------------- module.json | 2 +- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b820e24..88a7d9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### 0.2.2 +* Bugfix: Fixed a wrong border-width setting causing unwanted shakes (Thanks @SoulCake) +* Bugfix: Left submenu should now appear visible and stay in fixed position +* Bugfix: Fixed hover area not being detected with small icons in some displays (Thanks @Drew for reporting) +* Bugfix: Left side submenu controls don't move when hovering anymore + ### 0.2.1 * Bugfix: Clicking on submenus directly now locks the left controls * Bugfix: Improved compatibility across combinations of settings diff --git a/minimalui.css b/minimalui.css index 9f6e695..a4b907d 100644 --- a/minimalui.css +++ b/minimalui.css @@ -9,8 +9,9 @@ --hotbaranim2: 1px; --navistart: 10px; --leftbarstart: 0px; - --leftbarstartsub: -50px; - --submenuhover: 60px + --leftbarstartsub: 60px; + --submenuhover: 60px; + --leftbarpad: 10px; } #logo { @@ -93,11 +94,13 @@ border-right: 1px solid #ff4900bd; box-shadow: 3px 0px 10px 0px #ff4900bd; transition: 0.1s; + padding-right: var(--leftbarpad); } #controls:hover { left: 0px; transition: 0.5s; + padding-right: 10px; } #controls .scene-control.active, #controls .scene-control:hover { @@ -122,7 +125,6 @@ margin: 2px 0px 0px; box-sizing: content-box; border-radius: 5px; - border-width: 0px; } #controls .active .control-tools { diff --git a/minimalui.js b/minimalui.js index e1de363..352a4ee 100644 --- a/minimalui.js +++ b/minimalui.js @@ -14,9 +14,9 @@ function lockControls(unlock) { controlsLastPos = rootStyle.getPropertyValue('--leftbarstart'); rootStyle.setProperty('--leftbarstart', '0px'); if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { - rootStyle.setProperty('--leftbarstartsub', '55px'); + rootStyle.setProperty('--leftbarstartsub', '50px'); } else { - rootStyle.setProperty('--leftbarstartsub', '65px'); + rootStyle.setProperty('--leftbarstartsub', '60px'); } $("#sidebar-lock > i").removeClass("fa-lock-open"); $("#sidebar-lock > i").addClass("fa-lock"); @@ -25,10 +25,9 @@ function lockControls(unlock) { $("#sidebar-lock > i").removeClass("fa-lock"); $("#sidebar-lock > i").addClass("fa-lock-open"); rootStyle.setProperty('--leftbarstart', controlsLastPos); + rootStyle.setProperty('--leftbarstartsub', '-50px'); if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { - rootStyle.setProperty('--leftbarstartsub', '-50px'); - } else { - rootStyle.setProperty('--leftbarstartsub', '-50px'); + rootStyle.setProperty('--leftbarpad', '20px'); } controlsLastPos = controlsLastPos; @@ -223,17 +222,24 @@ Hooks.on('renderSceneControls', async function() { let rootStyle = document.querySelector(':root').style; + if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { + rootStyle.setProperty('--leftbarstartsub', '50px'); + rootStyle.setProperty('--submenuhover', '50px'); + if (game.settings.get('minimal-ui', 'sidePanel') == 'autohide') { + rootStyle.setProperty('--leftbarpad', '20px'); + } + } else { + rootStyle.setProperty('--leftbarstartsub', '60px'); + rootStyle.setProperty('--submenuhover', '60px'); + } + switch(game.settings.get('minimal-ui', 'sidePanel')) { case 'autohide': { - if (!controlsLocked && game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { - rootStyle.setProperty('--leftbarstart', '-40px'); - } else if (!controlsLocked) { - rootStyle.setProperty('--leftbarstart', '-52px'); - } - if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { - rootStyle.setProperty('--submenuhover', '55px'); + if (!controlsLocked) { + rootStyle.setProperty('--leftbarstart', '-50px'); + rootStyle.setProperty('--leftbarstartsub', '-50px'); } else { - rootStyle.setProperty('--submenuhover', '65px'); + rootStyle.setProperty('--leftbarpad', '10px'); } break; } diff --git a/module.json b/module.json index 17f93be..4a1990c 100644 --- a/module.json +++ b/module.json @@ -3,7 +3,7 @@ "title": "Minimal UI", "author": "JeansenVaars#2857", "description": "Minimal UI reduces size of Foundry interface and allows hiding or collapsing specific parts.", - "version": "0.2.1", + "version": "0.2.2", "minimumCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9", "scripts": [ "minimalui.js" ],