forked from 1b-agent/opencadstudio-upstream
Return from Draw submenus with Escape and place split tools last
This commit is contained in:
1 parent
ac8215c1b7
commit
75cc49d629
3 files changed
+29
-11
No files matched your search
@@ -890,6 +890,9 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn on_command_escape(&mut self) -> Task<Message> {
|
pub(super) fn on_command_escape(&mut self) -> Task<Message> {
|
||||||
|
if self.ribbon.escape_extension() {
|
||||||
|
return Task::none();
|
||||||
|
}
|
||||||
// Esc drops an unconsumed one-shot snap override and closes
|
// Esc drops an unconsumed one-shot snap override and closes
|
||||||
// its menu (#337). Falls through — Esc keeps its usual effect.
|
// its menu (#337). Falls through — Esc keeps its usual effect.
|
||||||
self.snap_override_popup = None;
|
self.snap_override_popup = None;
|
||||||
|
|||||||
+11
-11
@@ -15,7 +15,7 @@ use crate::modules::IconKind;
|
|||||||
use crate::t;
|
use crate::t;
|
||||||
use crate::ui::{icons, wrap_bar::PosReport};
|
use crate::ui::{icons, wrap_bar::PosReport};
|
||||||
|
|
||||||
const PANEL_ID: &str = "draw_extension";
|
pub(super) const PANEL_ID: &str = "draw_extension";
|
||||||
const TITLE_ID: &str = "draw_extension_title";
|
const TITLE_ID: &str = "draw_extension_title";
|
||||||
const SCALE: f32 = 0.7;
|
const SCALE: f32 = 0.7;
|
||||||
const CELL: f32 = 36.0 * SCALE;
|
const CELL: f32 = 36.0 * SCALE;
|
||||||
@@ -54,16 +54,6 @@ const TOOLS: &[Tool] = &[
|
|||||||
icon: include_bytes!("../../../assets/icons/ray.svg"),
|
icon: include_bytes!("../../../assets/icons/ray.svg"),
|
||||||
options: &[],
|
options: &[],
|
||||||
},
|
},
|
||||||
Tool {
|
|
||||||
command: "MULTIPOINT",
|
|
||||||
label: "Multiple Points",
|
|
||||||
icon: include_bytes!("../../../assets/icons/multipoint.svg"),
|
|
||||||
options: &[
|
|
||||||
("POINT", "Single Point"),
|
|
||||||
("MULTIPOINT", "Multiple Points"),
|
|
||||||
("DDPTYPE", "Point Style"),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
Tool {
|
Tool {
|
||||||
command: "DIVIDE",
|
command: "DIVIDE",
|
||||||
label: "Divide",
|
label: "Divide",
|
||||||
@@ -106,6 +96,16 @@ const TOOLS: &[Tool] = &[
|
|||||||
icon: include_bytes!("../../../assets/icons/donut.svg"),
|
icon: include_bytes!("../../../assets/icons/donut.svg"),
|
||||||
options: &[],
|
options: &[],
|
||||||
},
|
},
|
||||||
|
Tool {
|
||||||
|
command: "MULTIPOINT",
|
||||||
|
label: "Multiple Points",
|
||||||
|
icon: include_bytes!("../../../assets/icons/multipoint.svg"),
|
||||||
|
options: &[
|
||||||
|
("POINT", "Single Point"),
|
||||||
|
("MULTIPOINT", "Multiple Points"),
|
||||||
|
("DDPTYPE", "Point Style"),
|
||||||
|
],
|
||||||
|
},
|
||||||
Tool {
|
Tool {
|
||||||
command: "REVCLOUD",
|
command: "REVCLOUD",
|
||||||
label: "Revision Cloud",
|
label: "Revision Cloud",
|
||||||
|
|||||||
@@ -351,6 +351,21 @@ impl Ribbon {
|
|||||||
self.layer_filter.clear();
|
self.layer_filter.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn escape_extension(&mut self) -> bool {
|
||||||
|
let Some(id) = self.open_dropdown.as_deref() else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if !draw_panel::owns_dropdown(id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if id == draw_panel::PANEL_ID {
|
||||||
|
self.close_dropdown();
|
||||||
|
} else {
|
||||||
|
self.open_dropdown = Some(draw_panel::PANEL_ID.to_string());
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
/// Toggle the flyout of a collapsed ribbon panel (identified by its title).
|
/// Toggle the flyout of a collapsed ribbon panel (identified by its title).
|
||||||
pub fn toggle_collapsed_panel(&mut self, id: &str) {
|
pub fn toggle_collapsed_panel(&mut self, id: &str) {
|
||||||
if self.collapsed_open.as_deref() == Some(id) {
|
if self.collapsed_open.as_deref() == Some(id) {
|
||||||
|
|||||||
Reference in new issue
Block a user