mirror of
https://github.com/storytold/craft-libs.git
synced 2026-10-13 23:17:44 +00:00
UI.7: serialize docking actions for app command dispatch
This commit is contained in:
1 parent
d9077e2c09
commit
4558a91694
3 files changed
+6
No files matched your search
@@ -94,6 +94,7 @@ pub struct Location<P> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum Action<P> {
|
||||
Move {
|
||||
panel: P,
|
||||
|
||||
@@ -163,6 +163,9 @@ impl Harness {
|
||||
});
|
||||
self.renderer.handle_delta(&mut self.output.textures_delta);
|
||||
for action in actions {
|
||||
// Apps send renderer actions through their JSON command boundary before applying.
|
||||
#[cfg(feature = "serde")]
|
||||
let action: Action<u32> = serde_json::from_value(serde_json::to_value(&action).unwrap()).unwrap();
|
||||
self.layout
|
||||
.apply_with_permissions(action.clone(), |panel| if *panel == CANVAS { Permissions::PROTECTED } else { Permissions::default() })
|
||||
.unwrap();
|
||||
|
||||
@@ -59,6 +59,8 @@ The frontmost containing group blocks targets underneath even when it rejects a
|
||||
The optional `DockArea` renderer handles tab fitting and overflow, drag/drop previews,
|
||||
Escape/focus-loss cancellation, split dividers and floating-group resize grips. It renders a
|
||||
snapshot and returns `DockOutput.actions`; apply them through the application's command path.
|
||||
With `serde` enabled, `Action` also serializes so pointer, keyboard and control-channel requests
|
||||
can share that command path, including splitter changes, tab reorder and floating bounds.
|
||||
Panel body callbacks receive stable global egui IDs, so moving a panel does not reset its widget
|
||||
memory. The application should still keep durable panel/document data outside transient egui
|
||||
widget memory.
|
||||
|
||||
Reference in new issue
Block a user