minimal-port rewrite: 14 edits (split rename 6, dock 2, deps 2, dock rename 1, split 1, keymap 1, keymap rename 1)

This commit is contained in:
aiongg committed 2026-11-24 00:54:30 +00:00
1 parent 58b758f247
commit 9583d9238a
4 files changed
+15 -11

No files matched your search

+1
View File
@@ -95,6 +95,7 @@ craft-materialx = { git = "https://github.com/aiongg/craft-libs", rev = "22e82c9
# MCMAT v3 uses its merged archive revision and the matching ZIP crate
craft-mcmat = { git = "https://github.com/aiongg/craft-libs", rev = "22e82c930ec7062fba45757a8cac8ba5e3cb94bc" }
craft-ui = { git = "https://github.com/aiongg/craft-libs", rev = "22e82c930ec7062fba45757a8cac8ba5e3cb94bc" }
craft-behavior = { git = "https://github.com/aiongg/craft-libs", rev = "22e82c930ec7062fba45757a8cac8ba5e3cb94bc" }
# Keyboard bindings (chords, dispatch and display text): storytold/craft-libs, MIT OR Apache-2.0
craft-keymap = { git = "https://github.com/aiongg/craft-libs", rev = "22e82c930ec7062fba45757a8cac8ba5e3cb94bc", features = ["egui"] }
# Native dialogs that do not block the event loop: storytold/craft-libs, MIT OR Apache-2.0
+1
View File
@@ -14,6 +14,7 @@ materialcraft-render = { workspace = true }
eframe = { workspace = true, features = ["default_fonts", "wgpu", "persistence"] }
egui = { workspace = true }
craft-ui = { workspace = true }
craft-behavior = { workspace = true }
craft-keymap = { workspace = true, features = ["egui"] }
egui-phosphor = { version = "0.14", features = ["regular"] }
serde = { workspace = true }
+11 -9
View File
@@ -8,8 +8,10 @@
//! cannot close or float. The layout persists with `UiState` as a craft-ui `Workspace`; a layout
//! that does not load or validate becomes the default.
use craft_ui::docking::{Action, DockArea, DockContent, DockStyle, Layout, Location, Node, PanelLimits, PanelState, Permissions, Placement};
use craft_ui::layout::{SplitAxis, SplitSize};
use craft_behavior::dock::{Action, DockPlacement, Layout, Location, Node, PanelState, Permissions};
use craft_ui::docking::{DockArea, DockContent, DockStyle, PanelLimits};
use craft_behavior::flow::Axis;
use craft_behavior::dock::SplitSize;
use egui::{Id, Margin, RichText, Ui, vec2};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -75,7 +77,7 @@ impl Panel {
}
/// The saved panel arrangement: craft-ui's workspace over MaterialCraft's panels.
pub type Workspace = craft_ui::docking::Workspace<Panel>;
pub type Workspace = craft_behavior::dock::Workspace<Panel>;
/// The graph never moves, floats, closes or takes tabs; panels dock beside it.
pub fn permissions(panel: &Panel) -> Permissions {
@@ -86,7 +88,7 @@ fn tabs(panels: &[Panel]) -> Node<Panel> {
Node::Tabs { panels: panels.to_vec(), active: 0 }
}
fn split(axis: SplitAxis, ratio: f32, first: Node<Panel>, second: Node<Panel>) -> Node<Panel> {
fn split(axis: Axis, ratio: f32, first: Node<Panel>, second: Node<Panel>) -> Node<Panel> {
Node::Split { axis, size: SplitSize::Ratio(ratio), first: Box::new(first), second: Box::new(second) }
}
@@ -94,17 +96,17 @@ fn split(axis: SplitAxis, ratio: f32, first: Node<Panel>, second: Node<Panel>) -
/// middle; properties on the right. Console and history are closed and open floating.
pub fn default_workspace() -> Workspace {
use Panel::*;
let left = split(SplitAxis::Vertical, 0.36, tabs(&[Explorer]), tabs(&[Library]));
let views = split(SplitAxis::Horizontal, 0.5, tabs(&[View3d]), tabs(&[View2d]));
let center = split(SplitAxis::Vertical, 0.52, tabs(&[Graph]), views);
let root = split(SplitAxis::Horizontal, 0.15, left, split(SplitAxis::Horizontal, 0.8, center, tabs(&[Properties])));
let left = split(Axis::Y, 0.36, tabs(&[Explorer]), tabs(&[Library]));
let views = split(Axis::X, 0.5, tabs(&[View3d]), tabs(&[View2d]));
let center = split(Axis::Y, 0.52, tabs(&[Graph]), views);
let root = split(Axis::X, 0.15, left, split(Axis::X, 0.8, center, tabs(&[Properties])));
let mut workspace = Workspace::new(Layout { root: Some(root), floating: Vec::new() });
for panel in Panel::ALL {
if let Some(rect) = panel.float_rect() {
let location = Location {
floating: Some(rect),
anchor: None,
placement: Placement::Tab { before: None },
placement: DockPlacement::Tab { before: None },
size: None,
stack: None,
sibling: Vec::new(),
+2 -2
View File
@@ -1,6 +1,6 @@
//! Menu actions and shortcuts share stable command ids
use craft_keymap::{Active, Bindable, Binding, Chord, Keymap, Platform, Scope, Scopes};
use craft_keymap::{Active, Binding, Chord, CommandDef, Keymap, Platform, Scope, Scopes};
use egui::class::HasClasses as _;
use serde_json::Value;
@@ -318,7 +318,7 @@ pub(crate) fn shortcut_table() -> Vec<(&'static str, &'static str)> {
pub(crate) fn keymap(platform: Platform) -> Keymap {
let catalog = shortcut_table()
.into_iter()
.filter_map(|(id, text)| Some(Bindable::new(id, id, Scope::app()).with_default(Binding::new(parse_shortcut(text)?))))
.filter_map(|(id, text)| Some(CommandDef::new(id, id, Scope::app()).with_default(Binding::new(parse_shortcut(text)?))))
.collect();
Keymap::new(catalog, Scopes::new(), platform)
}