You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Enable granular control of touchscreen related settings
This commit is contained in:
@@ -40,6 +40,7 @@ import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.window.layout.WindowMetricsCalculator
|
||||
import org.godotengine.godot.FullScreenGodotApp
|
||||
import org.godotengine.godot.GodotLib
|
||||
import org.godotengine.godot.utils.PermissionsUtil
|
||||
import org.godotengine.godot.utils.ProcessPhoenix
|
||||
import java.util.*
|
||||
@@ -90,11 +91,19 @@ open class GodotEditor : FullScreenGodotApp() {
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
// Enable long press, panning and scaling gestures
|
||||
godotFragment?.renderView?.inputHandler?.apply {
|
||||
enableLongPress(enableLongPressGestures())
|
||||
enablePanningAndScalingGestures(enablePanAndScaleGestures())
|
||||
override fun onGodotSetupCompleted() {
|
||||
super.onGodotSetupCompleted()
|
||||
val longPressEnabled = enableLongPressGestures()
|
||||
val panScaleEnabled = enablePanAndScaleGestures()
|
||||
|
||||
runOnUiThread {
|
||||
// Enable long press, panning and scaling gestures
|
||||
godotFragment?.renderView?.inputHandler?.apply {
|
||||
enableLongPress(longPressEnabled)
|
||||
enablePanningAndScalingGestures(panScaleEnabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,12 +219,14 @@ open class GodotEditor : FullScreenGodotApp() {
|
||||
/**
|
||||
* Enable long press gestures for the Godot Android editor.
|
||||
*/
|
||||
protected open fun enableLongPressGestures() = true
|
||||
protected open fun enableLongPressGestures() =
|
||||
java.lang.Boolean.parseBoolean(GodotLib.getEditorSetting("interface/touchscreen/enable_long_press_as_right_click"))
|
||||
|
||||
/**
|
||||
* Enable pan and scale gestures for the Godot Android editor.
|
||||
*/
|
||||
protected open fun enablePanAndScaleGestures() = true
|
||||
protected open fun enablePanAndScaleGestures() =
|
||||
java.lang.Boolean.parseBoolean(GodotLib.getEditorSetting("interface/touchscreen/enable_pan_and_scale_gestures"))
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
@@ -179,6 +179,13 @@ public class GodotLib {
|
||||
*/
|
||||
public static native String getGlobal(String p_key);
|
||||
|
||||
/**
|
||||
* Used to access Godot's editor settings.
|
||||
* @param settingKey Setting key
|
||||
* @return String value of the setting
|
||||
*/
|
||||
public static native String getEditorSetting(String settingKey);
|
||||
|
||||
/**
|
||||
* Invoke method |p_method| on the Godot object specified by |p_id|
|
||||
* @param p_id Id of the Godot object to invoke
|
||||
|
||||
Reference in New Issue
Block a user