рефакторинг небольшой

This commit is contained in:
2026-02-25 21:27:02 +03:00
parent 9202b527e4
commit 5c9ec3167a
8 changed files with 25 additions and 42 deletions

View File

@@ -8,7 +8,7 @@ const Rect_i = basic_models.Rect_i;
const Size_i = basic_models.Size_i;
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 Canvas = @This();
@@ -29,15 +29,14 @@ _zoom: f32 = 1,
_redraw_pending: bool = false,
_last_redraw_time_ms: i64 = 0,
cursor_document_point: ?Point2_f = null,
/// true — рисовать документ (render), false — пример (gradient/squares).
draw_document: bool = true,
pub fn init(allocator: std.mem.Allocator, document: *Document, engine: RenderEngine, toolbar: Toolbar) Canvas {
pub fn init(allocator: std.mem.Allocator, document: *Document, engine: RenderEngine) Canvas {
return .{
.allocator = allocator,
.document = document,
.render_engine = engine,
.toolbar = toolbar,
.toolbar = Toolbar.init(&tools.default_tools),
};
}