diff --git a/doc/classes/InputEventMagnifyGesture.xml b/doc/classes/InputEventMagnifyGesture.xml
index 33203fad3..09ee49dd5 100644
--- a/doc/classes/InputEventMagnifyGesture.xml
+++ b/doc/classes/InputEventMagnifyGesture.xml
@@ -3,6 +3,7 @@
+ [b]Note:[/b] On Android, this requires the [member ProjectSettings.input_devices/pointing/android/enable_pan_and_scale_gestures] project setting to be enabled.
diff --git a/doc/classes/InputEventPanGesture.xml b/doc/classes/InputEventPanGesture.xml
index fc6b3f2c5..fbdade483 100644
--- a/doc/classes/InputEventPanGesture.xml
+++ b/doc/classes/InputEventPanGesture.xml
@@ -3,6 +3,7 @@
+ [b]Note:[/b] On Android, this requires the [member ProjectSettings.input_devices/pointing/android/enable_pan_and_scale_gestures] project setting to be enabled.
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 5603ec903..5c79e6c4c 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -808,6 +808,12 @@
If [code]false[/code], no input will be lost.
[b]Note:[/b] You should in nearly all cases prefer the [code]false[/code] setting. The legacy behavior is to enable supporting old projects that rely on the old logic, without changes to script.
+
+ If [code]true[/code], long press events on an Android touchscreen are transformed into right click events.
+
+
+ If [code]true[/code], multi-touch pan and scale gestures are enabled on Android devices.
+
If [code]true[/code], sends mouse input events when tapping or swiping on the touchscreen.
diff --git a/main/main.cpp b/main/main.cpp
index 7e7da4382..7d3d08712 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1619,6 +1619,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input_devices/pointing/emulate_mouse_from_touch", true)));
}
+ GLOBAL_DEF("input_devices/pointing/android/enable_long_press_as_right_click", false);
+ GLOBAL_DEF("input_devices/pointing/android/enable_pan_and_scale_gestures", false);
+
MAIN_PRINT("Main: Load Translations and Remaps");
translation_server->setup(); //register translations, load them, etc.
diff --git a/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/Pandemonium.java b/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/Pandemonium.java
index 0d99aebcc..095c480cc 100644
--- a/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/Pandemonium.java
+++ b/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/Pandemonium.java
@@ -120,6 +120,7 @@ import org.pandemoniumengine.pandemonium.plugin.PandemoniumPluginRegistry;
import org.pandemoniumengine.pandemonium.utils.BenchmarkUtils;
import org.pandemoniumengine.pandemonium.utils.PandemoniumNetUtils;
import org.pandemoniumengine.pandemonium.utils.PermissionsUtil;
+import org.pandemoniumengine.pandemonium.input.PandemoniumInputHandler;
public class Pandemonium extends Fragment implements SensorEventListener, IDownloaderClient {
private static final String TAG = Pandemonium.class.getSimpleName();
@@ -331,6 +332,21 @@ public class Pandemonium extends Fragment implements SensorEventListener, IDownl
*/
@CallSuper
protected void onPandemoniumSetupCompleted() {
+ Log.d(TAG, "onPandemoniumSetupCompleted");
+
+ // These properties are defined after Godot setup completion, so we retrieve them here.
+ boolean longPressEnabled = Boolean.parseBoolean(PandemoniumLib.getGlobal("input_devices/pointing/android/enable_long_press_as_right_click"));
+ boolean panScaleEnabled = Boolean.parseBoolean(PandemoniumLib.getGlobal("input_devices/pointing/android/enable_pan_and_scale_gestures"));
+
+ runOnUiThread(() -> {
+ PandemoniumView renderView = getRenderView();
+ PandemoniumInputHandler inputHandler = renderView != null ? renderView.getInputHandler() : null;
+ if (inputHandler != null) {
+ inputHandler.enableLongPress(longPressEnabled);
+ inputHandler.enablePanningAndScalingGestures(panScaleEnabled);
+ }
+ });
+
for (PandemoniumPlugin plugin : pluginRegistry.getAllPlugins()) {
plugin.onPandemoniumSetupCompleted();
}
@@ -345,6 +361,8 @@ public class Pandemonium extends Fragment implements SensorEventListener, IDownl
*/
@CallSuper
protected void onPandemoniumMainLoopStarted() {
+ Log.d(TAG, "onPandemoniumMainLoopStarted");
+
for (PandemoniumPlugin plugin : pluginRegistry.getAllPlugins()) {
plugin.onPandemoniumMainLoopStarted();
}