Заливка и замкнутая фигура

This commit is contained in:
2026-03-03 14:21:55 +03:00
parent e5b8e6735d
commit 32cffb757d
5 changed files with 181 additions and 1 deletions

View File

@@ -392,6 +392,17 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
);
{
const tag = std.meta.activeTag(prop.data);
// Скрываем строку с цветом заливки, если заполнение выключено.
if (tag == .fill_rgba) {
const filled_prop = obj.getProperty(.filled);
const filled = if (filled_prop) |p| p.filled else false;
if (!filled) {
row.deinit();
return;
}
}
dvui.labelNoFmt(@src(), propertyLabel(tag), .{}, .{});
switch (prop.data) {
@@ -694,6 +705,20 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
}
}
},
.closed => |v| {
var next = v;
if (dvui.checkbox(@src(), &next, "Closed", .{})) {
obj.setProperty(canvas.allocator, .{ .data = .{ .closed = next } }) catch {};
canvas.requestRedraw();
}
},
.filled => |v| {
var next = v;
if (dvui.checkbox(@src(), &next, "Filled", .{})) {
obj.setProperty(canvas.allocator, .{ .data = .{ .filled = next } }) catch {};
canvas.requestRedraw();
}
},
}
}
row.deinit();
@@ -731,6 +756,8 @@ fn propertyLabel(tag: std.meta.Tag(PropertyData)) []const u8 {
.fill_rgba => "Fill color",
.stroke_rgba => "Stroke color",
.thickness => "Thickness",
.closed => "Closed",
.filled => "Filled",
};
}