Skip to content

Commit

Permalink
Fix some issues with preview popups/hover editor
Browse files Browse the repository at this point in the history
  • Loading branch information
pjeby committed Sep 25, 2022
1 parent 17241f3 commit e7c75cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Quick Explorer",
"author": "PJ Eby",
"authorUrl": "https://github.com/pjeby",
"version": "0.2.0",
"version": "0.2.1",
"description": "Perform file explorer operations (and see your current file path) from the title bar, using the mouse or keyboard",
"minAppVersion": "0.15.9",
"isDesktopOnly": true
Expand Down
9 changes: 5 additions & 4 deletions src/FolderMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ export class FolderMenu extends PopupMenu implements HoverParent {

set hoverPopover(popover) {
const old = this._popover;
if (popover === old) return;
if (old && popover !== old) {
this._popover = null;
old.onHover = false; // Force unpinned Hover Editors to close
Expand Down Expand Up @@ -385,7 +386,7 @@ export class FolderMenu extends PopupMenu implements HoverParent {
// bit above the current item, unless it would go off the bottom of the screen)
const reposition = () => {
const hoverEl = popover.hoverEl;
//hoverEl.show();
if (!hoverEl.parentElement) return; // don't re-show/position a hidden popover
let
menu = this.dom.getBoundingClientRect(),
selected = this.currentItem().dom.getBoundingClientRect(),
Expand All @@ -404,9 +405,9 @@ export class FolderMenu extends PopupMenu implements HoverParent {
}
if ("onShowCallback" in popover) {
around(popover as any, {onShowCallback(old) {
return function() {
this.hoverEl.win.requestAnimationFrame(reposition);
return old?.call(this);
return () => {
popover.hoverEl.win.requestAnimationFrame(reposition);
return old?.call(popover);
}
}})
} else this.dom.win.requestAnimationFrame(reposition);
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"0.2.0": "0.15.9",
"0.2.1": "0.15.9",
"0.1.41": "0.15.9",
"0.1.37": "0.14.5",
"0.1.23": "0.14.2",
Expand Down

0 comments on commit e7c75cb

Please sign in to comment.