mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 17:36:34 +00:00
feat: enhance panel UI positioning and improve hover state handling
This commit is contained in:
@@ -261,6 +261,10 @@ var gZenUIManager = {
|
|||||||
this._toastContainer.setAttribute('hidden', 'true');
|
this._toastContainer.setAttribute('hidden', 'true');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get panelUIPosition() {
|
||||||
|
return gZenVerticalTabsManager._hasSetSingleToolbar ? 'bottomleft topleft' : 'bottomright topright';
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var gZenVerticalTabsManager = {
|
var gZenVerticalTabsManager = {
|
||||||
|
@@ -40,6 +40,11 @@ var gZenCompactModeManager = {
|
|||||||
|
|
||||||
// Clear hover states when window state changes (minimize, maximize, etc.)
|
// Clear hover states when window state changes (minimize, maximize, etc.)
|
||||||
window.addEventListener('sizemodechange', () => this._clearAllHoverStates());
|
window.addEventListener('sizemodechange', () => this._clearAllHoverStates());
|
||||||
|
|
||||||
|
window.addEventListener('mouseenter', (event) => {
|
||||||
|
const buttons = gZenVerticalTabsManager.actualWindowButtons;
|
||||||
|
buttons.removeAttribute('zen-has-hover');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
get preference() {
|
get preference() {
|
||||||
@@ -363,13 +368,14 @@ var gZenCompactModeManager = {
|
|||||||
let target = this.hoverableElements[i].element;
|
let target = this.hoverableElements[i].element;
|
||||||
const onEnter = (event) => {
|
const onEnter = (event) => {
|
||||||
if (event.type === 'mouseenter' && !event.target.matches(':hover')) return;
|
if (event.type === 'mouseenter' && !event.target.matches(':hover')) return;
|
||||||
|
// Dont register the hover if the urlbar is floating and we are hovering over it
|
||||||
|
if (event.target.querySelector('#urlbar[zen-floating-urlbar]')) return;
|
||||||
this.clearFlashTimeout('has-hover' + target.id);
|
this.clearFlashTimeout('has-hover' + target.id);
|
||||||
window.requestAnimationFrame(() => target.setAttribute('zen-has-hover', 'true'));
|
window.requestAnimationFrame(() => target.setAttribute('zen-has-hover', 'true'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLeave = (event) => {
|
const onLeave = (event) => {
|
||||||
if (AppConstants.platform == 'macosx') {
|
if (AppConstants.platform == 'macosx') {
|
||||||
const buttonRect = gZenVerticalTabsManager.actualWindowButtons.getBoundingClientRect();
|
|
||||||
const MAC_WINDOW_BUTTONS_X_BORDER = buttonRect.width + buttonRect.x;
|
const MAC_WINDOW_BUTTONS_X_BORDER = buttonRect.width + buttonRect.x;
|
||||||
const MAC_WINDOW_BUTTONS_Y_BORDER = buttonRect.height + buttonRect.y;
|
const MAC_WINDOW_BUTTONS_Y_BORDER = buttonRect.height + buttonRect.y;
|
||||||
if (
|
if (
|
||||||
|
@@ -1,17 +1,13 @@
|
|||||||
diff --git a/browser/components/customizableui/content/panelUI.inc.xhtml b/browser/components/customizableui/content/panelUI.inc.xhtml
|
diff --git a/browser/components/customizableui/content/panelUI.inc.xhtml b/browser/components/customizableui/content/panelUI.inc.xhtml
|
||||||
index 956a6ae45d7adbec1513c5af528ebb687a4b7d0d..83b23e84cb6895497c1346f7c4aff15173e67b5c 100644
|
index c78f08bdd3fc4d01e10552ef65c2d5813dd053e8..154fb1de2ab9384937d02c14cb7c9c607b330da9 100644
|
||||||
--- a/browser/components/customizableui/content/panelUI.inc.xhtml
|
--- a/browser/components/customizableui/content/panelUI.inc.xhtml
|
||||||
+++ b/browser/components/customizableui/content/panelUI.inc.xhtml
|
+++ b/browser/components/customizableui/content/panelUI.inc.xhtml
|
||||||
@@ -81,9 +81,10 @@
|
@@ -132,7 +132,7 @@
|
||||||
<html:span data-l10n-id="unified-extensions-header-title"/>
|
<panel id="appMenu-notification-popup"
|
||||||
</html:h1>
|
class="popup-notification-panel panel-no-padding"
|
||||||
</box>
|
type="arrow"
|
||||||
-
|
- position="after_start"
|
||||||
+ <html:p id="unified-extensions-description" data-l10n-id="unified-extensions-description" class="panel-description"/>
|
+ position="after_end"
|
||||||
+#if 0
|
flip="slide"
|
||||||
<toolbarseparator />
|
orient="vertical"
|
||||||
-
|
noautofocus="true"
|
||||||
+#endif
|
|
||||||
<vbox class="panel-subview-body" context="unified-extensions-context-menu">
|
|
||||||
<html:div id="unified-extensions-messages-container">
|
|
||||||
<!-- messages will be inserted here -->
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
|
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
|
||||||
index 1805bad6c58e060533f634ed9e511c05cad3ded1..f153761e406535270343fa1f430dea4f740cb2fc 100644
|
index 7583473ee73538b2fa54337bfd844f03f261be49..559b593a6874296bd5894c5985f8eeb680cd3886 100644
|
||||||
--- a/browser/components/customizableui/content/panelUI.js
|
--- a/browser/components/customizableui/content/panelUI.js
|
||||||
+++ b/browser/components/customizableui/content/panelUI.js
|
+++ b/browser/components/customizableui/content/panelUI.js
|
||||||
@@ -496,8 +496,7 @@ const PanelUI = {
|
@@ -515,8 +515,7 @@ const PanelUI = {
|
||||||
tempPanel.setAttribute("animate", "false");
|
tempPanel.setAttribute("animate", "false");
|
||||||
}
|
}
|
||||||
tempPanel.setAttribute("context", "");
|
tempPanel.setAttribute("context", "");
|
||||||
@@ -12,13 +12,12 @@ index 1805bad6c58e060533f634ed9e511c05cad3ded1..f153761e406535270343fa1f430dea4f
|
|||||||
.appendChild(tempPanel);
|
.appendChild(tempPanel);
|
||||||
|
|
||||||
let multiView = document.createXULElement("panelmultiview");
|
let multiView = document.createXULElement("panelmultiview");
|
||||||
@@ -544,8 +543,8 @@ const PanelUI = {
|
@@ -960,7 +959,7 @@ const PanelUI = {
|
||||||
}
|
el.removeAttribute("data-lazy-l10n-id");
|
||||||
|
});
|
||||||
|
|
||||||
if (viewShown) {
|
- this.notificationPanel.openPopup(anchor, "bottomright topright");
|
||||||
- CustomizableUI.addPanelCloseListeners(tempPanel);
|
+ this.notificationPanel.openPopup(anchor, gZenUIManager.panelUIPosition);
|
||||||
tempPanel.addEventListener("popuphidden", panelRemover);
|
},
|
||||||
+ CustomizableUI.addPanelCloseListeners(tempPanel);
|
|
||||||
} else {
|
_clearNotificationPanel() {
|
||||||
panelRemover();
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user