Skip to content

Commit

Permalink
Improved compatibility and behavior of various configuration combinat…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
saif-ellafi committed Mar 6, 2021
1 parent 14a07e0 commit 7eecb5f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions minimalui.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
--hotbaranim2: 1px;
--navistart: 10px;
--leftbarstart: 0px;
--leftbarstartsub: -50px;
--submenuhover: 60px
}

#logo {
Expand Down Expand Up @@ -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);
}
25 changes: 23 additions & 2 deletions minimalui.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ 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) {
controlsLocked = false;
$("#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;
}
}
Expand Down Expand Up @@ -219,14 +230,18 @@ 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;
}
}

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'})
}
}

Expand Down Expand Up @@ -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)});
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.0",
"version": "0.2.1",
"minimumCoreVersion": "0.7.9",
"compatibleCoreVersion": "0.7.9",
"scripts": [ "minimalui.js" ],
Expand Down

0 comments on commit 7eecb5f

Please sign in to comment.