diff --git a/CHANGELOG.md b/CHANGELOG.md index 846a43e..f6a6874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.4.0 + +Made the 'pop out' portrait scaling work for tokens of different scaling factors. +Added some padding for the 'X is typing' feature from Cautious Gamemaster's Pack, and unbroke the animation. + +This patch features a regression as well - the zoom-chat-portraits-on-hover feature lives no more. Better alternatives exist for showing creature art. + # 1.3.29 Implemented feature that allows for 'pop out' tokens to have 'pop out' chat portraits. Can be disabled in settings. diff --git a/module.json b/module.json index b7d5ef2..d09c1c5 100644 --- a/module.json +++ b/module.json @@ -4,12 +4,12 @@ "description": "Overhauls the Foundry UI and several modules.", "url": "https://github.com/Dorako/pf2e-dorako-ui", "author": "Dorako", - "version": "1.3.29", + "version": "1.4.0", "minimumCoreVersion": "9", "compatibleCoreVersion": "9", "system": ["pf2e"], "scripts": ["scripts/dorako-ui.js"], "templates": ["templates/*"], - "download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.3.29.zip", + "download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.4.0.zip", "manifest": "https://github.com/Dorako/pf2e-dorako-ui/raw/main/module.json" } diff --git a/scripts/dorako-ui.js b/scripts/dorako-ui.js index 3530968..e6d1556 100644 --- a/scripts/dorako-ui.js +++ b/scripts/dorako-ui.js @@ -189,6 +189,57 @@ Hooks.once("init", async function () { } }); + Handlebars.registerHelper("getTokenScale", function (message) { + const border = game.settings.get("pf2e-dorako-ui", "chat-portrait-border"); + const popoutTokenPortraits = game.settings.get( + "pf2e-dorako-ui", + "popout-token-portraits" + ); + if (!border && popoutTokenPortraits) { + const tk = canvas.tokens?.get(message.speaker.token); + const scale = tk?.data.scale ?? 1; + return scale; + } + return 1; + }); + + Handlebars.registerHelper("isTokenPortrait", function (message) { + let combatantImg; + let actorImg; + let tokenImg; + + const speaker = message.speaker; + if (speaker) { + if (speaker.token) { + tokenImg = game.scenes.get(speaker.scene)?.tokens?.get(speaker.token) + ?.data.img; + } + if (speaker.actor) { + const actor = Actors.instance.get(speaker.actor); + combatantImg = combatImagesActive + ? actor.getFlag("combat-tracker-images", "trackerImage") + : null; + actorImg = actor?.data.img; + } + } + + let result = ""; + const main = game.settings.get("pf2e-dorako-ui", "insertSpeakerImage"); + if (main === "token") { + result = + (combatantImg ? "combatant" : "") || + (tokenImg ? "token" : "") || + (actorImg ? "actor" : ""); + } + if (main === "actor") { + result = + (combatantImg ? "combatant" : "") || + (actorImg ? "actor" : "") || + (tokenImg ? "token" : ""); + } + return result == "token"; + }); + Handlebars.registerHelper("determineImageKind", function (message) { let combatantImg; let actorImg; @@ -218,26 +269,21 @@ Hooks.once("init", async function () { if (!border && popoutTokenPortraits) { const tk = canvas.tokens?.get(message.speaker.token); const scale = tk?.data.scale; - if (scale >= game.settings.get("pf2e-dorako-ui", "popout-token-portraits-scale")) { - sizeClass = "scale-up "; - } } const main = game.settings.get("pf2e-dorako-ui", "insertSpeakerImage"); if (main === "token") { return ( - sizeClass + - ((combatantImg ? "combatant" : "") || - (tokenImg ? "token" : "") || - (actorImg ? "actor" : "")) + (combatantImg ? "combatant" : "") || + (tokenImg ? "token" : "") || + (actorImg ? "actor" : "") ); } if (main === "actor") { return ( - sizeClass + - ((combatantImg ? "combatant" : "") || - (actorImg ? "actor" : "") || - (tokenImg ? "token" : "")) + (combatantImg ? "combatant" : "") || + (actorImg ? "actor" : "") || + (tokenImg ? "token" : "") ); } return "no-img"; @@ -498,23 +544,6 @@ Hooks.once("init", async function () { debouncedReload(); }, }); - - game.settings.register("pf2e-dorako-ui", "popout-token-portraits-scale", { - name: "Chat portrait token popout scale", - hint: "Set the minimum threshold for the token scale to be 'popped out' of the chat portraits.", - scope: "client", - type: Number, - default: 1.5, - range: { - min: 0.2, - max: 3, - step: 0.1, - }, - config: true, - onChange: () => { - debouncedReload(); - }, - }); game.settings.register("pf2e-dorako-ui", "chat-portrait-border", { name: "... and add a border?", @@ -528,18 +557,6 @@ Hooks.once("init", async function () { }, }); - game.settings.register("pf2e-dorako-ui", "chat-portrait-hover", { - name: "... and make portraits larger on hover?", - hint: "Works best if you mouse-over from the left.", - scope: "client", - config: true, - default: false, - type: Boolean, - onChange: () => { - debouncedReload(); - }, - }); - game.settings.register("pf2e-dorako-ui", "chat-input-height", { name: "Chatbox height", scope: "client", diff --git a/styles/chat-portrait-hover.css b/styles/chat-portrait-hover.css deleted file mode 100644 index 0bcf78d..0000000 --- a/styles/chat-portrait-hover.css +++ /dev/null @@ -1,6 +0,0 @@ -.portrait-wrapper:hover { - transition: transform 0.35s ease-in-out, filter 0.35s ease-in-out; - transform: scale(4) translate(16px, 16px); - filter: drop-shadow(0px 0px 10px black); - z-index: 1; -} \ No newline at end of file diff --git a/styles/sidebar.css b/styles/sidebar.css index f2ea724..fb66c3a 100644 --- a/styles/sidebar.css +++ b/styles/sidebar.css @@ -237,6 +237,14 @@ nav.damage-log-nav.tabs { } */ /* CGP */ +#cgmp-typing-notify { + padding: 3px; +} + #cgmp-typing-notify.hidden { + padding: 0px; +} + +#cgmp-typing-notify.hidden>* { display: none; } \ No newline at end of file diff --git a/templates/base-chat-message.html b/templates/base-chat-message.html index 3b1ceba..aa9a5bd 100644 --- a/templates/base-chat-message.html +++ b/templates/base-chat-message.html @@ -8,7 +8,11 @@ {{#if (showSpeakerImage message)}}