mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-10-31 03:52:13 +08:00
Refactor highlight
This commit is contained in:
@@ -34,7 +34,6 @@ export function driver(options: Config = {}) {
|
||||
|
||||
initEvents();
|
||||
|
||||
// Register hooks
|
||||
listen("overlayClick", handleClose);
|
||||
listen("escape", handleClose);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user