Skip to content

Commit

Permalink
fix: Right-click to expose the settings window.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronparkdev committed Jul 15, 2024
1 parent efa5699 commit 3e68d4c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { TargetConfig } from 'services/config'

void (async () => {
let lastRightClick: { element: Element; date: Date } | null = null
let lastRightClick: { element: Element } | null = null
let lastElement: Element | null = null
let lastTargets: TargetConfig[] = []
let mode: 'standby' | 'addTarget' = 'standby'
Expand All @@ -18,7 +18,6 @@ void (async () => {
element !== null
? {
element,
date: new Date(),
}
: null
},
Expand Down Expand Up @@ -178,14 +177,14 @@ void (async () => {
}

if (request.action === 'openShortcutDialog') {
if (lastRightClick !== null && Math.abs(lastRightClick.date.getTime() - new Date().getTime()) < 500) {
if (lastRightClick !== null) {
lastElement = lastRightClick.element
}

const clickableElement =
lastElement !== null && lastElement instanceof HTMLElement
? DomService.findVisibleClickableAndSufficientSizeParent(lastElement)
: null
: lastElement

if (!clickableElement) {
setAddTargetMode()
Expand Down

0 comments on commit 3e68d4c

Please sign in to comment.