forked from 1b-agent/opencadstudio-upstream
refactor(statusbar): bundle view inputs
This commit is contained in:
1 parent
f0479a5fc6
commit
b89689cd03
2 files changed
+129
-89
No files matched your search
+40
-34
@@ -2541,40 +2541,46 @@ bg={bg_ms:.1}ms n={view_count}"
|
|||||||
};
|
};
|
||||||
self.status_bar.view(
|
self.status_bar.view(
|
||||||
&self.snapper,
|
&self.snapper,
|
||||||
self.ortho_mode,
|
crate::ui::statusbar::StatusBarLayoutState {
|
||||||
self.polar_mode,
|
layouts: layout_names,
|
||||||
self.polar_increment_deg,
|
block_tabs,
|
||||||
self.dyn_input,
|
current_layout: &tab.scene.current_layout,
|
||||||
self.snapper.otrack_enabled,
|
active_block,
|
||||||
self.isometric_drafting,
|
is_start: tab.is_start,
|
||||||
self.iso_plane,
|
rename_state: self.layout_rename_state.as_ref(),
|
||||||
layout_names,
|
viewport_scale: tab.scene.first_viewport_scale(),
|
||||||
block_tabs,
|
viewport_count: tab.scene.viewport_count(),
|
||||||
&tab.scene.current_layout,
|
in_mspace: tab.scene.active_viewport.is_some(),
|
||||||
active_block,
|
show_layout_tabs: self.show_layout_tabs,
|
||||||
tab.is_start,
|
annotation_scale: tab.scene.annotation_scale,
|
||||||
self.layout_rename_state.as_ref(),
|
scale_pill_enabled,
|
||||||
tab.scene.first_viewport_scale(),
|
annotation_all_visible: tab.scene.annotation_all_visible(),
|
||||||
tab.scene.viewport_count(),
|
annotation_auto_add: self.annotation_auto_scale > 0,
|
||||||
tab.scene.active_viewport.is_some(),
|
viewport_scale_synced: tab.scene.viewport_annotation_scale_synced(),
|
||||||
self.show_layout_tabs,
|
lineweight_display: tab.scene.document.header.lineweight_display,
|
||||||
tab.scene.annotation_scale,
|
},
|
||||||
scale_pill_enabled,
|
crate::ui::statusbar::StatusBarModes {
|
||||||
tab.scene.annotation_all_visible(),
|
ortho_mode: self.ortho_mode,
|
||||||
self.annotation_auto_scale > 0,
|
polar_mode: self.polar_mode,
|
||||||
tab.scene.viewport_annotation_scale_synced(),
|
polar_increment_deg: self.polar_increment_deg,
|
||||||
tab.scene.document.header.lineweight_display,
|
dyn_input: self.dyn_input,
|
||||||
cursor_coord,
|
otrack: self.snapper.otrack_enabled,
|
||||||
coords_mode,
|
isometric_drafting: self.isometric_drafting,
|
||||||
last_coord,
|
iso_plane: self.iso_plane,
|
||||||
picking,
|
clean_screen: self.clean_screen,
|
||||||
self.clean_screen,
|
linear_format: tab.scene.document.header.linear_unit_format,
|
||||||
tab.scene.document.header.linear_unit_format,
|
isolation_active: tab.scene.is_isolation_active(),
|
||||||
tab.scene.is_isolation_active(),
|
transparency_display: tab.scene.transparency_display,
|
||||||
tab.scene.transparency_display,
|
quick_properties: self.quick_properties,
|
||||||
self.quick_properties,
|
selection_filter_active: tab.scene.selection_filter_active(),
|
||||||
tab.scene.selection_filter_active(),
|
selection_cycling: self.selection_cycling,
|
||||||
self.selection_cycling,
|
},
|
||||||
|
crate::ui::statusbar::StatusBarReadout {
|
||||||
|
cursor_world: cursor_coord,
|
||||||
|
coords_mode,
|
||||||
|
last_point: last_coord,
|
||||||
|
picking,
|
||||||
|
},
|
||||||
&self.statusbar_config,
|
&self.statusbar_config,
|
||||||
status_menu_data,
|
status_menu_data,
|
||||||
tab.scene
|
tab.scene
|
||||||
|
|||||||
+89
-55
@@ -52,6 +52,52 @@ pub struct StatusMenuData<'a> {
|
|||||||
pub tooltip_hidden: bool,
|
pub tooltip_hidden: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Drawing/layout inputs used to build the status bar's layout and scale controls.
|
||||||
|
pub struct StatusBarLayoutState<'a> {
|
||||||
|
pub layouts: Arc<Vec<String>>,
|
||||||
|
pub block_tabs: Vec<String>,
|
||||||
|
pub current_layout: &'a str,
|
||||||
|
pub active_block: Option<String>,
|
||||||
|
pub is_start: bool,
|
||||||
|
pub rename_state: Option<&'a (String, String)>,
|
||||||
|
pub viewport_scale: Option<f64>,
|
||||||
|
pub viewport_count: usize,
|
||||||
|
pub in_mspace: bool,
|
||||||
|
pub show_layout_tabs: bool,
|
||||||
|
pub annotation_scale: f32,
|
||||||
|
pub scale_pill_enabled: bool,
|
||||||
|
pub annotation_all_visible: bool,
|
||||||
|
pub annotation_auto_add: bool,
|
||||||
|
pub viewport_scale_synced: Option<bool>,
|
||||||
|
pub lineweight_display: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Drafting modes and document settings represented by status bar controls.
|
||||||
|
pub struct StatusBarModes {
|
||||||
|
pub ortho_mode: bool,
|
||||||
|
pub polar_mode: bool,
|
||||||
|
pub polar_increment_deg: f32,
|
||||||
|
pub dyn_input: bool,
|
||||||
|
pub otrack: bool,
|
||||||
|
pub isometric_drafting: bool,
|
||||||
|
pub iso_plane: crate::app::settings::IsoPlane,
|
||||||
|
pub clean_screen: bool,
|
||||||
|
pub linear_format: i16,
|
||||||
|
pub isolation_active: bool,
|
||||||
|
pub transparency_display: bool,
|
||||||
|
pub quick_properties: bool,
|
||||||
|
pub selection_filter_active: bool,
|
||||||
|
pub selection_cycling: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Cursor coordinate readout inputs.
|
||||||
|
pub struct StatusBarReadout {
|
||||||
|
pub cursor_world: glam::DVec3,
|
||||||
|
pub coords_mode: i16,
|
||||||
|
pub last_point: Option<glam::DVec3>,
|
||||||
|
pub picking: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct StatusBar {
|
pub struct StatusBar {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@@ -68,61 +114,9 @@ impl StatusBar {
|
|||||||
pub fn view<'a>(
|
pub fn view<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
snapper: &'a Snapper,
|
snapper: &'a Snapper,
|
||||||
ortho_mode: bool,
|
layout: StatusBarLayoutState<'a>,
|
||||||
polar_mode: bool,
|
modes: StatusBarModes,
|
||||||
polar_increment_deg: f32,
|
readout: StatusBarReadout,
|
||||||
dyn_input: bool,
|
|
||||||
otrack: bool,
|
|
||||||
isometric_drafting: bool,
|
|
||||||
iso_plane: crate::app::settings::IsoPlane,
|
|
||||||
layouts: Arc<Vec<String>>,
|
|
||||||
block_tabs: Vec<String>,
|
|
||||||
current_layout: &'a str,
|
|
||||||
active_block: Option<String>,
|
|
||||||
// Start/welcome view has no drawing to own layouts.
|
|
||||||
is_start: bool,
|
|
||||||
// If `Some((original, edit_value))`, the named tab shows a text input.
|
|
||||||
rename_state: Option<&'a (String, String)>,
|
|
||||||
// Scale of the first user viewport in the active paper layout.
|
|
||||||
viewport_scale: Option<f64>,
|
|
||||||
// Number of user viewports in the current paper layout (0 = model space).
|
|
||||||
viewport_count: usize,
|
|
||||||
// True when the user is editing inside a paper-space viewport (MSPACE).
|
|
||||||
in_mspace: bool,
|
|
||||||
// Whether the layout tabs (Model/Paper) are visible (LAYOUTTAB).
|
|
||||||
show_layout_tabs: bool,
|
|
||||||
// Current annotation scale for model space (1.0 = 1:1, 50.0 = 1:50, etc.).
|
|
||||||
annotation_scale: f32,
|
|
||||||
// True when the scale pill is interactive (always model space; paper space only when a viewport is active/selected).
|
|
||||||
scale_pill_enabled: bool,
|
|
||||||
annotation_all_visible: bool,
|
|
||||||
annotation_auto_add: bool,
|
|
||||||
viewport_scale_synced: Option<bool>,
|
|
||||||
// LWDISPLAY header flag — controls lineweight visibility in the viewport.
|
|
||||||
lineweight_display: bool,
|
|
||||||
// Live cursor position in model coordinates, for the coordinate readout.
|
|
||||||
cursor_world: glam::DVec3,
|
|
||||||
// $COORDS readout mode: 0 = static (updates only on a pick), 1 = live
|
|
||||||
// absolute, 2 = polar (distance<angle from the last point while picking).
|
|
||||||
coords_mode: i16,
|
|
||||||
// The last committed point, for the static (0) and polar (2) readouts.
|
|
||||||
last_point: Option<glam::DVec3>,
|
|
||||||
// True while a command is prompting for a point (enables the polar readout).
|
|
||||||
picking: bool,
|
|
||||||
// True while clean-screen mode hides the ribbon and side panels.
|
|
||||||
clean_screen: bool,
|
|
||||||
// LUNITS — how lengths are written, for the units pill.
|
|
||||||
linear_format: i16,
|
|
||||||
// True when objects are hidden by Isolate / Hide.
|
|
||||||
isolation_active: bool,
|
|
||||||
// Whether entity transparency is shown (Transparency pill state).
|
|
||||||
transparency_display: bool,
|
|
||||||
// Whether the Quick Properties floating panel is enabled.
|
|
||||||
quick_properties: bool,
|
|
||||||
// True when the selection filter is excluding at least one type.
|
|
||||||
selection_filter_active: bool,
|
|
||||||
// Whether selection cycling is enabled.
|
|
||||||
selection_cycling: bool,
|
|
||||||
// Which pills the user has chosen to show on the bar.
|
// Which pills the user has chosen to show on the bar.
|
||||||
config: &'a StatusBarConfig,
|
config: &'a StatusBarConfig,
|
||||||
menu_data: StatusMenuData<'a>,
|
menu_data: StatusMenuData<'a>,
|
||||||
@@ -140,6 +134,46 @@ impl StatusBar {
|
|||||||
gpu_status: &'a crate::scene::pipeline::GpuStatus,
|
gpu_status: &'a crate::scene::pipeline::GpuStatus,
|
||||||
spacemouse: Option<Element<'a, Message>>,
|
spacemouse: Option<Element<'a, Message>>,
|
||||||
) -> Element<'a, Message> {
|
) -> Element<'a, Message> {
|
||||||
|
let StatusBarLayoutState {
|
||||||
|
layouts,
|
||||||
|
block_tabs,
|
||||||
|
current_layout,
|
||||||
|
active_block,
|
||||||
|
is_start,
|
||||||
|
rename_state,
|
||||||
|
viewport_scale,
|
||||||
|
viewport_count,
|
||||||
|
in_mspace,
|
||||||
|
show_layout_tabs,
|
||||||
|
annotation_scale,
|
||||||
|
scale_pill_enabled,
|
||||||
|
annotation_all_visible,
|
||||||
|
annotation_auto_add,
|
||||||
|
viewport_scale_synced,
|
||||||
|
lineweight_display,
|
||||||
|
} = layout;
|
||||||
|
let StatusBarModes {
|
||||||
|
ortho_mode,
|
||||||
|
polar_mode,
|
||||||
|
polar_increment_deg,
|
||||||
|
dyn_input,
|
||||||
|
otrack,
|
||||||
|
isometric_drafting,
|
||||||
|
iso_plane,
|
||||||
|
clean_screen,
|
||||||
|
linear_format,
|
||||||
|
isolation_active,
|
||||||
|
transparency_display,
|
||||||
|
quick_properties,
|
||||||
|
selection_filter_active,
|
||||||
|
selection_cycling,
|
||||||
|
} = modes;
|
||||||
|
let StatusBarReadout {
|
||||||
|
cursor_world,
|
||||||
|
coords_mode,
|
||||||
|
last_point,
|
||||||
|
picking,
|
||||||
|
} = readout;
|
||||||
let StatusMenuData {
|
let StatusMenuData {
|
||||||
layout_names,
|
layout_names,
|
||||||
polar_custom_input,
|
polar_custom_input,
|
||||||
|
|||||||
Reference in new issue
Block a user