mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-18 09:59:31 +08:00

* fix(website): fix i18n configuration * feat: add i18n file to auto generate code * feat: move the crowdin configuration file to the website directory * feat(website): add crowdin dependencies and scripts * feat: add COC * feat: use escape hatch syntax to wrap JSX code in MDX files * feat: remove ach language * feat: generate default language configuration * feat: remove compare link * feat: add COC link * feat(website): update documentation * feat: use escape hatch syntax to wrap JSX code in MDX files * style: add prettier * style: format mdx files * chore: remove prettier command * feat: update en docs * feat: sync Chinese documents * feat: update doc * Update website/src/pages/coc.mdx Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
26 lines
820 B
Plaintext
26 lines
820 B
Plaintext
# 鼠标按钮
|
||
|
||
Wails 运行时拦截鼠标单击以确定无框窗口是否需要调整大小或需要移动窗口。 有人询问如何检测鼠标点击何时发生,因为 `window.onclick` 没有正确报告鼠标按钮。 下面的代码展示了如何检测鼠标点击:
|
||
|
||
```javascript
|
||
window.addEventListener("mousedown", handleMouseButtonDown);
|
||
|
||
function handleMouseButtonDown(event) {
|
||
if (event.button === 0) {
|
||
// left mouse button
|
||
} else if (event.button === 1) {
|
||
// middle mouse button
|
||
} else if (event.button === 2) {
|
||
// right mouse button
|
||
} else if (event.button === 3) {
|
||
// back mouse button
|
||
} else if (event.button === 4) {
|
||
// forward mouse button
|
||
} else {
|
||
// other mouse button
|
||
}
|
||
}
|
||
```
|
||
|
||
参考:https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|