mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
UI performance fixes (#3207)
* Optimize visibility checks for burger and wand menus
* Optimize message actions visibility toggle
* Run drawer toggle in animation frame
* Replace jQuery slideToggle with a 3rd-party lib
* Refactor export button functionality to manage popup state with a boolean flag
* Do not close the pinned drawer on unpin
* Revert "Do not close the pinned drawer on unpin"
This reverts commit e3b34e9a58
.
* Refactor slideToggle options
* ease-in-out
* Don't skip frame on drawer toggle
This commit is contained in:
@ -417,26 +417,30 @@ async function addExtensionsButtonAndMenu() {
|
||||
|
||||
const button = $('#extensionsMenuButton');
|
||||
const dropdown = $('#extensionsMenu');
|
||||
//dropdown.hide();
|
||||
let isDropdownVisible = false;
|
||||
|
||||
let popper = Popper.createPopper(button.get(0), dropdown.get(0), {
|
||||
placement: 'top-start',
|
||||
});
|
||||
|
||||
$(button).on('click', function () {
|
||||
if (dropdown.is(':visible')) {
|
||||
if (isDropdownVisible) {
|
||||
dropdown.fadeOut(animation_duration);
|
||||
isDropdownVisible = false;
|
||||
} else {
|
||||
dropdown.fadeIn(animation_duration);
|
||||
isDropdownVisible = true;
|
||||
}
|
||||
popper.update();
|
||||
});
|
||||
|
||||
$('html').on('click', function (e) {
|
||||
if (!isDropdownVisible) return;
|
||||
const clickTarget = $(e.target);
|
||||
const noCloseTargets = ['#sd_gen', '#extensionsMenuButton', '#roll_dice'];
|
||||
if (dropdown.is(':visible') && !noCloseTargets.some(id => clickTarget.closest(id).length > 0)) {
|
||||
$(dropdown).fadeOut(animation_duration);
|
||||
if (!noCloseTargets.some(id => clickTarget.closest(id).length > 0)) {
|
||||
dropdown.fadeOut(animation_duration);
|
||||
isDropdownVisible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user