From 7aa385b167296bfb780003e787fb461913ee2d02 Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Sat, 6 Mar 2021 02:12:14 +0100 Subject: [PATCH] Added configurable left side controls size --- minimalui.css | 8 ++++---- minimalui.js | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/minimalui.css b/minimalui.css index 495cc49..7885c88 100644 --- a/minimalui.css +++ b/minimalui.css @@ -88,10 +88,6 @@ margin-top: var(--leftbarpos); } -#controls .control-tools { - left: 40px; -} - #controls .scene-control.active, #controls .scene-control:hover { border: 1px solid red; color: orange; @@ -103,6 +99,10 @@ } #controls .scene-control, #controls .control-tool { + border: 0px solid #000; +} + +#controls > .small-left-panel, #controls > .small-left-panel .small-left-panel { width: 25px; height: 28px; font-size: 15px; diff --git a/minimalui.js b/minimalui.js index dc1e8b1..cbc6003 100644 --- a/minimalui.js +++ b/minimalui.js @@ -69,6 +69,22 @@ Hooks.on('init', () => { } }); + game.settings.register('minimal-ui', 'sidePanelSize', { + name: "Left panel size", + hint: "Choose favorite side panel size.", + scope: 'world', + config: true, + type: String, + choices: { + "small": "Small", + "standard": "Standard" + }, + default: "small", + onChange: value => { + window.location.reload() + } + }); + game.settings.register('minimal-ui', 'sidePanelPosition', { name: "Left panel button position", hint: "Choose favorite side panel position. Find the best for you, as it depends on the resolution and pixel density", @@ -161,10 +177,29 @@ Hooks.on('renderSceneControls', async function() { let rootStyle = document.querySelector(':root').style; + 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'}) + } + } + switch(game.settings.get('minimal-ui', 'sidePanelPosition')) { case 'top': { rootStyle.setProperty('--leftbarpos', '0vmin'); - rootStyle.setProperty('--navistart', '45px'); + if ((game.settings.get('minimal-ui', 'sidePanelSize') == 'small')) { + if (game.settings.get('minimal-ui', 'sidePanelMenuStyle') == 'column') { + rootStyle.setProperty('--navistart', '45px'); + } else { + rootStyle.setProperty('--navistart', '75px'); + } + } else { + if (game.settings.get('minimal-ui', 'sidePanelMenuStyle') == 'column') { + rootStyle.setProperty('--navistart', '55px'); + } else { + rootStyle.setProperty('--navistart', '100px'); + } + } break; } case 'center': {