mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-07 22:03:24 +00:00
Refactor event listener for ZenThemePicker panel to improve readability and maintainability
This commit is contained in:
@@ -435,12 +435,16 @@
|
||||
document.getElementById('zen-welcome-page-content').appendChild(anchor);
|
||||
gZenThemePicker.panel.setAttribute('noautohide', 'true');
|
||||
gZenThemePicker.panel.setAttribute('consumeoutsideclicks', 'false');
|
||||
gZenThemePicker.panel.addEventListener('popupshowing', () => {
|
||||
const panelRect = gZenThemePicker.panel.getBoundingClientRect();
|
||||
// 20 is the shadow width * 2
|
||||
anchor.style.height = panelRect.height - 20 + 'px';
|
||||
anchor.style.width = panelRect.width - 20 + 'px';
|
||||
}, { once: true });
|
||||
gZenThemePicker.panel.addEventListener(
|
||||
'popupshowing',
|
||||
() => {
|
||||
const panelRect = gZenThemePicker.panel.getBoundingClientRect();
|
||||
// 20 is the shadow width * 2
|
||||
anchor.style.height = panelRect.height - 20 + 'px';
|
||||
anchor.style.width = panelRect.width - 20 + 'px';
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
PanelMultiView.openPopup(gZenThemePicker.panel, anchor, {
|
||||
position: 'overlap',
|
||||
});
|
||||
@@ -449,7 +453,7 @@
|
||||
async fadeOut() {
|
||||
gZenThemePicker.panel.removeAttribute('noautohide');
|
||||
gZenThemePicker.panel.removeAttribute('consumeoutsideclicks');
|
||||
if (AppConstants.platform != "macosx") {
|
||||
if (AppConstants.platform != 'macosx') {
|
||||
await animate(gZenThemePicker.panel, { opacity: [1, 0] });
|
||||
}
|
||||
gZenThemePicker.panel.hidePopup();
|
||||
|
||||
Reference in New Issue
Block a user