* Processes the selected import file. * @param {File} file - The backup JSON file
(file)
| 2086 | |
| 2087 | /** |
| 2088 | * Once a fold has settled, the panel glides back to rest just above the |
| 2089 | * composer: right away when the pointer is elsewhere (a keyboard toggle), |
| 2090 | * otherwise when the pointer leaves the panel. The switch never moves |
| 2091 | * from under the pointer, and the gap a closed fold leaves does not stay. |
| 2092 | */ |
| 2093 | scheduleSettingsMenuReanchor() { |
| 2094 | const menu = this.app.elements.settingsMenu; |
| 2095 | if (!menu || !this.settingsMenuAnchor || menu.style.bottom !== 'auto') return; |
| 2096 | menu.removeEventListener('pointerleave', this.settingsMenuReanchorOnLeave); |
| 2097 | if (!menu.matches?.(':hover')) { |
| 2098 | this.restoreSettingsMenuAnchor(); |
| 2099 | return; |
| 2100 | } |
| 2101 | this.settingsMenuReanchorOnLeave ||= () => { |
| 2102 | menu.removeEventListener('pointerleave', this.settingsMenuReanchorOnLeave); |
| 2103 | this.restoreSettingsMenuAnchor(); |
| 2104 | }; |
| 2105 | menu.addEventListener('pointerleave', this.settingsMenuReanchorOnLeave); |
| 2106 | } |
| 2107 | |
| 2108 | restoreSettingsMenuAnchor() { |
| 2109 | const menu = this.app.elements.settingsMenu; |
| 2110 | const anchor = this.settingsMenuAnchor; |
| 2111 | if (!menu || !anchor || menu.style.bottom !== 'auto' || menu.classList.contains('hidden')) return; |
| 2112 | const before = menu.getBoundingClientRect().top; |
| 2113 | menu.style.top = 'auto'; |
| 2114 | menu.style.bottom = anchor.bottom; |
| 2115 | menu.style.maxHeight = anchor.maxHeight; |
| 2116 | const delta = before - menu.getBoundingClientRect().top; |
| 2117 | const reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches; |
| 2118 | if (Math.abs(delta) < 1 || reduced) return; |
| 2119 | // FLIP: start where it was, glide to rest (translate, so the |
| 2120 | // dropdown's own transform and opacity transitions are untouched). |
| 2121 | menu.style.transition = 'none'; |
| 2122 | menu.style.translate = `0 ${delta}px`; |
no test coverage detected