Skip to content

Commit

Permalink
Fix FPS, auto hide plus mode
Browse files Browse the repository at this point in the history
  • Loading branch information
saif-ellafi committed Dec 21, 2021
1 parent 8084ecd commit 4d978d3
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 1.3.1
* Enhancement: New Left Controls Behavior (experimental) - Auto-Hide Plus hides all non-active sub controls
* Bugfix: Fixed FPS Indicator on the wrong position (Thanks GambitTV)
* Bugfix: Fixed Macro Hotbar position when not in auto hide mode

### 1.3.0
* Enhancement: Adjusted all components to be closer to the edge of the screen
* Enhancement: Revised defaults for a refreshing minimal look and feel (See Screenshot)
Expand Down
1 change: 1 addition & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"MinimalUI.SettingsStartVisible": "Starte sichtbar",
"MinimalUI.SettingsPartiallyVisible": "Teilweise sichtbar",
"MinimalUI.SettingsAutoHide": "Automatisch verstecken",
"MinimalUI.SettingsAutoHidePlus": "Automatisch verstecken Plus",
"MinimalUI.SettingsCollapsed": "Starte eingeklappt",
"MinimalUI.SettingsOnlyGM": "Nur für die SL sichtbar",
"MinimalUI.SettingsHide": "Komplett versteckt",
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"MinimalUI.SettingsStartVisible": "Start Visible",
"MinimalUI.SettingsPartiallyVisible": "Partially Visible",
"MinimalUI.SettingsAutoHide": "Auto-Hide",
"MinimalUI.SettingsAutoHidePlus": "Auto-Hide Plus",
"MinimalUI.SettingsCollapsed": "Start Collapsed",
"MinimalUI.SettingsOnlyGM": "Visible to GM Only",
"MinimalUI.SettingsHide": "Hide Completely",
Expand Down
1 change: 1 addition & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"MinimalUI.SettingsStartVisible": "Iniciar Visible",
"MinimalUI.SettingsPartiallyVisible": "Parcialmente Visible",
"MinimalUI.SettingsAutoHide": "Auto-ocultar",
"MinimalUI.SettingsAutoHidePlus": "Auto-ocultar Plus",
"MinimalUI.SettingsCollapsed": "Iniciar plegado",
"MinimalUI.SettingsOnlyGM": "Visible solo al DM",
"MinimalUI.SettingsHide": "Ocultar por completo",
Expand Down
4 changes: 2 additions & 2 deletions 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 allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.",
"version": "1.3.0",
"version": "1.3.1",
"minimumCoreVersion": "9.233",
"compatibleCoreVersion": "9.238",
"dependencies": [
Expand All @@ -30,5 +30,5 @@
],
"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.3.0/foundryvtt-minimal-ui_1.3.0.zip"
"download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/download/1.3.1/foundryvtt-minimal-ui_1.3.1.zip"
}
41 changes: 36 additions & 5 deletions modules/component/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import '../../styles/component/controls.css';

