mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
[Pale Moon] Use mousemove events instead of MousePosTracker for hiding the navigation bar in fullscreen
* Tag #336
This commit is contained in:
parent
b5376e63c5
commit
3687a6bd06
1 changed files with 10 additions and 27 deletions
|
|
@ -53,17 +53,9 @@ var FullScreen = {
|
||||||
document.addEventListener("popupshown", this._setPopupOpen, false);
|
document.addEventListener("popupshown", this._setPopupOpen, false);
|
||||||
document.addEventListener("popuphidden", this._setPopupOpen, false);
|
document.addEventListener("popuphidden", this._setPopupOpen, false);
|
||||||
this._shouldAnimate = true;
|
this._shouldAnimate = true;
|
||||||
// If it is not safe to collapse, add the mouse position tracker or
|
if (gPrefService.getBoolPref("browser.fullscreen.autohide")) {
|
||||||
// else it won't be possible to hide the navigation toolbox again
|
gBrowser.mPanelContainer.addEventListener("mousemove",
|
||||||
if (!this._safeToCollapse(document.mozFullScreen)) {
|
this._collapseCallback, false);
|
||||||
let rect = gBrowser.mPanelContainer.getBoundingClientRect();
|
|
||||||
this._mouseTargetRect = {
|
|
||||||
top: rect.top + 50,
|
|
||||||
bottom: rect.bottom,
|
|
||||||
left: rect.left,
|
|
||||||
right: rect.right
|
|
||||||
};
|
|
||||||
MousePosTracker.addListener(this);
|
|
||||||
}
|
}
|
||||||
// We don't animate the toolbar collapse if in DOM full-screen mode,
|
// We don't animate the toolbar collapse if in DOM full-screen mode,
|
||||||
// as the size of the content area would still be changing after the
|
// as the size of the content area would still be changing after the
|
||||||
|
|
@ -149,7 +141,8 @@ var FullScreen = {
|
||||||
|
|
||||||
cleanup: function () {
|
cleanup: function () {
|
||||||
if (!window.fullScreen) {
|
if (!window.fullScreen) {
|
||||||
MousePosTracker.removeListener(this);
|
gBrowser.mPanelContainer.removeEventListener("mousemove",
|
||||||
|
this._collapseCallback, false);
|
||||||
document.removeEventListener("keypress", this._keyToggleCallback, false);
|
document.removeEventListener("keypress", this._keyToggleCallback, false);
|
||||||
document.removeEventListener("popupshown", this._setPopupOpen, false);
|
document.removeEventListener("popupshown", this._setPopupOpen, false);
|
||||||
document.removeEventListener("popuphidden", this._setPopupOpen, false);
|
document.removeEventListener("popuphidden", this._setPopupOpen, false);
|
||||||
|
|
@ -164,17 +157,12 @@ var FullScreen = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getMouseTargetRect: function()
|
|
||||||
{
|
|
||||||
return this._mouseTargetRect;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Event callbacks
|
// Event callbacks
|
||||||
_expandCallback: function()
|
_expandCallback: function()
|
||||||
{
|
{
|
||||||
FullScreen.showNavToolbox();
|
FullScreen.showNavToolbox();
|
||||||
},
|
},
|
||||||
onMouseEnter: function()
|
_collapseCallback: function()
|
||||||
{
|
{
|
||||||
FullScreen.hideNavToolbox();
|
FullScreen.hideNavToolbox();
|
||||||
},
|
},
|
||||||
|
|
@ -328,14 +316,8 @@ var FullScreen = {
|
||||||
// Track whether mouse is near the toolbox
|
// Track whether mouse is near the toolbox
|
||||||
this._isChromeCollapsed = false;
|
this._isChromeCollapsed = false;
|
||||||
if (trackMouse) {
|
if (trackMouse) {
|
||||||
let rect = gBrowser.mPanelContainer.getBoundingClientRect();
|
gBrowser.mPanelContainer.addEventListener("mousemove",
|
||||||
this._mouseTargetRect = {
|
this._collapseCallback, false);
|
||||||
top: rect.top + 50,
|
|
||||||
bottom: rect.bottom,
|
|
||||||
left: rect.left,
|
|
||||||
right: rect.right
|
|
||||||
};
|
|
||||||
MousePosTracker.addListener(this);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -378,7 +360,8 @@ var FullScreen = {
|
||||||
gNavToolbox.style.marginTop =
|
gNavToolbox.style.marginTop =
|
||||||
-gNavToolbox.getBoundingClientRect().height + "px";
|
-gNavToolbox.getBoundingClientRect().height + "px";
|
||||||
this._isChromeCollapsed = true;
|
this._isChromeCollapsed = true;
|
||||||
MousePosTracker.removeListener(this);
|
gBrowser.mPanelContainer.removeEventListener("mousemove",
|
||||||
|
this._collapseCallback, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
showXULChrome: function(aTag, aShow)
|
showXULChrome: function(aTag, aShow)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue