Ограничение частоты перерисовки до 20 фпс

This commit is contained in:
2026-02-22 22:25:49 +03:00
parent 85a3bac095
commit b6012f1fc4
2 changed files with 30 additions and 2 deletions

View File

@@ -189,6 +189,9 @@ fn gui_frame(ctx: *WindowContext) bool {
canvas.updateVisibleImageRect(viewport_px, scroll_px) catch |err| {
std.debug.print("updateVisibleImageRect error: {}\n", .{err});
};
canvas.processPendingRedraw() catch |err| {
std.debug.print("processPendingRedraw error: {}\n", .{err});
};
const content_w_px: u32 = img_size.x + img_size.w;
const content_h_px: u32 = img_size.y + img_size.h;
@@ -237,7 +240,7 @@ fn gui_frame(ctx: *WindowContext) bool {
switch (action) {
.wheel_y => |y| {
canvas.addZoom(y / 1000);
canvas.redrawExample() catch {};
canvas.requestRedraw();
},
else => {},
}