Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Update pointer.md #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/input/pointer.md
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中的每个控件都提供了如下事件,允许开发者追踪定点设备的移动、点击与滚动:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abstraction 翻译为 ”抽象“ 更好

Copy link
Author

@Staccato-kashi Staccato-kashi Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abstraction 翻译为 ”抽象“ 更好

我没有逐词翻译这句话。我认为这有一定的难度,以我的水平最好只是将它以意译的方式翻译出来以保证通顺并提高可阅读性。同时,我认为abstraction在此处并不适合翻译为“抽象”,而是最好将它翻译为“概念”或别的名词性词语。

- PointerEnter
- PointerLeave
- PointerMoved
- PointerPressed
- PointerReleased
- PointerWheelChanged

Example how to react on pointer button pressed.
以下是一个如何响应指针按钮按下的实例。

```csharp
control.PointerPressed += (args) =>
Expand All @@ -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);`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些坐标相对于某个控件定位

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你想要获取相对于某个控件的坐标,你可以将该控件传入PointerEventArgs.GetCurrentPoint方法,如:var pointControlCoords = args.GetCurrentPoint(control);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你想要获取相对于某个控件的坐标,你可以将该控件传入PointerEventArgs.GetCurrentPoint方法,如:var pointControlCoords = args.GetCurrentPoint(control);

我认为你的翻译是正确的,非常抱歉我使用了错误的翻译。我在翻译时因未完全理解“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/)