Skip to content

Commit

Permalink
Store label selection state per viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jul 3, 2024
1 parent 7922eff commit f7dab92
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/egui/src/text_selection/label_text_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ impl LabelSelectionState {
}

pub fn load(ctx: &Context) -> Self {
ctx.data(|data| data.get_temp::<Self>(Id::NULL))
let id = Id::new(ctx.viewport_id());
ctx.data(|data| data.get_temp::<Self>(id))
.unwrap_or_default()
}

pub fn store(self, ctx: &Context) {
let id = Id::new(ctx.viewport_id());
ctx.data_mut(|data| {
data.insert_temp(Id::NULL, self);
data.insert_temp(id, self);
});
}

Expand Down

0 comments on commit f7dab92

Please sign in to comment.