Refactor highlight

This commit is contained in:
Kamran Ahmed
2023-06-11 14:46:26 +01:00
parent 9bde4cc7e4
commit 1d8c3af09f
3 changed files with 5 additions and 2 deletions
-1
View File
@@ -34,7 +34,6 @@ export function driver(options: Config = {}) {
initEvents();
// Register hooks
listen("overlayClick", handleClose);
listen("escape", handleClose);
}
+1 -1
View File
@@ -64,7 +64,7 @@ function transferHighlight(from: Element, to: Element) {
// If it's the first time we're highlighting an element, we show
// the popover immediately. Otherwise, we wait for the animation
// to finish before showing the popover.
const hasDelayedPopover = to && (!from || from !== to);
const hasDelayedPopover = !from || from !== to;
hidePopover();
+4
View File
@@ -2,9 +2,13 @@ import { StageDefinition } from "./stage";
import { PopoverDOM } from "./popover";
export type State = {
// Whether driver is initialized or not
isInitialized?: boolean;
// Used to bounce the resize event
resizeTimeout?: number;
// Used while transitioning between stages
previousHighlight?: Element;
activeHighlight?: Element;
transitionCallback?: () => void;