mirror of
https://github.com/storytold/winit.git
synced 2026-11-29 09:44:58 +01:00
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:
1 parent
8f959714cc
commit
de5327477a
2 files changed
+3
-6
No files matched your search
@@ -127,10 +127,6 @@ pub fn mouse_modifiers(event: &MouseEvent) -> ModifiersState {
|
||||
state
|
||||
}
|
||||
|
||||
pub fn touch_position(event: &PointerEvent, _canvas: &HtmlCanvasElement) -> LogicalPosition<f64> {
|
||||
// TODO: Should this handle more, like `mouse_position_by_client` does?
|
||||
LogicalPosition {
|
||||
x: event.client_x() as f64,
|
||||
y: event.client_y() as f64,
|
||||
}
|
||||
pub fn touch_position(event: &PointerEvent, canvas: &HtmlCanvasElement) -> LogicalPosition<f64> {
|
||||
mouse_position_by_client(event, canvas)
|
||||
}
|
||||
Reference in new issue
Block a user