mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Make long tap delay customizable and change default to 400ms
This commit is contained in:
parent
517f1602aa
commit
8935f2af3c
@ -157,16 +157,21 @@ invert_hotbar_mouse_wheel (Hotbar: Invert mouse wheel direction) bool false
|
||||
# Requires: !android
|
||||
enable_touch (Enable touchscreen) bool true
|
||||
|
||||
# The length in pixels it takes for touchscreen interaction to start.
|
||||
#
|
||||
# Requires: touchscreen_gui
|
||||
touchscreen_threshold (Touchscreen threshold) int 20 0 100
|
||||
|
||||
# Touchscreen sensitivity multiplier.
|
||||
#
|
||||
# Requires: touchscreen_gui
|
||||
touchscreen_sensitivity (Touchscreen sensitivity) float 0.2 0.001 10.0
|
||||
|
||||
# The length in pixels after which a touch interaction is considered movement.
|
||||
#
|
||||
# Requires: touchscreen_gui
|
||||
touchscreen_threshold (Movement threshold) int 20 0 100
|
||||
|
||||
# The delay in milliseconds after which a touch interaction is considered a long tap.
|
||||
#
|
||||
# Requires: touchscreen_gui
|
||||
touch_long_tap_delay (Threshold for long taps) int 400 100 1000
|
||||
|
||||
# Use crosshair to select object instead of whole screen.
|
||||
# If enabled, a crosshair will be shown and will be used for selecting object.
|
||||
#
|
||||
|
@ -485,8 +485,9 @@ void set_default_settings()
|
||||
settings->setDefault("keymap_sneak", "KEY_SHIFT");
|
||||
#endif
|
||||
|
||||
settings->setDefault("touchscreen_threshold", "20");
|
||||
settings->setDefault("touchscreen_sensitivity", "0.2");
|
||||
settings->setDefault("touchscreen_threshold", "20");
|
||||
settings->setDefault("touch_long_tap_delay", "400");
|
||||
settings->setDefault("touch_use_crosshair", "false");
|
||||
settings->setDefault("fixed_virtual_joystick", "false");
|
||||
settings->setDefault("virtual_joystick_triggers_aux1", "false");
|
||||
|
@ -414,6 +414,7 @@ TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver)
|
||||
}
|
||||
|
||||
m_touchscreen_threshold = g_settings->getU16("touchscreen_threshold");
|
||||
m_long_tap_delay = g_settings->getU16("touch_long_tap_delay");
|
||||
m_fixed_joystick = g_settings->getBool("fixed_virtual_joystick");
|
||||
m_joystick_triggers_aux1 = g_settings->getBool("virtual_joystick_triggers_aux1");
|
||||
m_screensize = m_device->getVideoDriver()->getScreenSize();
|
||||
@ -999,7 +1000,7 @@ void TouchScreenGUI::step(float dtime)
|
||||
if (m_has_move_id && !m_move_has_really_moved && m_tap_state == TapState::None) {
|
||||
u64 delta = porting::getDeltaMs(m_move_downtime, porting::getTimeMs());
|
||||
|
||||
if (delta > MIN_DIG_TIME_MS) {
|
||||
if (delta > m_long_tap_delay) {
|
||||
m_tap_state = TapState::LongTap;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ typedef enum
|
||||
AHBB_Dir_Right_Left
|
||||
} autohide_button_bar_dir;
|
||||
|
||||
#define MIN_DIG_TIME_MS 500
|
||||
#define BUTTON_REPEAT_DELAY 0.2f
|
||||
#define SETTINGS_BAR_Y_OFFSET 5
|
||||
#define RARE_CONTROLS_BAR_Y_OFFSET 5
|
||||
@ -225,6 +224,7 @@ private:
|
||||
v2u32 m_screensize;
|
||||
s32 button_size;
|
||||
double m_touchscreen_threshold;
|
||||
u16 m_long_tap_delay;
|
||||
bool m_visible; // is the whole touch screen gui visible
|
||||
|
||||
std::unordered_map<u16, rect<s32>> m_hotbar_rects;
|
||||
|
Loading…
Reference in New Issue
Block a user