Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bistutu committed Apr 27, 2024
1 parent 9889718 commit dd4484f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions entrypoints/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ export default defineContentScript({
}
});

// 6、双击鼠标翻译事件
document.body.addEventListener('dblclick', event => {
if (config.hotkey == constants.DoubleClick) {
// 通过双击事件获取鼠标位置
let mouseX = event.clientX;
let mouseY = event.clientY;
// 调用 handler 函数进行翻译
handler(config, mouseX, mouseY);
}
});

// 7、长按鼠标翻译事件
let timer:number; // 计时器变量用于设置延时
document.body.addEventListener('mouseup', () => clearTimeout(timer));
Expand Down

0 comments on commit dd4484f

Please sign in to comment.