This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Update pointer.md #25
Open
Staccato-kashi
wants to merge
2
commits into
avaloniachina:master
Choose a base branch
from
Staccato-kashi:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# 鼠标与触控设备 | ||
|
||
Avalonia operates on the abstraction called pointer devices. These devices including, but not limited to mouse, touch, pen etc. Each control in Avalonia provides following events which allow developer to subscribe to the pointer device movements, clicks and wheel movements: | ||
Avalonia 可工作于我们称之为“定点设备”的基础上。这类设备包括但不限于鼠标、触摸板与数位笔等。Avalonia中的每个控件都提供了如下事件,允许开发者追踪定点设备的移动、点击与滚动: | ||
- PointerEnter | ||
- PointerLeave | ||
- PointerMoved | ||
- PointerPressed | ||
- PointerReleased | ||
- PointerWheelChanged | ||
|
||
Example how to react on pointer button pressed. | ||
以下是一个如何响应指针按钮按下的实例。 | ||
|
||
```csharp | ||
control.PointerPressed += (args) => | ||
|
@@ -27,15 +27,15 @@ control.PointerPressed += (args) => | |
} | ||
``` | ||
|
||
In the example above, coordinates `x` and `y` are relatively to the window origin. If you want coordinates relative to the specific control, you may pass it to `PointerEventArgs.GetCurrentPoint` method like this: `var pointControlCoords = args.GetCurrentPoint(control);` | ||
在上述实例中,坐标 `x` 和 `y` 是相对于窗口原点定位的。如果你希望这些坐标相对定位于某个控件, 你可以将 `PointerEventArgs.GetCurrentPoint` 函数改成这样: `var pointControlCoords = args.GetCurrentPoint(control);` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这些坐标相对于某个控件定位 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 如果你想要获取相对于某个控件的坐标,你可以将该控件传入 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
我认为你的翻译是正确的,非常抱歉我使用了错误的翻译。我在翻译时因未完全理解“pass it”的含义而导致了这个错误。 |
||
|
||
# Tapped event args | ||
# 点击事件的参数: | ||
|
||
Each control also has special gesture events: Tapped and DoubleTapped. | ||
Tapped is raised, when pointer was pressed on the control and then released. | ||
While DoubleTapped is raised after pointer was pressed twice on the same place. Allowed size (distance between first and second "tap") and time (delay between them) depend on the platform and usually is bigger for the touch devices. | ||
每个控件都有如下两个事件:单击(Tapped)和双击(DoubleTapped)。 | ||
当指针在控件上按下并抬起时,响应为单击(Tapped)。 | ||
当指针在同一位置上按下两次后,双击(DoubleTapped)被触发。允许的大小(size,两次“点击”间的距离)和时间(time,两次“点击”间的延迟)取决于程序工作的平台。通常来说,在触摸设备上这两个值会更大。 | ||
|
||
### Reference <a id="reference"></a> | ||
### 参考 <a id="reference"></a> | ||
|
||
[Control](http://reference.avaloniaui.net/api/Avalonia.Controls/Control/) | ||
[PointerEventArgs](http://reference.avaloniaui.net/api/Avalonia.Input/PointerEventArgs/) | ||
[控件(Control)](http://reference.avaloniaui.net/api/Avalonia.Controls/Control/) | ||
[指针事件参数(PointerEventArgs)](http://reference.avaloniaui.net/api/Avalonia.Input/PointerEventArgs/) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstraction 翻译为 ”抽象“ 更好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没有逐词翻译这句话。我认为这有一定的难度,以我的水平最好只是将它以意译的方式翻译出来以保证通顺并提高可阅读性。同时,我认为abstraction在此处并不适合翻译为“抽象”,而是最好将它翻译为“概念”或别的名词性词语。