()
| 1705 | return first.compareDocumentPosition && first.compareDocumentPosition(second) & 16; |
| 1706 | } |
| 1707 | createBottomMenuBar() { |
| 1708 | this.elements.menu = this.createElement("div"); |
| 1709 | |
| 1710 | //prevent weird glitch on some devices |
| 1711 | this.elements.menu.style.opacity = 0; |
| 1712 | this.on("start", (e) => { |
| 1713 | this.elements.menu.style.opacity = ""; |
| 1714 | }) |
| 1715 | this.elements.menu.classList.add("ejs_menu_bar"); |
| 1716 | this.elements.menu.classList.add("ejs_menu_bar_hidden"); |
| 1717 | |
| 1718 | let timeout = null; |
| 1719 | let ignoreEvents = false; |
| 1720 | const hide = () => { |
| 1721 | if (this.paused || this.settingsMenuOpen || this.disksMenuOpen) return; |
| 1722 | this.elements.menu.classList.add("ejs_menu_bar_hidden"); |
| 1723 | } |
| 1724 | |
| 1725 | const show = () => { |
| 1726 | clearTimeout(timeout); |
| 1727 | timeout = setTimeout(hide, 3000); |
| 1728 | this.elements.menu.classList.remove("ejs_menu_bar_hidden"); |
| 1729 | } |
| 1730 | |
| 1731 | this.menu = { |
| 1732 | close: () => { |
| 1733 | clearTimeout(timeout); |
| 1734 | this.elements.menu.classList.add("ejs_menu_bar_hidden"); |
| 1735 | }, |
| 1736 | open: (force) => { |
| 1737 | if (!this.started && force !== true) return; |
| 1738 | clearTimeout(timeout); |
| 1739 | if (force !== true) timeout = setTimeout(hide, 3000); |
| 1740 | this.elements.menu.classList.remove("ejs_menu_bar_hidden"); |
| 1741 | }, |
| 1742 | toggle: () => { |
| 1743 | if (!this.started) return; |
| 1744 | clearTimeout(timeout); |
| 1745 | if (this.elements.menu.classList.contains("ejs_menu_bar_hidden")) { |
| 1746 | timeout = setTimeout(hide, 3000); |
| 1747 | } |
| 1748 | this.elements.menu.classList.toggle("ejs_menu_bar_hidden"); |
| 1749 | } |
| 1750 | } |
| 1751 | |
| 1752 | this.createBottomMenuBarListeners = () => { |
| 1753 | const clickListener = (e) => { |
| 1754 | if (e.pointerType === "touch") return; |
| 1755 | if (!this.started || ignoreEvents || document.pointerLockElement === this.canvas) return; |
| 1756 | if (this.isPopupOpen()) return; |
| 1757 | show(); |
| 1758 | } |
| 1759 | const mouseListener = (e) => { |
| 1760 | if (!this.started || ignoreEvents || document.pointerLockElement === this.canvas) return; |
| 1761 | if (this.isPopupOpen()) return; |
| 1762 | const deltaX = e.movementX; |
| 1763 | const deltaY = e.movementY; |
| 1764 | const threshold = this.elements.menu.offsetHeight + 30; |
no test coverage detected