Улучшены табы
This commit is contained in:
@@ -51,7 +51,7 @@ fn objectTreeRow(open_doc: *WindowContext.OpenDocument, obj: *Object, depth: u32
|
|||||||
.mouse => |*mouse| {
|
.mouse => |*mouse| {
|
||||||
if (!dvui.eventMatchSimple(e, row_data)) continue;
|
if (!dvui.eventMatchSimple(e, row_data)) continue;
|
||||||
hovered = true;
|
hovered = true;
|
||||||
if (mouse.action == .press and mouse.button == .left) {
|
if (mouse.action == .release and mouse.button == .left) {
|
||||||
select_row = true;
|
select_row = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -84,6 +84,7 @@ fn objectTreeRow(open_doc: *WindowContext.OpenDocument, obj: *Object, depth: u32
|
|||||||
};
|
};
|
||||||
if (dvui.buttonIcon(@src(), "Delete object", icons.trash, .{}, .{}, delete_opts)) {
|
if (dvui.buttonIcon(@src(), "Delete object", icons.trash, .{}, .{}, delete_opts)) {
|
||||||
object_callback.* = .{ .delete = obj.id };
|
object_callback.* = .{ .delete = obj.id };
|
||||||
|
select_row = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +123,8 @@ fn objectTree(ctx: *WindowContext) void {
|
|||||||
},
|
},
|
||||||
.delete => |obj_id| {
|
.delete => |obj_id| {
|
||||||
_ = doc.removeObjectById(obj_id);
|
_ = doc.removeObjectById(obj_id);
|
||||||
open_doc.selected_object_id = null;
|
if (open_doc.selected_object_id == obj_id)
|
||||||
|
open_doc.selected_object_id = null;
|
||||||
open_doc.canvas.requestRedraw();
|
open_doc.canvas.requestRedraw();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ fn documentTab(ctx: *WindowContext, index: usize, callback: *?DocCallback) void
|
|||||||
.mouse => |*mouse| {
|
.mouse => |*mouse| {
|
||||||
if (!dvui.eventMatchSimple(e, row_data)) continue;
|
if (!dvui.eventMatchSimple(e, row_data)) continue;
|
||||||
hovered = true;
|
hovered = true;
|
||||||
if (mouse.action == .press and mouse.button == .left) {
|
if (mouse.action == .release and mouse.button == .left) {
|
||||||
select_row = true;
|
select_row = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -67,6 +67,7 @@ fn documentTab(ctx: *WindowContext, index: usize, callback: *?DocCallback) void
|
|||||||
.gravity_y = 0.5,
|
.gravity_y = 0.5,
|
||||||
})) {
|
})) {
|
||||||
callback.* = .{ .close = index };
|
callback.* = .{ .close = index };
|
||||||
|
select_row = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user