~mil/fbp

637f5d16d714cbb54269c8c6554c3d4bdbb21d2e — Miles Alan 2 months ago d2fbe64 master
Break out drag threshold dist/ms to config; lower gesture drag threshold ms
2 files changed, 8 insertions(+), 6 deletions(-)

M src/Runtime.zig
M src/config.zig
M src/Runtime.zig => src/Runtime.zig +5 -6
@@ 187,14 187,13 @@ fn event_touch_handle(runtime: *@This(), evt_data: linput.input_event) !void {
                };
            } else if (run == .FingerUp and runtime.touch_start != null) {
                defer runtime.touch_start = null;
                if (utiltime.timeval_delta_ms(utiltime.now(), runtime.touch_start.?.start_time) > 2000) return;
                const drag_threshold = 300;
                if (utiltime.timeval_delta_ms(utiltime.now(), runtime.touch_start.?.start_time) > config.drag_threshold_ms) return;

                const swipe : ?types.DragSwipe = swipe: {
                    if (runtime.touch_pending.?.y > runtime.touch_start.?.coordinates.y + drag_threshold) break :swipe .UD;
                    if (runtime.touch_pending.?.y < runtime.touch_start.?.coordinates.y - drag_threshold) break :swipe .DU;
                    if (runtime.touch_pending.?.x > runtime.touch_start.?.coordinates.x + drag_threshold) break :swipe .LR;
                    if (runtime.touch_pending.?.x < runtime.touch_start.?.coordinates.x - drag_threshold) break :swipe .RL;
                    if (runtime.touch_pending.?.y > runtime.touch_start.?.coordinates.y + config.drag_threshold_dist) break :swipe .UD;
                    if (runtime.touch_pending.?.y < runtime.touch_start.?.coordinates.y - config.drag_threshold_dist) break :swipe .DU;
                    if (runtime.touch_pending.?.x > runtime.touch_start.?.coordinates.x + config.drag_threshold_dist) break :swipe .LR;
                    if (runtime.touch_pending.?.x < runtime.touch_start.?.coordinates.x - config.drag_threshold_dist) break :swipe .RL;
                    break :swipe null;
                };


M src/config.zig => src/config.zig +3 -0
@@ 19,6 19,9 @@ pub const grid_batch_size = 15;

pub const timeout_poll_ms = 50;

pub const drag_threshold_ms = 400;
pub const drag_threshold_dist = 300;

pub const keyboard = [_]types.GridItem{
    // Row 1
    .{ .t = "q" },