From 4d9b0b9b13594d55d0a912463fc07ac2f5725017 Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Fri, 23 Apr 2021 03:24:01 +0200 Subject: [PATCH] Monks scene navigation compatibility --- CHANGELOG.md | 6 ++ module.json | 6 +- modules/component/navigation.js | 100 ++++++++++++++++++-------------- package.json | 2 +- styles/component/navigation.css | 15 +++-- 5 files changed, 78 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a87517e..0392219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### 0.8.3 +* Compatibility: Monks Scene Navigation thanks to a contribution from ironmonk88 +* Bugfix: Disabled scene preview animation for better compatibility and less strange behaviour +* Bugfix: Adjusted position of active tokens indicators in list navigation based on navigation size +* Bugfix: Adjusted spacing for scene previous based on navigation size + ### 0.8.2 * Localization: Gracias a @lozalojo por Minimal UI en EspaƱol!!! * Localization: Fixed english missing texts diff --git a/module.json b/module.json index 6139d66..d885eaf 100644 --- a/module.json +++ b/module.json @@ -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": "0.8.2", + "version": "0.8.3", "minimumCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9", "dependencies": [ @@ -25,6 +25,6 @@ } ], "url": "https://github.com/saif-ellafi/foundryvtt-minimal-ui.git", - "manifest": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/download/0.8.2/module.json", - "download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/download/0.8.2/foundryvtt-minimal-ui_0.8.2.zip" + "manifest": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/latest/download/module.json", + "download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/latest/download/foundryvtt-minimal-ui_0.8.3.zip" } diff --git a/modules/component/navigation.js b/modules/component/navigation.js index dc1ef87..130b9f6 100644 --- a/modules/component/navigation.js +++ b/modules/component/navigation.js @@ -13,6 +13,50 @@ export default class MinimalUINavigation { target.click(); } } + + static prepareScenePreview(i, sceneTab, sceneId) { + if (sceneId) { + let sceneThumbUrl = game.scenes.get(sceneId).data.thumb; + if (sceneThumbUrl) { + new Image().src = sceneThumbUrl; + $(sceneTab).append( + ` +
+ Scene Preview +
+ ` + ); + $(sceneTab).hover( + function() { + if (!$(sceneTab).hasClass('view')) { + const minimized = game.settings.get('minimal-ui', 'organizedMinimize'); + $(`#hover_preview_${i}`).show(); + if (['top', 'topBar'].includes(minimized)) { + $("#minimized-bar")?.hide(); + $(".minimized").hide(); + } + } + }, + function() { + if (!$(sceneTab).hasClass('view')) { + const minimized = game.settings.get('minimal-ui', 'organizedMinimize'); + $(`#hover_preview_${i}`).hide(); + if (['top', 'topBar'].includes(minimized)) { + const minimized = $(".minimized"); + if (minimized.length > 0) { + $("#minimized-bar")?.show(); + minimized.show(); + } + } + } + } + ); + } + } + } static initSettings() { @@ -102,12 +146,14 @@ export default class MinimalUINavigation { case 'standard': { rootStyle.setProperty('--navilh', '32px'); rootStyle.setProperty('--navifs', '16px'); + rootStyle.setProperty('--navilisttop', '24px'); rootStyle.setProperty('--navibuttonsize', '34px'); break; } case 'big': { rootStyle.setProperty('--navilh', '40px'); rootStyle.setProperty('--navifs', '20px'); + rootStyle.setProperty('--navilisttop', '30px'); rootStyle.setProperty('--navibuttonsize', '43px'); break; } @@ -120,51 +166,21 @@ export default class MinimalUINavigation { switch(game.settings.get('minimal-ui', 'sceneNavigationPreview')) { case 'hover': { if (game.user.isGM) { + // Compatibility: Includes class type scene list for compatibility with Monks Scene Navigation let sceneTabs = $("#scene-list li,.scene-list li"); - rootStyle.setProperty('--navithumbmarg', '10px'); + if (game.modules.get('monks-scene-navigation')?.active) { + if (game.settings.get('minimal-ui', 'sceneNavigationSize') === 'small') + rootStyle.setProperty('--navithumbmarg', '15px'); + else if (game.settings.get('minimal-ui', 'sceneNavigationSize') === 'standard') + rootStyle.setProperty('--navithumbmarg', '26px'); + else + rootStyle.setProperty('--navithumbmarg', '32px'); + } else { + rootStyle.setProperty('--navithumbmarg', '10px'); + } sceneTabs.each(function(i, sceneTab) { let sceneId = $(sceneTab).attr('data-scene-id'); - if (sceneId) { - let sceneThumbUrl = game.scenes.get(sceneId).data.thumb; - if (sceneThumbUrl) { - new Image().src = sceneThumbUrl; - $(sceneTab).append( - ` -
- Scene Preview -
- ` - ); - $(sceneTab).hover( - function() { - if (!$(sceneTab).hasClass('view')) { - const minimized = game.settings.get('minimal-ui', 'organizedMinimize'); - $(`#hover_preview_${i}`).show(200); - if (['top', 'topBar'].includes(minimized)) { - $("#minimized-bar")?.hide(); - $(".minimized").hide(); - } - } - }, - function() { - if (!$(sceneTab).hasClass('view')) { - const minimized = game.settings.get('minimal-ui', 'organizedMinimize'); - $(`#hover_preview_${i}`).fadeOut(10); - if (['top', 'topBar'].includes(minimized)) { - const minimized = $(".minimized"); - if (minimized.length > 0) { - $("#minimized-bar")?.show(); - minimized.show(); - } - } - } - } - ); - } - } + MinimalUINavigation.prepareScenePreview(i, sceneTab, sceneId); }); } break; diff --git a/package.json b/package.json index d6e61a2..5602d08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foundryvtt-minimal-ui", - "version": "0.8.2", + "version": "0.8.3", "description": "Minimal UI allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.", "main": "minimalui.js", "scripts": { diff --git a/styles/component/navigation.css b/styles/component/navigation.css index 00f4633..b64ddb9 100644 --- a/styles/component/navigation.css +++ b/styles/component/navigation.css @@ -3,6 +3,7 @@ --navixpos: 125px; --navilh: 20px; --navifs: 14px; + --navilisttop: 16px; --navibuttonsize: 23px; --navithumbmarg: 10px; } @@ -23,7 +24,7 @@ } #navigation #scene-list .scene ul.scene-players { - top: 16px; + top: var(--navilisttop); } #navigation #scene-list .scene.view, #navigation #scene-list .scene.context { @@ -42,6 +43,8 @@ box-shadow: 0 0 var(--shadowstrength) var(--shadowcolor); } +/** COMPATIBILITY: Monks Scene Navigation */ + #navigation .monks-scene-navigation{ flex: 0 0 var(--navilh); height: var(--navilh); @@ -55,15 +58,15 @@ line-height: var(--navilh); height: var(--navilh); font-size: var(--navifs); - padding:0px 4px; + padding:0 4px; } #navigation .monks-scene-navigation .scene-list > li.nav-item ul.scene-players{ - top:16px; + top: var(--navilisttop); } #navigation .monks-scene-navigation .scene-list > li.nav-item.folder a{ - padding-top:0px; + padding-top:0; border-top:1px; } @@ -77,4 +80,6 @@ #navigation .monks-scene-navigation .scene-list > li.nav-item .navi-preview{ top: calc(var(--navithumbmarg) + 15px); -} \ No newline at end of file +} + +/** --------------- */ \ No newline at end of file