Skip to content

Commit

Permalink
fix: listen for mousedown in injectRightMenu on non-Windows systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
pk5ls20 committed Jun 11, 2024
1 parent c1a267c commit 0d389bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/renderer/injectRightMenu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import iconHtml from '../app/assets/logo.svg?raw';
import { log } from '../logs';

const menuID = 'nekoimg-i2i-menu';

let mouseEventName: 'mouseup' | 'mousedown' = LiteLoader.os.platform === 'win32' ? 'mouseup' : 'mousedown';

class imageContainer {
src: string;

Expand Down Expand Up @@ -87,7 +90,7 @@ export const addQContextMenuMain = async () => {
log.error('addQContextMenuMain: Cannot find bodyElement, inject addQContextMenuMain failed');
return;
}
document.addEventListener('mouseup', (event) => {
document.addEventListener(mouseEventName, (event: MouseEvent) => {
if (event.button === 2 && event.target instanceof HTMLImageElement) {
isRightClick = true;
imgEl = event.target;
Expand Down

0 comments on commit 0d389bb

Please sign in to comment.