diff --git a/CHANGELOG.md b/CHANGELOG.md index 0392219..baadf73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### 0.8.4 +* Enhancement: Minimize+ Setting "Right Click" on a minimized window gives them border color +* Enhancement: Minimize+ Setting Mouse over minimized windows gives them shadow color +* Compatibility: Search Anywhere "hand" now hidden in Organized Minimize mode when minimized +* Bugfix: Organized Minimize returns windows to their original position when restored/maximized +* Bugfix: Organized Minimize removed unwanted movement when moving windows along the axis +* Bugfix: Sub controls menu adjusted to avoid unwanted shaking animation + + ### 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 diff --git a/lang/en.json b/lang/en.json index 810187d..90f5bef 100644 --- a/lang/en.json +++ b/lang/en.json @@ -85,12 +85,15 @@ "MinimalUI.DynamicUIHint": "Auto hides UI elements after 60 seconds of chat inactivity when controlling tokens or changing scenes.", "MinimalUI.OrganizedMinimizeName": "MINIMAL UI Organized Minimize", - "MinimalUI.OrganizedMinimizeHint": "This option may help you organize those minimized windows by placing them either on a bottom line or top bar.", + "MinimalUI.OrganizedMinimizeHint": "Organize minimized windows by placing them either on a bottom line or top bar.", "MinimalUI.OrganizedMinimizeBottom": "Bottom", "MinimalUI.OrganizedMinimizeBottomBar": "Bottom with Bar", "MinimalUI.OrganizedMinimizeTop": "Top", "MinimalUI.OrganizedMinimizeTopBar": "Top with Bar", + "MinimalUI.EnrichedMinimizeName": "MINIMAL UI Organized Minimize+", + "MinimalUI.EnrichedMinimizeHint": "Pin minimized windows with Right Click and highlight on mouse over", + "MinimalUI.PinSidebar": "Pin Controls" } \ No newline at end of file diff --git a/lang/es.json b/lang/es.json index 643b941..b6c8e83 100644 --- a/lang/es.json +++ b/lang/es.json @@ -85,12 +85,15 @@ "MinimalUI.DynamicUIHint": "Oculta automáticamente los elementos de la UI tras 60 segundos de inactividad cuando se está controlando algún icono o navegando entre escenas", "MinimalUI.OrganizedMinimizeName": "Modo organizado MINIMAL", - "MinimalUI.OrganizedMinimizeHint": "Esta opción le ayudará a organizar las ventanas que minimice, al colocarlas o bien en una franja en la parte inferior o superior", + "MinimalUI.OrganizedMinimizeHint": "Organiza las ventanas que minimice, al colocarlas o bien en una franja en la parte inferior o superior", "MinimalUI.OrganizedMinimizeBottom": "Abajo", "MinimalUI.OrganizedMinimizeBottomBar": "Abajo con barra", "MinimalUI.OrganizedMinimizeTop": "Arriba", "MinimalUI.OrganizedMinimizeTopBar": "Arriba con barra", + "MinimalUI.EnrichedMinimizeName": "Modo organizado MINIMAL+", + "MinimalUI.EnrichedMinimizeHint": "Fijar ventanas minimizadas con click derecho y resaltar al pasar por encima", + "MinimalUI.PinSidebar": "Controles de chincheta" } \ No newline at end of file diff --git a/module.json b/module.json index d885eaf..8cb3517 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.3", + "version": "0.8.4", "minimumCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9", "dependencies": [ @@ -26,5 +26,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/latest/download/foundryvtt-minimal-ui_0.8.3.zip" + "download": "https://github.com/saif-ellafi/foundryvtt-minimal-ui/releases/latest/download/foundryvtt-minimal-ui_0.8.4.zip" } diff --git a/modules/component/controls.js b/modules/component/controls.js index 57f2624..b347b05 100644 --- a/modules/component/controls.js +++ b/modules/component/controls.js @@ -11,9 +11,9 @@ export default class MinimalUIControls { static cssControlsHiddenPositionSmall = '-62px'; static cssControlsHiddenPositionStandard = '-72px'; - static cssControlsSubMenuSmall = '55px'; - static cssControlsSubMenuStandard = '65px'; - static cssControlsSubMenuDndUi = '65px'; + static cssControlsSubMenuSmall = '48px'; + static cssControlsSubMenuStandard = '58px'; + static cssControlsSubMenuDndUi = '58px'; static cssControlsPaddingDefault = '7px'; static cssControlsPaddingSmall = '26px'; diff --git a/modules/feature/minimize.js b/modules/feature/minimize.js index 0198d55..bcd254a 100644 --- a/modules/feature/minimize.js +++ b/modules/feature/minimize.js @@ -18,6 +18,7 @@ export default class MinimalUIMinimize { .minimized { ${rule}: ${measure} !important; width: ${MinimalUIMinimize.cssMinimizedSize}px !important; + height: 1px !important; } `, stylesheet.cssRules.length ); @@ -50,13 +51,46 @@ export default class MinimalUIMinimize { static cleanupMinimizeBar(app, force) { const minimizedApps = $(".minimized"); const minimizedStash = Object.values(MinimalUIMinimize.minimizedStash); - const matchedStash = minimizedStash.find(a => a.appId === app?.appId); + const matchedStash = minimizedStash.find(a => a.app.appId === app?.appId); if ((force) || (minimizedApps.length === 0) || (minimizedApps.length === 1 && matchedStash)) { MinimalUIMinimize.minimizedStash = {}; $("#minimized-bar").hide(); } } + static enrichStyling(app) { + app.element.find(".close").text(''); + app.element.find(".close").append(``); + app.element.find(".window-draggable-handle").hide(); + if (game.settings.get('minimal-ui', 'enrichedMinimize') === 'enabled') { + const header = app.element.find(".window-header"); + header.on('contextmenu', function () { + if (header.hasClass('minimized-pinned')) + header.removeClass('minimized-pinned') + else + header.addClass('minimized-pinned') + }); + header.hover( + function () { + header.addClass('minimized-highlight') + }, + function () { + header.removeClass('minimized-highlight') + } + ) + } + } + + static unenrichStyling(app) { + app.element.find(".close").text(''); + app.element.find(".close").append(`Close`); + app.element.find(".window-draggable-handle").show(); + if (game.settings.get('minimal-ui', 'enrichedMinimize') === 'enabled') { + app.element.find(".window-header").removeClass('minimized-pinned'); + app.element.find(".window-header").off(); + } + } + static initSettings() { game.settings.register('minimal-ui', 'organizedMinimize', { name: game.i18n.localize("MinimalUI.OrganizedMinimizeName"), @@ -71,7 +105,22 @@ export default class MinimalUIMinimize { "topBar": game.i18n.localize("MinimalUI.OrganizedMinimizeTopBar"), "disabled": game.i18n.localize("MinimalUI.Disabled") }, - default: "disabled", + default: "topBar", + onChange: _ => { + window.location.reload() + } + }); + game.settings.register('minimal-ui', 'enrichedMinimize', { + name: game.i18n.localize("MinimalUI.EnrichedMinimizeName"), + hint: game.i18n.localize("MinimalUI.EnrichedMinimizeHint"), + scope: 'world', + config: true, + type: String, + choices: { + "enabled": game.i18n.localize("MinimalUI.Enabled"), + "disabled": game.i18n.localize("MinimalUI.Disabled") + }, + default: "enabled", onChange: _ => { window.location.reload() } @@ -100,24 +149,22 @@ export default class MinimalUIMinimize { const jumpGap = MinimalUIMinimize.cssMinimizedSize + 10; const boardSize = parseInt($("#board").css('width')); const maxGap = boardSize - sidebarGap; - console.log('MinimalUI: Application.prototype.minimize was called'); const targetHtml = $(`[data-appid='${this.appId}']`); targetHtml.hide(); let targetPos; for (let i = minGap; i < maxGap + jumpGap; i = i + jumpGap) { - if (MinimalUIMinimize.minimizedStash[i]?.appId === this.appId) { + if (MinimalUIMinimize.minimizedStash[i]?.app.appId === this.appId) { targetPos = i; - break; - } else if (!targetPos && !MinimalUIMinimize.minimizedStash[i]?.rendered) { - MinimalUIMinimize.minimizedStash[i] = this; + break + } else if (!targetPos && !MinimalUIMinimize.minimizedStash[i]?.app.rendered) { + MinimalUIMinimize.minimizedStash[i] = {app: this, oldLeft: this.position.left}; targetPos = i; break; } } this.setPosition({left: targetPos ?? this.position.left}); const result = wrapped(...args); - this.element.find(".close").text(''); - this.element.find(".close").append(``); + MinimalUIMinimize.enrichStyling(this); await new Promise(waitABit => setTimeout(waitABit, 200)); if (['bottomBar', 'topBar'].includes(minimizedSetting)) { $("#minimized-bar").show(); @@ -127,16 +174,17 @@ export default class MinimalUIMinimize { }, 'WRAPPER'); libWrapper.register('minimal-ui', 'Application.prototype.maximize', async function (wrapped, ...args) { - console.log('MinimalUI: Application.prototype.maximize was called'); let targetHtml = $(`[data-appid='${this.appId}']`); targetHtml.hide(); let result = wrapped(...args); await new Promise(waitABit => setTimeout(waitABit, 200)); const minimizedSetting = game.settings.get('minimal-ui', 'organizedMinimize'); + const minimizedStash = Object.values(MinimalUIMinimize.minimizedStash); + const matchedStash = minimizedStash.find(a => a.app.appId === this?.appId); + this.setPosition({left: matchedStash.oldLeft}); if (['bottomBar', 'topBar'].includes(minimizedSetting)) MinimalUIMinimize.cleanupMinimizeBar(this); - this.element.find(".close").text(''); - this.element.find(".close").append(`Close`); + MinimalUIMinimize.unenrichStyling(this); targetHtml.show(); return result; }, 'WRAPPER'); diff --git a/package.json b/package.json index 5602d08..aaa3795 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foundryvtt-minimal-ui", - "version": "0.8.3", + "version": "0.8.4", "description": "Minimal UI allows customizing Foundry interface, by hiding, collapsing or resizing specific parts.", "main": "minimalui.js", "scripts": { diff --git a/styles/feature/minimize.css b/styles/feature/minimize.css index fb372d4..ad961a0 100644 --- a/styles/feature/minimize.css +++ b/styles/feature/minimize.css @@ -14,4 +14,12 @@ border-radius: 5px; left: var(--minileft); opacity: 90%; +} + +.minimized-highlight { + background: var(--shadowcolor); +} + +.minimized-pinned { + background: var(--bordercolor); } \ No newline at end of file