Кнопка для добавления случайных фигур

This commit is contained in:
2026-02-26 00:03:22 +03:00
parent b6e14cd74d
commit 563c2a7535
2 changed files with 9 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ const Point2_f = @import("models/basic_models.zig").Point2_f;
const Color = dvui.Color;
const tools = @import("tools.zig");
const Toolbar = @import("Toolbar.zig");
const random_document = @import("random_document.zig");
const Canvas = @This();
allocator: std.mem.Allocator,
@@ -84,6 +85,11 @@ pub fn exampleReset(self: *Canvas) !void {
try self.redraw();
}
pub fn addRandomShapes(self: *Canvas) !void {
try random_document.addRandomShapes(self.document, std.crypto.random);
self.requestRedraw();
}
pub fn setZoom(self: *Canvas, value: f32) void {
self._zoom = @max(value, 0.01);
}