More ui copy stuff

This commit is contained in:
Mike Dilger 2022-12-28 16:58:17 +13:00
parent fab8c7400b
commit 1d4e65a963
2 changed files with 9 additions and 6 deletions

View File

@ -171,7 +171,10 @@ fn render_post(
ui.add_space(10.0); ui.add_space(10.0);
ui.label("(i)").on_hover_ui(|ui| { if ui.add(CopyButton {}).clicked() {
ui.output().copied_text = event.id.as_hex_string();
}
ui.label("[ID]").on_hover_ui(|ui| {
ui.label(&format!("ID: {}", event.id.as_hex_string())); ui.label(&format!("ID: {}", event.id.as_hex_string()));
}); });
}); });

View File

@ -32,8 +32,8 @@ impl CopyButton {
closed: false, closed: false,
fill: Color32::TRANSPARENT, fill: Color32::TRANSPARENT,
stroke: Stroke { stroke: Stroke {
width: 1.5, width: 1.0,
color: Color32::from_rgb(0xb1, 0xa2, 0x96), color: Color32::from_rgb(0x8d, 0x7f, 0x73),
}, },
})); }));
@ -63,8 +63,8 @@ impl CopyButton {
closed: true, closed: true,
fill: Color32::TRANSPARENT, fill: Color32::TRANSPARENT,
stroke: Stroke { stroke: Stroke {
width: 1.5, width: 1.0,
color: Color32::from_rgb(0xb1, 0xa2, 0x96), color: Color32::from_rgb(0x8d, 0x7f, 0x73),
}, },
})); }));
} }
@ -88,7 +88,7 @@ impl Widget for CopyButton {
x: rect.min.x + padding.x + shift, x: rect.min.x + padding.x + shift,
y: rect.min.y + padding.y + shift, y: rect.min.y + padding.y + shift,
}; };
Self::paint(ui, pos); Self::paint(ui, ui.painter().round_pos_to_pixels(pos));
response response
} }