kamrify commited on
Commit
1d8c3af
·
1 Parent(s): 9bde4cc

Refactor highlight

Browse files
Files changed (3) hide show
  1. src/driver.ts +0 -1
  2. src/highlight.ts +1 -1
  3. src/state.ts +4 -0
src/driver.ts CHANGED
@@ -34,7 +34,6 @@ export function driver(options: Config = {}) {
34
 
35
  initEvents();
36
 
37
- // Register hooks
38
  listen("overlayClick", handleClose);
39
  listen("escape", handleClose);
40
  }
 
34
 
35
  initEvents();
36
 
 
37
  listen("overlayClick", handleClose);
38
  listen("escape", handleClose);
39
  }
src/highlight.ts CHANGED
@@ -64,7 +64,7 @@ function transferHighlight(from: Element, to: Element) {
64
  // If it's the first time we're highlighting an element, we show
65
  // the popover immediately. Otherwise, we wait for the animation
66
  // to finish before showing the popover.
67
- const hasDelayedPopover = to && (!from || from !== to);
68
 
69
  hidePopover();
70
 
 
64
  // If it's the first time we're highlighting an element, we show
65
  // the popover immediately. Otherwise, we wait for the animation
66
  // to finish before showing the popover.
67
+ const hasDelayedPopover = !from || from !== to;
68
 
69
  hidePopover();
70
 
src/state.ts CHANGED
@@ -2,9 +2,13 @@ import { StageDefinition } from "./stage";
2
  import { PopoverDOM } from "./popover";
3
 
4
  export type State = {
 
5
  isInitialized?: boolean;
 
 
6
  resizeTimeout?: number;
7
 
 
8
  previousHighlight?: Element;
9
  activeHighlight?: Element;
10
  transitionCallback?: () => void;
 
2
  import { PopoverDOM } from "./popover";
3
 
4
  export type State = {
5
+ // Whether driver is initialized or not
6
  isInitialized?: boolean;
7
+
8
+ // Used to bounce the resize event
9
  resizeTimeout?: number;
10
 
11
+ // Used while transitioning between stages
12
  previousHighlight?: Element;
13
  activeHighlight?: Element;
14
  transitionCallback?: () => void;