From db62b229bbcea498b6f11af90cf135e960c84e7e Mon Sep 17 00:00:00 2001 From: Bruno Salmon Date: Tue, 28 May 2024 18:14:37 +0100 Subject: [PATCH] Added user touch interaction detection (required for sound on iOS/iPadOS) --- .../peers/javafxgraphics/gwtj2cl/shared/HtmlSvgNodePeer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webfx-kit/webfx-kit-javafxgraphics-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/gwtj2cl/shared/HtmlSvgNodePeer.java b/webfx-kit/webfx-kit-javafxgraphics-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/gwtj2cl/shared/HtmlSvgNodePeer.java index f85567500..281aeb638 100644 --- a/webfx-kit/webfx-kit-javafxgraphics-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/gwtj2cl/shared/HtmlSvgNodePeer.java +++ b/webfx-kit/webfx-kit-javafxgraphics-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxgraphics/gwtj2cl/shared/HtmlSvgNodePeer.java @@ -406,12 +406,14 @@ private static void registerTouchListener(EventTarget htmlTarget, String type, j AddEventListenerOptions passiveOption = AddEventListenerOptions.create(); passiveOption.setPassive(false); // May be set to true in some cases to improve Lighthouse score htmlTarget.addEventListener(type, e -> { + UserInteraction.setUserInteracting(true); boolean fxConsumed = passHtmlTouchEventOnToFx((TouchEvent) e, type, fxTarget); if (fxConsumed) { e.stopPropagation(); if (!UserInteraction.nextUserRunnableRequiresTouchEventDefault()) e.preventDefault(); } + UserInteraction.setUserInteracting(false); }, passiveOption); }