Skip to content

Commit

Permalink
Fixed behavior and hover detection of autohide and stability of visib…
Browse files Browse the repository at this point in the history
…le components
  • Loading branch information
saif-ellafi committed Mar 8, 2021
1 parent 7eecb5f commit 0c29c3b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 5 additions & 3 deletions minimalui.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
--hotbaranim2: 1px;
--navistart: 10px;
--leftbarstart: 0px;
--leftbarstartsub: -50px;
--submenuhover: 60px
--leftbarstartsub: 60px;
--submenuhover: 60px;
--leftbarpad: 10px;
}

#logo {
Expand Down Expand Up @@ -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 {
Expand All @@ -122,7 +125,6 @@
margin: 2px 0px 0px;
box-sizing: content-box;
border-radius: 5px;
border-width: 0px;
}

#controls .active .control-tools {
Expand Down
32 changes: 19 additions & 13 deletions minimalui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" ],
Expand Down

0 comments on commit 0c29c3b

Please sign in to comment.