какое то скроллирование
This commit is contained in:
@@ -9,6 +9,11 @@ canvas_texture: ?dvui.Texture = null,
|
||||
canvas_width: u32 = 400,
|
||||
canvas_height: u32 = 300,
|
||||
canvas_pos: dvui.Point = dvui.Point{ .x = 0, .y = 0 },
|
||||
canvas_scroll: dvui.ScrollInfo = .{
|
||||
.vertical = .given,
|
||||
.horizontal = .given,
|
||||
.virtual_size = .{ .w = 2000, .h = 2000 },
|
||||
},
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator) WindowContext {
|
||||
return .{
|
||||
@@ -61,6 +66,12 @@ pub fn fillRandomColor(self: *WindowContext) !void {
|
||||
|
||||
// Создать новую текстуру из пиксельных данных
|
||||
self.canvas_texture = try dvui.textureCreate(pixels, self.canvas_width, self.canvas_height, .linear);
|
||||
|
||||
// Дать скроллам ощутимый диапазон сразу (минимум 2000x2000)
|
||||
self.canvas_scroll.virtual_size = .{
|
||||
.w = @max(2000, @as(f32, @floatFromInt(self.canvas_width))),
|
||||
.h = @max(2000, @as(f32, @floatFromInt(self.canvas_height))),
|
||||
};
|
||||
}
|
||||
|
||||
/// Отобразить canvas в UI
|
||||
|
||||
Reference in New Issue
Block a user