5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-18 09:59:31 +08:00
wails/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/mouse-buttons.mdx
Misite Bao e9b2c15664
feat: optimize documentation website (#1849)
* 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>
2022-09-18 22:01:50 +10:00

26 lines
820 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 鼠标按钮
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