export default class MinimalUIControls {

static delayedProcessing = false;

static cssControlsStandardWidth = '36px';
static cssControlsStandardHeight = '30px';
static cssControlsStandardLineHeight = '30px';
Expand All @@ -19,6 +21,8 @@ export default class MinimalUIControls {
static showSubControls() {
if (game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide') {
rootStyle.setProperty('--controlssubop', '0%');
} else if (game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide-plus') {
rootStyle.setProperty('--controlssubopna', '0%');
}
}

Expand Down Expand Up @@ -60,6 +64,7 @@ export default class MinimalUIControls {
type: String,
choices: {
"autohide": game.i18n.localize("MinimalUI.SettingsAutoHide"),
"autohide-plus": game.i18n.localize("MinimalUI.SettingsAutoHidePlus"),
"visible": game.i18n.localize("MinimalUI.SettingsAlwaysVisible")
},
default: "autohide",
Expand All @@ -72,15 +77,41 @@ export default class MinimalUIControls {
MinimalUIControls.sizeControls();
});
Hooks.on('renderSceneControls', function() {
if (game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide') {
function controlsSubHoverRefresh() {
setTimeout(() => {
const activeElement = $('#controls');
if (activeElement.length && !activeElement.is(':hover') && game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide-plus') {
rootStyle.setProperty('--controlssubdisna', 'none');
MinimalUIControls.delayedProcessing = false;
} else controlsSubHoverRefresh();
}, 6000)
}
function controlsSubClickRefresh() {
setTimeout(() => {
if (game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide')
rootStyle.setProperty('--controlssubop', '0%');
if (game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide-plus') {
controlsSubHoverRefresh();
}
rootStyle.setProperty('--opacitycontrols', game.settings.get("minimal-ui", "transparencyPercentage") + '%');
}, 3000)
}
if (['autohide', 'autohide-plus'].includes(game.settings.get('minimal-ui', 'controlsSubHide'))) {
$('#controls li').click(() => {
rootStyle.setProperty('--controlssubop', '100%');
rootStyle.setProperty('--controlssubopna', '100%');
rootStyle.setProperty('--opacitycontrols', '100%');
setTimeout(() => {
rootStyle.setProperty('--controlssubop', '0%');
rootStyle.setProperty('--opacitycontrols', game.settings.get("minimal-ui", "transparencyPercentage") + '%');
}, 3000);
rootStyle.setProperty('--controlssubdisna', 'block');
controlsSubClickRefresh();
});
if (game.settings.get('minimal-ui', 'controlsSubHide') === 'autohide-plus') {
$('#controls li').hover(() => {
if (MinimalUIControls.delayedProcessing) return;
MinimalUIControls.delayedProcessing = true;
rootStyle.setProperty('--controlssubdisna', 'block');
controlsSubHoverRefresh();
});
}
}
});
};
Expand Down
13 changes: 12 additions & 1 deletion modules/component/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class MinimalUISidebar {
sidebarElem.css('--sidebar-tab-height', newHeight + 'px');
switch (game.settings.get('minimal-ui', 'rightcontrolsBehaviour')) {
case 'shown': {
rootStyle.setProperty('--fpsvis', 'unset');
rootStyle.setProperty('--controlsvis', 'visible');
break;
}
Expand All @@ -39,11 +40,21 @@ export default class MinimalUISidebar {
break;
}
default: {
rootStyle.setProperty('--fpsvis', 'unset');
rootStyle.setProperty('--controlsvis', 'visible');
break;
}
}
});

Hooks.on('collapseSidebar', function(_, isCollapsing) {
console.log(isCollapsing);
if (isCollapsing) {
rootStyle.setProperty('--fpsposx', '-5px');
rootStyle.setProperty('--fpsvis', 'unset');
} else {
rootStyle.setProperty('--fpsposx', '300px');
rootStyle.setProperty('--fpsvis', 'unset');
}
});
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "foundryvtt-minimal-ui",
"version": "1.3.0",
"version": "1.3.1",
"description": "Minimal UI allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.",
"main": "minimalui.js",
"scripts": {
Expand Down
15 changes: 14 additions & 1 deletion styles/component/controls.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
--controlssubmargin: 0;
--opacitycontrols: 75%;
--controlssubop: 100%;
--controlssubopna: 100%;
--controlssubdisna: block;
}

#controls {
Expand Down Expand Up @@ -33,15 +35,26 @@
border: 1px solid transparent;
}

#controls ol .scene-control:not(.active), #controls ol .control-tool:not(.active) {
transition: 2s;
opacity: var(--controlssubopna);
display: var(--controlssubdisna);
}

#controls:hover ol .scene-control:not(.active), #controls:hover ol .control-tool:not(.active) {
transition: 0.5s;
opacity: 100%;
}

#controls ol .scene-control.active, #controls ol .control-tool.active, #controls ol .scene-control:hover, #controls ol .control-tool:hover {
border: 1px solid var(--bordercolor);
box-shadow: 0 var(--hotbarshp) var(--shadowstrength) 2px var(--shadowcolor);
}

#controls ol.sub-controls.active {
opacity: var(--controlssubop);
margin-left: var(--controlssubmargin);
transition: 2s;
opacity: var(--controlssubop);
display: grid;
}

Expand Down
4 changes: 2 additions & 2 deletions styles/component/hotbar.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
:root {
--hotbarvis: hidden;
--hotbarypos: 10px;
--hotbarypos: -5px;
--hotbarxpos: 400px;
--hotbarlh1: 24px;
--hotbarlh2: 8px;
--hotbarhv: 10px;
--hotbarhv: -5px;
--hotbarmg: 0px;
--hotbarhh: 100%;
--hotbarshp: 0px;
Expand Down
7 changes: 7 additions & 0 deletions styles/component/sidebar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:root {
--controlsvis: hidden;
--fpsvis: hidden;
}

#sidebar {
Expand Down Expand Up @@ -37,3 +38,9 @@
#sidebar-tabs > a:nth-child(n):hover {
text-shadow: 0 0 var(--shadowstrength) var(--bordercolor);
}

#fps {
position: absolute;
right: var(--fpsposx);
visibility: var(--fpsvis);
}
1 change: 1 addition & 0 deletions styles/customization/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
--shadowcolor: #ff4900bd;
--shadowstrength: 10px;
--opacity: 75%;
--fpsposx: 300px;
}

.minui-lock {
Expand Down

0 comments on commit 4d978d3

Please sign in to comment.