feat(ribbon): add measurement dropdown

This commit is contained in:
gianlucafiore committed 2026-09-03 19:23:37 -03:00
1 parent e355f524e2
commit 863dd555c1
5 files changed
+172 -2

No files matched your search

+3
View File
@@ -8,7 +8,10 @@ use crate::command::{
use crate::entities::curve::entity_curve;
use crate::entities::traits::EntityTypeOps;
use crate::scene::model::wire_model::WireModel;
use crate::modules::IconKind;
pub const ICON: IconKind =
IconKind::Svg(include_bytes!("../../../../assets/icons/area.svg"));
#[derive(Clone, Copy, PartialEq, Eq)]
enum AreaMode {
Single,
+3 -2
View File
@@ -4,8 +4,8 @@ use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult, WorkingPlane};
use crate::modules::IconKind;
use crate::scene::model::wire_model::WireModel;
pub struct DistCommand {
// Keep the picked point in full f64 precision. Downcasting to f32 here
// loses ~0.03–0.06 units at survey-scale coordinates (e.g. eastings near
@@ -13,7 +13,8 @@ pub struct DistCommand {
first: Option<DVec3>,
plane: WorkingPlane,
}
pub const ICON: IconKind =
IconKind::Svg(include_bytes!("../../../../assets/icons/distance.svg"));
impl DistCommand {
pub fn new() -> Self {
Self {
+16
View File
@@ -43,6 +43,7 @@ impl CadModule for DrawModule {
array, copy, delete, explode, fillet, mirror, offset, rotate, scale, stretch,
translate, trim,
};
use inquiry::{area, dist};
use properties::match_prop;
static GROUPS: std::sync::OnceLock<Vec<RibbonGroup>> = std::sync::OnceLock::new();
@@ -231,6 +232,21 @@ impl CadModule for DrawModule {
cut::tool().into(),
],
},
RibbonGroup {
title: "Measure",
tools: vec![
RibbonItem::LargeDropdown {
id: "MEASURE_MENU",
label: "Measure",
icon: dist::ICON,
items: vec![
("DIST", "Distance", dist::ICON),
("AREA", "Area", area::ICON),
],
default: "DIST",
},
],
},
// Support group lives on the Start tab now (see view.rs:
// start_page_view). Removed from the Draw ribbon to declutter.
]