Кнопка для добавления случайных фигур
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user