Skip to content

Commit

Permalink
fix node id conflicts for dock view tabs when using duplicate tab names
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddyFunk committed Aug 23, 2023
1 parent 37f3e68 commit 1a58713
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/wrap_app.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(target_arch = "wasm32")]
use core::any::Any;
use egui::Margin;
use egui::{Id, Margin};
use egui_dock::{DockArea, NodeIndex, Style, Tree};
use std::str::FromStr;

Expand Down Expand Up @@ -129,8 +129,7 @@ impl Tab {
}

fn title(&self) -> String {
let title = self.content.title();
format!("{title} {}", self.node.0)
self.content.title()
}

fn content(&mut self, ui: &mut egui::Ui) {
Expand All @@ -155,6 +154,10 @@ impl egui_dock::TabViewer for TabViewer<'_> {
tab.title().into()
}

fn id(&mut self, tab: &mut Self::Tab) -> Id {
Id::new(tab.node)
}

fn add_popup(&mut self, ui: &mut egui::Ui, node: NodeIndex) {
ui.set_min_width(120.0);
ui.style_mut().visuals.button_frame = false;
Expand Down

0 comments on commit 1a58713

Please sign in to comment.