Translation/mouse event#178
Translation/mouse event#178leviding merged 7 commits intojavascript-tutorial:zh-hansfrom Starriers:translation/mouse-event
Conversation
|
@leviding 校对认领 |
|
@Moonliujk ok |
Moonliujk
left a comment
There was a problem hiding this comment.
总体翻译很好,提出了一些小问题需要修改一下。
Ps:在预览时发现,文中有许多代码块没有正常显示,希望译者在确认一下;我再 Review 中也指出了一些,请留意一下
| # 可选列表 | ||
|
|
||
| Create a list where elements are selectable, like in file-managers. | ||
| 比如在文件管理者中新建一个可选元素的列表。 |
There was a problem hiding this comment.
比如在文件管理者中新建一个可选元素的列表。
=>
比如在文件管理器中新建一个可选元素的列表。
file manager 应该译为“文件管理器”
| - A click on a list element selects only that element (adds the class `.selected`), deselects all others. | ||
| - If a click is made with `key:Ctrl` (`key:Cmd` for Mac), then the selection is toggled on the element, but other elements are not modified. | ||
| - 单击列表元素,只选择某个元素(添加 `.selected` 类),取选剩余元素。 | ||
| - 如果使用 `key:Ctrl`(Mac 上为 `key:Cmd`)进行单击,则选择将切换到元素上,但其他元素不会被修改。 |
There was a problem hiding this comment.
则选择将切换到元素上
=>
则选择将切换到所单击的元素上
拙见:表意模糊,应该具体说明一下是什么元素
|
|
||
| `click` | ||
| : Triggers after `mousedown` and then `mouseup` over the same element if the left mouse button was used. | ||
| : 如果使用鼠标左键,则在 `mousedown` 后触发,然后在相同的元素上使用 `mouseup`。 |
There was a problem hiding this comment.
如果使用鼠标左键,则在 mousedown 后触发,然后在相同的元素上使用 mouseup。
=>
如果使用鼠标左键,则在 mousedown 及 mouseup 相继触发后触发该事件。
这里是翻译有误,click 事件是在 mousedown 及 mouseup 触发后才被触发的(文中后半部分也有提到)
| 一个动作可能会触发多个事件。 | ||
|
|
||
| For instance, a click first triggers `mousedown`, when the button is pressed, then `mouseup` and `click` when it's released. | ||
| 比如,在按下按钮时,单击会首先触发 `mousedown`,然后释放按钮时,会触发 `mouseup` 和 `click`。 |
There was a problem hiding this comment.
比如,在按下按钮时,单击会首先触发 mousedown,然后释放按钮时,会触发 mouseup 和 click。
=>
比如,在按下鼠标按钮时,单击会首先触发 mousedown,然后释放鼠标按钮时,会触发 mouseup 和 click。
建议:这里表意我觉得不是很明确,需要指明一下是鼠标按钮
| 比如,在按下按钮时,单击会首先触发 `mousedown`,然后释放按钮时,会触发 `mouseup` 和 `click`。 | ||
|
|
||
| In cases when a single action initiates multiple events, their order is fixed. That is, the handlers are called in the order `mousedown` -> `mouseup` -> `click`. Events are handled in the same sequence: `onmouseup` finishes before `onclick` runs. | ||
| 在单个动作开始复制事件时,它们的顺序是固定的。也就是说会遵循 `mousedown` -> `mouseup` -> `click` 的顺序。事件按照相同的顺序被处理:`onmouseup` 在 `onclick` 运行之前完成。 |
There was a problem hiding this comment.
在单个动作开始复制事件时
=>
在单个动作触发多个事件时
initiate 本意为“发起”,在这里我觉得可以译为“触发”;multiple 译为多个
| 你可以在本章中阅读到更多关于坐标的内容 <info:coordinates>。 | ||
|
|
||
| ## No selection on mousedown | ||
| ## 鼠标向下没有选择 |
There was a problem hiding this comment.
鼠标向下没有选择
=>
Mousedown 没有选择
mousedown 指的是鼠标的事件类型,我觉得在这里保留原文即可
| 现在,在双击时不选择粗体元素。 | ||
|
|
||
| The text inside it is still selectable. However, the selection should start not on the text itself, but before or after it. Usually that's fine though. | ||
| 内部文字仍然可以被选中。但选择缺不应该从文本自身开始,而是应该在文字之前或之后开始。通常情况下,都是正常的。 |
There was a problem hiding this comment.
但选择缺不应该从文本自身开始
=>
但选择却不应该从文本自身开始
错别字
| Here's how: | ||
| 这是方法: | ||
|
|
||
| ```html autorun height=50 |
| Also we can see the `which` property that allows to detect the mouse button. | ||
| 我们还可以看出 `which` 属性允许检测鼠标按钮。 | ||
|
|
||
| <input onmousedown="return logMouse(event)" onmouseup="return logMouse(event)" onclick="return logMouse(event)" oncontextmenu="return logMouse(event)" ondblclick="return logMouse(event)" value="Click me with the right or the left mouse button" type="button"> <input onclick="logClear('test')" value="Clear" type="button"> <form id="testform" name="testform"> <textarea style="font-size:12px;height:150px;width:360px;"></textarea></form> |
There was a problem hiding this comment.
这里的代码风格不是很清晰,一长串看起来很费劲,建议适当添加换行符使代码结构更加清晰明确;
There was a problem hiding this comment.
为了让你们校对方便 也可以改,但是问题是 改了之后 我不一定会改回来 😞
| 中间按钮现在有些特殊,所有很少被使用。 | ||
|
|
||
| ## Modifiers: shift, alt, ctrl and meta | ||
| ## 修改键: shift、alt、ctrl 和 meta |
There was a problem hiding this comment.
Modifiers 关于这个词我也没有查到具体示意,但是结合文中下半部分的说明,这个 Modifiers 的功能是js中描述的组合键的概念,可以考虑翻译为组合键,因为我没有查到有修改键这个翻译
There was a problem hiding this comment.
这个 我查了 没有适合的 不过你说的 组合键 可以用
|
@Starriers @leviding 校对完毕 |
|
@Moonliujk 好赞 |
|
@Moonliujk 那个代码块无法显示 整个仓库 都是这样的。据说 不是 md 格式的,所以我也没有办法修改,因为修改了 可能就无法正常使用了 |
|
@Starriers 是这样啊!了解了! |
| : 鼠标每次移动到元素上时都会触发事件。 | ||
|
|
||
| ...There are several other event types too, we'll cover them later. | ||
| ...还有其他几种事件类型,我们稍后会讨论它们。 |
| @@ -98,61 +98,61 @@ For instance, the button below only works on `key:Alt+Shift`+click: | |||
| ``` | |||
|
|
|||
| ```warn header="Attention: on Mac it's usually `Cmd` instead of `Ctrl`" | |||
There was a problem hiding this comment.
Attention: on Mac it's usually Cmd instead of Ctrl 这句需要翻译
| Move the mouse over the input field to see `clientX/clientY` (it's in the `iframe`, so coordinates are relative to that `iframe`): | ||
| 将鼠标移动到输入字段上,可以看到 `clientX/clientY`(它在 `iframe` 中,因此坐标是相对于 `iframe` 而言的): | ||
|
|
||
| ```html autorun height=50 |
| Here's how: | ||
| 这是方法: | ||
|
|
||
| ```html autorun height=50 |
翻译完成 #170