1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Make sure the tab buttons don't cover the RTL "add tab" buttons

This commit is contained in:
Emil Ernerfeldt
2023-05-08 11:04:59 +02:00
parent f5d2bc4e33
commit d4efb3215a
2 changed files with 3 additions and 4 deletions

View File

@@ -88,11 +88,14 @@ impl Tabs {
.rect_filled(ui.max_rect(), 0.0, behavior.tab_bar_color(ui.visuals()));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
// Add buttons such as "add new tab"
behavior.top_bar_rtl_ui(ui, node_id);
ui.spacing_mut().item_spacing.x = 0.0; // Tabs have spacing built-in
ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
ui.set_clip_rect(ui.max_rect()); // Don't cover the `rtl_ui` buttons.
for (i, &child_id) in self.children.iter().enumerate() {
let is_being_dragged = is_being_dragged(ui.ctx(), child_id);

View File

@@ -42,10 +42,6 @@
// Everything is quite dynamic, so we have a bunch of defensive coding that call `warn!` on failure.
// These situations should not happen in normal use, but could happen if the user messes with
// the internals of the tree, putting it in an invalid state.
//
// ## TODO before release:
// * Auto-grid layouts (re-arange as parent is resized)
// * Clip tab titles to not cover "add new tab" button
use egui::{Id, Pos2, Rect};