diff --git a/CHANGELOG.md b/CHANGELOG.md index 8efba7d..b820e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 0.2.1 +* Bugfix: Clicking on submenus directly now locks the left controls +* Bugfix: Improved compatibility across combinations of settings + ### 0.2.0 * Enhancement: Left control bar may now be auto-hidden and shown on mouse over * Enhancement: Left control bar now supports small or big size diff --git a/minimalui.css b/minimalui.css index 101d942..9f6e695 100644 --- a/minimalui.css +++ b/minimalui.css @@ -9,6 +9,8 @@ --hotbaranim2: 1px; --navistart: 10px; --leftbarstart: 0px; + --leftbarstartsub: -50px; + --submenuhover: 60px } #logo { @@ -125,11 +127,11 @@ #controls .active .control-tools { display: var(--submenustyle); - left: -50px; + left: var(--leftbarstartsub); transition: 0.5s; } #controls:hover .active .control-tools { display: var(--submenustyle); - left: 65px; + left: var(--submenuhover); } \ No newline at end of file diff --git a/minimalui.js b/minimalui.js index 3303935..e1de363 100644 --- a/minimalui.js +++ b/minimalui.js @@ -13,6 +13,11 @@ function lockControls(unlock) { controlsLocked = true; controlsLastPos = rootStyle.getPropertyValue('--leftbarstart'); rootStyle.setProperty('--leftbarstart', '0px'); + if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { + rootStyle.setProperty('--leftbarstartsub', '55px'); + } else { + rootStyle.setProperty('--leftbarstartsub', '65px'); + } $("#sidebar-lock > i").removeClass("fa-lock-open"); $("#sidebar-lock > i").addClass("fa-lock"); } else if (unlock) { @@ -20,6 +25,12 @@ function lockControls(unlock) { $("#sidebar-lock > i").removeClass("fa-lock"); $("#sidebar-lock > i").addClass("fa-lock-open"); rootStyle.setProperty('--leftbarstart', controlsLastPos); + if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { + rootStyle.setProperty('--leftbarstartsub', '-50px'); + } else { + rootStyle.setProperty('--leftbarstartsub', '-50px'); + } + controlsLastPos = controlsLastPos; } } @@ -219,6 +230,11 @@ Hooks.on('renderSceneControls', async function() { } else if (!controlsLocked) { rootStyle.setProperty('--leftbarstart', '-52px'); } + if (game.settings.get('minimal-ui', 'sidePanelSize') == 'small') { + rootStyle.setProperty('--submenuhover', '55px'); + } else { + rootStyle.setProperty('--submenuhover', '65px'); + } break; } } @@ -226,7 +242,6 @@ Hooks.on('renderSceneControls', async function() { switch(game.settings.get('minimal-ui', 'sidePanelSize')) { case 'small': { $("#controls .scene-control, #controls .control-tool").addClass('small-left-panel'); - $("#controls .control-tools").css({'left': '40px'}) } } @@ -278,7 +293,13 @@ Hooks.on('renderSceneControls', async function() { let locked = controlsLocked ? 'fa-lock' : 'fa-lock-open'; - $("#controls > li.scene-control").on('click', function() {lockControls(false)}); + $("#controls > li.scene-control").on('click', function() { + lockControls(false) + $("#controls > li.scene-control.active > ol > li").on('click', function() {lockControls(false)}); + }); + $("#controls > li.scene-control.active > ol > li").on('click', function() { + lockControls(false) + }); // To consider: Hide after selecting sub-tool? // $("#controls > li.scene-control.active > ol > li.control-tool").on('click', function() {lockControls(true)}); diff --git a/module.json b/module.json index bcc10e4..17f93be 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.0", + "version": "0.2.1", "minimumCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9", "scripts": [ "minimalui.js" ],