From e7c75cbe3c9e71ea9c41c5e5458aa105279eaf12 Mon Sep 17 00:00:00 2001 From: PJ Date: Sun, 25 Sep 2022 00:29:26 -0400 Subject: [PATCH] Fix some issues with preview popups/hover editor --- manifest.json | 2 +- src/FolderMenu.ts | 9 +++++---- versions.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index 1d85ba0..44ad2a2 100644 --- a/manifest.json +++ b/manifest.json @@ -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 diff --git a/src/FolderMenu.ts b/src/FolderMenu.ts index 68c89f1..133705c 100644 --- a/src/FolderMenu.ts +++ b/src/FolderMenu.ts @@ -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 @@ -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(), @@ -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); diff --git a/versions.json b/versions.json index 83c42a5..bb40a5d 100644 --- a/versions.json +++ b/versions.json @@ -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",