Начало фикса json
This commit is contained in:
@@ -417,7 +417,7 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
changed = res.changed or changed;
|
||||
}
|
||||
if (changed) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .position = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .position = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
@@ -431,7 +431,7 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
subrow.deinit();
|
||||
if (res.changed) {
|
||||
next = degrees * std.math.pi / 180.0;
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .angle = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .angle = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
}
|
||||
@@ -456,28 +456,28 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
changed = res.changed or changed;
|
||||
}
|
||||
if (changed) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .scale = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .scale = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
.visible => |v| {
|
||||
var next = v;
|
||||
if (dvui.checkbox(@src(), &next, "Visible", .{})) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .visible = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .visible = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
.opacity => |opacity| {
|
||||
var next = opacity;
|
||||
if (dvui.sliderEntry(@src(), "{d:0.2}", .{ .value = &next, .min = 0.0, .max = 1.0, .interval = 0.01 }, .{ .expand = .horizontal })) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .opacity = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .opacity = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
.locked => |v| {
|
||||
var next = v;
|
||||
if (dvui.checkbox(@src(), &next, "Locked", .{})) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .locked = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .locked = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
@@ -502,7 +502,7 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
changed = res.changed or changed;
|
||||
}
|
||||
if (changed) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .size = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .size = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
@@ -527,7 +527,7 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
changed = res.changed or changed;
|
||||
}
|
||||
if (changed) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .radii = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .radii = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
@@ -556,7 +556,7 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
changed = res.changed or changed;
|
||||
}
|
||||
if (changed) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .end_point = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .end_point = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
},
|
||||
@@ -578,7 +578,7 @@ fn drawPropertyEditor(canvas: *Canvas, obj: *Document.Object, prop: *const Prope
|
||||
const res = dvui.textEntryNumber(@src(), T, .{ .value = &next, .min = @as(T, 0.0), .max = @as(T, 100.0) }, .{ .expand = .horizontal });
|
||||
subrow.deinit();
|
||||
if (res.changed) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .thickness = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .thickness = next } }) catch {};
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
}
|
||||
@@ -597,9 +597,9 @@ fn drawColorEditor(canvas: *Canvas, obj: *Document.Object, rgba: u32, is_fill: b
|
||||
)) {
|
||||
const next = colorToRgba(hsv.toColor());
|
||||
if (is_fill) {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .fill_rgba = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .fill_rgba = next } }) catch {};
|
||||
} else {
|
||||
obj.setProperty(canvas.document.allocator, .{ .data = .{ .stroke_rgba = next } }) catch {};
|
||||
obj.setProperty(canvas.allocator, .{ .data = .{ .stroke_rgba = next } }) catch {};
|
||||
}
|
||||
canvas.requestRedraw();
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ fn objectTree(ctx: *WindowContext) void {
|
||||
}
|
||||
},
|
||||
.delete => |obj_id| {
|
||||
_ = doc.removeObjectById(obj_id);
|
||||
_ = doc.removeObjectById(ctx.allocator, obj_id);
|
||||
if (open_doc.selected_object_id == obj_id)
|
||||
open_doc.selected_object_id = null;
|
||||
open_doc.canvas.requestRedraw();
|
||||
|
||||
Reference in New Issue
Block a user