From 889a1b5323542a71faa63e2b0a217bb64c19859f Mon Sep 17 00:00:00 2001 From: anmelus <67850900+anmelus@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:40:22 -0700 Subject: [PATCH] Fixed multiple zoomed avatars from appearing. Excluding moving UI (#1098) * Fixed multiple zoomed avatars from appearing * Added check for moving UI elements --- public/script.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/script.js b/public/script.js index 7ee5db7f9..5b52e4a5b 100644 --- a/public/script.js +++ b/public/script.js @@ -8534,6 +8534,17 @@ jQuery(async function () { let targetAvatarImg = thumbURL.substring(thumbURL.lastIndexOf("=") + 1); let charname = targetAvatarImg.replace('.png', ''); + // Remove existing zoomed avatars for characters that are not the clicked character when moving UI is not enabled + if (!power_user.movingUI) { + $('.zoomed_avatar').each(function () { + const currentForChar = $(this).attr('forChar'); + if (currentForChar !== charname && typeof currentForChar !== 'undefined') { + console.debug(`Removing zoomed avatar for character: ${currentForChar}`); + $(this).remove(); + } + }); + } + let avatarSrc = isDataURL(thumbURL) ? thumbURL : charsPath + targetAvatarImg; if ($(`.zoomed_avatar[forChar="${charname}"]`).length) { console.debug('removing container as it already existed')