forked from 1b-agent/opencadstudio-upstream
fix(ribbon): highlight View Cube button by toggle state
NAVVCUBE is a command toggle, so it never set active_tool and is_active_tool never matched it. Add a show_viewcube flag to the ribbon (mirroring wireframe/ortho_mode) and special-case "NAVVCUBE" in is_active_tool to return the live show_viewcube state; ToggleViewCube now calls ribbon.set_viewcube.
This commit is contained in:
1 parent
a5c6c3f116
commit
585316945e
3 files changed
+26
-3
No files matched your search
@@ -35,6 +35,8 @@ pub struct Ribbon {
|
||||
active_tool: Option<String>,
|
||||
pub wireframe: bool,
|
||||
pub ortho_mode: bool,
|
||||
/// ViewCube (NAVVCUBE) visibility — drives the View Cube button highlight.
|
||||
pub show_viewcube: bool,
|
||||
pub open_dropdown: Option<String>,
|
||||
/// Title of the collapsed panel whose flyout is currently open, if any.
|
||||
pub collapsed_open: Option<String>,
|
||||
@@ -133,6 +135,7 @@ impl Ribbon {
|
||||
active_tool: None,
|
||||
wireframe: false,
|
||||
ortho_mode: true,
|
||||
show_viewcube: true,
|
||||
open_dropdown: None,
|
||||
collapsed_open: None,
|
||||
last_panel_tool: HashMap::default(),
|
||||
@@ -274,6 +277,9 @@ impl Ribbon {
|
||||
pub fn set_ortho(&mut self, ortho: bool) {
|
||||
self.ortho_mode = ortho;
|
||||
}
|
||||
pub fn set_viewcube(&mut self, on: bool) {
|
||||
self.show_viewcube = on;
|
||||
}
|
||||
|
||||
pub fn toggle_dropdown(&mut self, id: &str) {
|
||||
if self.open_dropdown.as_deref() == Some(id) {
|
||||
@@ -536,6 +542,7 @@ impl Ribbon {
|
||||
&self.last_cmd,
|
||||
self.wireframe,
|
||||
self.ortho_mode,
|
||||
self.show_viewcube,
|
||||
&self.layer_infos,
|
||||
&self.active_layer,
|
||||
self.active_color,
|
||||
@@ -551,6 +558,7 @@ impl Ribbon {
|
||||
&self.last_cmd,
|
||||
self.wireframe,
|
||||
self.ortho_mode,
|
||||
self.show_viewcube,
|
||||
&self.layer_infos,
|
||||
&self.active_layer,
|
||||
self.active_color,
|
||||
@@ -566,6 +574,7 @@ impl Ribbon {
|
||||
&self.last_cmd,
|
||||
self.wireframe,
|
||||
self.ortho_mode,
|
||||
self.show_viewcube,
|
||||
&self.layer_infos,
|
||||
&self.active_layer,
|
||||
self.active_color,
|
||||
@@ -582,6 +591,7 @@ impl Ribbon {
|
||||
&self.last_cmd,
|
||||
self.wireframe,
|
||||
self.ortho_mode,
|
||||
self.show_viewcube,
|
||||
&self.layer_infos,
|
||||
&self.active_layer,
|
||||
self.active_color,
|
||||
@@ -598,6 +608,7 @@ impl Ribbon {
|
||||
&self.last_cmd,
|
||||
self.wireframe,
|
||||
self.ortho_mode,
|
||||
self.show_viewcube,
|
||||
&self.layer_infos,
|
||||
&self.active_layer,
|
||||
self.active_color,
|
||||
@@ -1291,6 +1302,7 @@ fn render_group<'a>(
|
||||
last_cmd: &HashMap<&'static str, &'static str>,
|
||||
wireframe: bool,
|
||||
ortho_mode: bool,
|
||||
show_viewcube: bool,
|
||||
layer_infos: &'a [LayerInfo],
|
||||
active_layer: &'a str,
|
||||
active_color: AcadColor,
|
||||
@@ -1319,6 +1331,7 @@ fn render_group<'a>(
|
||||
last_cmd,
|
||||
wireframe,
|
||||
ortho_mode,
|
||||
show_viewcube,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
@@ -1335,6 +1348,7 @@ fn render_group<'a>(
|
||||
last_cmd,
|
||||
wireframe,
|
||||
ortho_mode,
|
||||
show_viewcube,
|
||||
));
|
||||
if small_buf.len() == 3 {
|
||||
flush_small_col(&mut small_buf, &mut items_row);
|
||||
@@ -1414,6 +1428,7 @@ fn collapse_button<'a>(
|
||||
last_cmd: &HashMap<&'static str, &'static str>,
|
||||
wireframe: bool,
|
||||
ortho_mode: bool,
|
||||
show_viewcube: bool,
|
||||
layer_infos: &'a [LayerInfo],
|
||||
active_layer: &'a str,
|
||||
active_color: AcadColor,
|
||||
@@ -1481,6 +1496,7 @@ fn collapse_button<'a>(
|
||||
last_cmd,
|
||||
wireframe,
|
||||
ortho_mode,
|
||||
show_viewcube,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
@@ -1496,6 +1512,7 @@ fn collapse_button<'a>(
|
||||
last_cmd,
|
||||
wireframe,
|
||||
ortho_mode,
|
||||
show_viewcube,
|
||||
layer_infos,
|
||||
active_layer,
|
||||
active_color,
|
||||
|
||||
Reference in new issue
Block a user