Have the PopoverManager call a hook to get additional options for the popover Application

This commit is contained in:
Oliver-Akins 2025-03-15 17:05:14 -06:00
parent e8fdf6e952
commit 69bf712eca
2 changed files with 23 additions and 8 deletions

View file

@ -1,5 +1,4 @@
import { getTooltipDelay } from "../consts.mjs";
import { Logger } from "./Logger.mjs";
export class PopoverEventManager {
#options;
@ -64,16 +63,22 @@ export class PopoverEventManager {
#frameless;
#framed;
#construct(options) {
const valid = Hooks.call(`get${this.#class.name}Options`, options);
if (!valid) { return };
return new this.#class(options);
};
#clickHandler() {
// Cleanup for the frameless lifecycle
this.stopOpen();
this.stopClose();
this.#frameless?.close({ force: true });
if (!this.#framed) {
const app = new this.#class({ popover: { ...this.#options, framed: true } });
this.#framed = app;
this.#framed = this.#construct({ popover: { ...this.#options, framed: true } });
}
this.#framed.render({ force: true });
this.#framed?.render({ force: true });
};
#pointerEnterHandler(event) {
@ -104,14 +109,14 @@ export class PopoverEventManager {
return;
}
this.#frameless = new this.#class({
this.#frameless = this.#construct({
popover: {
...this.#options,
framed: false,
x, y,
},
});
this.#frameless.render({ force: true });
this.#frameless?.render({ force: true });
},
getTooltipDelay(),
);