Skip to content

Commit

Permalink
Fixed bug introduced in 1.1.6 about Hotbar
Browse files Browse the repository at this point in the history
  • Loading branch information
saif-ellafi committed Nov 20, 2021
1 parent 3ebb2f3 commit c4c7fce
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 52 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### 1.1.7
* Bugfix: Fixed Macro Hotbar forgetting position after setting change broken in 1.1.6

### 1.1.6
* Bugfix: Made first time launch transitions smoother and less bumpy
* Bugfix: Minor event order corrections and optimizations

### 1.1.5
* Enhancement: Patched foundry so already opened windows are brought to the front if they are behind other windows when reopened

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.1.5",
"version": "1.1.7",
"minimumCoreVersion": "0.8.9",
"compatibleCoreVersion": "0.8.9",
"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.1.5/foundryvtt-minimal-ui_1.1.5.zip"
"download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/download/1.1.7/foundryvtt-minimal-ui_1.1.7.zip"
}
11 changes: 4 additions & 7 deletions modules/component/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,12 @@ export default class MinimalUIControls {
}

static initHooks() {
Hooks.once('renderSceneControls', async function () {
MinimalUIControls.sizeControls();
})

Hooks.on('canvasPan', function () {
Hooks.once('ready', function () {
MinimalUIControls.positionSidebar();
});
})

Hooks.once('renderSceneControls', async function () {
Hooks.once('renderSceneControls', function () {
MinimalUIControls.sizeControls();

switch (game.settings.get('minimal-ui', 'controlsStyle')) {
case 'default': {
Expand Down
32 changes: 12 additions & 20 deletions modules/component/hotbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ export default class MinimalUIHotbar {
</a>
`

static collapseHotbar(toggleId) {
let target = document.getElementById(toggleId);
if (target) {
target.click();
}
static async collapseHotbar(toggleId) {
await ui.hotbar.collapse();
}

static lockHotbar(unlock) {
Expand All @@ -47,7 +44,7 @@ export default class MinimalUIHotbar {
}

static positionHotbar() {
let availableWidth = parseInt($("#board").css('width'));
let availableWidth = canvas.app.screen.width;
switch (game.settings.get('minimal-ui', 'hotbarPosition')) {
case 'default': {
rootStyle.setProperty('--hotbarxpos', '220px');
Expand Down Expand Up @@ -142,7 +139,7 @@ export default class MinimalUIHotbar {
config: true,
type: String,
choices: {
"shown": game.i18n.localize("MinimalUI.SettingsStartVisible"),
"shown": game.i18n.localize("MinimalUI.SettingsAlwaysVisible"),
"autohide": game.i18n.localize("MinimalUI.SettingsAutoHide"),
"collapsed": game.i18n.localize("MinimalUI.SettingsCollapsed"),
"onlygm": game.i18n.localize("MinimalUI.SettingsOnlyGM"),
Expand Down Expand Up @@ -196,14 +193,9 @@ export default class MinimalUIHotbar {
}

static initHooks() {
Hooks.on('canvasPan', function () {
MinimalUIHotbar.positionHotbar();
});

Hooks.once('ready', async function () {

Hooks.on('ready', async function() {
ui.hotbar.element.hide();
MinimalUIHotbar.positionHotbar();

if (game.settings.get('minimal-ui', 'hotbar') !== 'hidden') {
const gmCondition = game.settings.get('minimal-ui', 'hotbar') === 'onlygm';
if (gmCondition) {
Expand All @@ -212,16 +204,16 @@ export default class MinimalUIHotbar {
} else
rootStyle.setProperty('--hotbarvis', 'visible');
}

// Give time to auto-hide initial animations to finish
if (game.settings.get('minimal-ui', 'playerList') === 'autohide')
await new Promise(waitABit => setTimeout(waitABit, 50));
ui.hotbar.element.show();
});

Hooks.on('renderHotbar', async function () {

Hooks.on('renderHotbar', function () {
MinimalUIHotbar.configureHotbar();

MinimalUIHotbar.setHotbarSlots();

})
});

}

Expand Down
25 changes: 10 additions & 15 deletions modules/component/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ export default class MinimalUINavigation {
static cssSceneNavSmallLogoStart = '75px';
static cssSceneNavBullseyeStart = '125px';

static collapseNavigation() {
let target = document.getElementById("nav-toggle");
if (target) {
target.click();
}
static async collapseNavigation() {
await ui.nav.collapse();
}

static initSettings() {
Expand Down Expand Up @@ -58,11 +55,17 @@ export default class MinimalUINavigation {
}
}

// Compatibility Workaround for bullseye module
if (game.modules.has('bullseye') && game.modules.get('bullseye').active) {
rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavBullseyeStart);
}
});

Hooks.once('renderSceneNavigation', async function () {

switch (game.settings.get('minimal-ui', 'sceneNavigation')) {
case 'collapsed': {
await new Promise(waitABit => setTimeout(waitABit, 10));
MinimalUINavigation.collapseNavigation();
await new Promise(waitABit => setTimeout(waitABit, 250));
rootStyle.setProperty('--navivis', 'visible');
break;
}
Expand All @@ -72,14 +75,6 @@ export default class MinimalUINavigation {
}
}

// Compatibility Workaround for bullseye module
if (game.modules.has('bullseye') && game.modules.get('bullseye').active) {
rootStyle.setProperty('--navixpos', MinimalUINavigation.cssSceneNavBullseyeStart);
}
});

Hooks.once('renderSceneNavigation', async function () {

switch (game.settings.get('minimal-ui', 'sceneNavigationSize')) {
case 'standard': {
rootStyle.setProperty('--navilh', '32px');
Expand Down
8 changes: 5 additions & 3 deletions modules/component/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ export default class MinimalUISidebar {
break;
}
case 'collapsed': {
await new Promise(waitABit => setTimeout(waitABit, 100));
await ui.sidebar.collapse();
await new Promise(waitABit => setTimeout(waitABit, 400));
ui.sidebar.element.hide();
ui.sidebar.collapse();
// wait for animation to finish
await new Promise(waitABit => setTimeout(waitABit, 600));
rootStyle.setProperty('--controlsvis', 'visible');
ui.sidebar.element.fadeIn('slow');
break;
}
default: {
Expand Down
4 changes: 2 additions & 2 deletions 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.1.5",
"version": "1.1.7",
"description": "Minimal UI allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.",
"main": "minimalui.js",
"scripts": {
Expand Down
2 changes: 0 additions & 2 deletions styles/component/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

#sidebar.collapsed {
opacity: var(--opacity);
transition: 0.05s ease-out 0.5s;
}

#sidebar.collapsed:hover {
opacity: 100%;
transition: 0.05s;
}

#sidebar-tabs {
Expand Down

0 comments on commit c4c7fce

Please sign in to comment.