Fix text selection when there's multiple viewports (#4760)
* Closes https://github.com/emilk/egui/issues/4758 Thanks to @lukexor for finding and diagnosing the problem!
This commit is contained in:
parent
fcb7764e48
commit
1b06c69d01
|
|
@ -774,8 +774,11 @@ impl Context {
|
|||
/// ```
|
||||
pub fn begin_frame(&self, new_input: RawInput) {
|
||||
crate::profile_function!();
|
||||
self.read(|ctx| ctx.plugins.clone()).on_begin_frame(self);
|
||||
|
||||
self.write(|ctx| ctx.begin_frame_mut(new_input));
|
||||
|
||||
// Plugs run just after the frame has started:
|
||||
self.read(|ctx| ctx.plugins.clone()).on_begin_frame(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1807,6 +1810,7 @@ impl Context {
|
|||
crate::gui_zoom::zoom_with_keyboard(self);
|
||||
}
|
||||
|
||||
// Plugins run just before the frame ends.
|
||||
self.read(|ctx| ctx.plugins.clone()).on_end_frame(self);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue