~mil/mepo

07afc3c689dec203cab885bfb21fec49a2a9381f — Miles Alan a month ago c4cb979
Fix gestures state saving for direction field
2 files changed, 3 insertions(+), 2 deletions(-)

M src/api/bind_gesture.zig
M src/api/filedump.zig
M src/api/bind_gesture.zig => src/api/bind_gesture.zig +1 -1
@@ 10,7 10,7 @@ pub const spec = .{
    .args = (&[_]types.MepoFnSpecArg{
        .{ .tag = .Text, .name = "action", .desc = "Gesture action (set to either `pan` or `rotate`)" },
        .{ .tag = .Number, .name = "fingers", .desc = "Number of fingers to trigger expression" },
        .{ .tag = .Number, .name = "direction", .desc = "Direction for gesture (e.g. `1` for in or `2` for out)" },
        .{ .tag = .Number, .name = "direction", .desc = "Direction for gesture (e.g. `1` for in or `-1` for out)" },
        .{ .tag = .Text, .name = "mepolang_expression", .desc = "Mepolang expression to run" },
    })[0..],
    .execute = execute,

M src/api/filedump.zig => src/api/filedump.zig +2 -1
@@ 65,11 65,12 @@ fn filedump(mepo: *Mepo, save_types: []const u8, filepath: []const u8) !void {
        // Gestures
        var it_gestures = mepo.table_gestures.iterator();
        while (it_gestures.next()) |gest| {
            const direction : i8 = if (gest.key_ptr.*.direction == .In) 1 else -1;
            const act = if (gest.key_ptr.*.action == .Pan) "pan   " else "rotate";
            const statement_gest = try std.fmt.allocPrint(
                arena.allocator(),
                "bind_gesture {s} {d} {d} [{s}];",
                .{act, gest.key_ptr.*.n_fingers, gest.key_ptr.*.direction, gest.value_ptr.*},
                .{act, gest.key_ptr.*.n_fingers, direction, gest.value_ptr.*},
            );
            try lines.append(statement_gest);
        }