web: Fix position of touch events to be relative to the canvas

Use the same logic as for mouse events when not captured.
This commit is contained in:
Simon Hausmann 2023-02-28 10:25:51 +01:00 committed by daxpedda
parent 8f959714cc
commit de5327477a
2 changed files with 3 additions and 6 deletions

View file

@ -49,6 +49,7 @@ And please only add new entries to the top of this list, right below the `# Unre
- On Wayland, drop `WINIT_WAYLAND_CSD_THEME` variable. - On Wayland, drop `WINIT_WAYLAND_CSD_THEME` variable.
- Implement `PartialOrd` and `Ord` on types in the `dpi` module. - Implement `PartialOrd` and `Ord` on types in the `dpi` module.
- Bump MSRV from `1.60` to `1.64`. - Bump MSRV from `1.60` to `1.64`.
- Web: Fix position of touch events to be relative to the canvas.
# 0.28.6 # 0.28.6

View file

@ -127,10 +127,6 @@ pub fn mouse_modifiers(event: &MouseEvent) -> ModifiersState {
state state
} }
pub fn touch_position(event: &PointerEvent, _canvas: &HtmlCanvasElement) -> LogicalPosition<f64> { pub fn touch_position(event: &PointerEvent, canvas: &HtmlCanvasElement) -> LogicalPosition<f64> {
// TODO: Should this handle more, like `mouse_position_by_client` does? mouse_position_by_client(event, canvas)
LogicalPosition {
x: event.client_x() as f64,
y: event.client_y() as f64,
}
} }