forked from 1b-agent/opencadstudio-upstream
feat(grip): entity-specific popup menus for Line/Arc/Dimension
- Line: endpoint grips expose Stretch + Lengthen; midpoint exposes Stretch only. - Arc: endpoint exposes Stretch + Lengthen; midpoint exposes Stretch + Radius + Arc Length; centre exposes Stretch. - Dimension text grip exposes the full text-position vocabulary (Move with Dim Line / with Leader / Independent, Reset Text, Rotate Text, Above Dim Line, Center). Dim-line-position grip exposes Stretch + Reverse Arrows. Extension origins keep the default Stretch. - Each affected entity drops `impl_entity_basics!` and writes the three trait impls (Grippable, PropertyEditable, Transformable) manually so `grip_menu` / `apply_grip_menu` can override. - `apply_grip_menu` handles Reset Text (clear text override) and Center (snap text to midpoint of extension origins) inline; remaining actions stub to no-op pending the follow-up prompt / drag plumbing.
This commit is contained in:
1 parent
595ee3e245
commit
a4c65649e1
3 files changed
+179
-2
No files matched your search
+47
-1
@@ -156,7 +156,53 @@ impl TruckConvertible for Line {
|
||||
}
|
||||
}
|
||||
|
||||
crate::impl_entity_basics!(Line);
|
||||
impl crate::entities::traits::Grippable for Line {
|
||||
fn grips(&self) -> Vec<GripDef> {
|
||||
grips(self)
|
||||
}
|
||||
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
|
||||
apply_grip(self, grip_id, apply);
|
||||
}
|
||||
fn grip_menu(
|
||||
&self,
|
||||
grip_id: usize,
|
||||
) -> Vec<crate::scene::object::GripMenuItem> {
|
||||
use crate::scene::object::{GripMenuAction, GripMenuItem};
|
||||
if grip_id == 2 {
|
||||
vec![GripMenuItem { label: "Stretch", action: GripMenuAction::Stretch }]
|
||||
} else {
|
||||
vec![
|
||||
GripMenuItem { label: "Stretch", action: GripMenuAction::Stretch },
|
||||
GripMenuItem { label: "Lengthen", action: GripMenuAction::Lengthen },
|
||||
]
|
||||
}
|
||||
}
|
||||
fn apply_grip_menu(
|
||||
&mut self,
|
||||
_grip_id: usize,
|
||||
_action: crate::scene::object::GripMenuAction,
|
||||
) {
|
||||
// Lengthen requires a follow-up distance prompt — Phase 3.
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::entities::traits::PropertyEditable for Line {
|
||||
fn geometry_properties(
|
||||
&self,
|
||||
_text_style_names: &[String],
|
||||
) -> PropSection {
|
||||
properties(self)
|
||||
}
|
||||
fn apply_geom_prop(&mut self, field: &str, value: &str) {
|
||||
apply_geom_prop(self, field, value);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::entities::traits::Transformable for Line {
|
||||
fn apply_transform(&mut self, t: &EntityTransform) {
|
||||
apply_transform(self, t);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::entities::traits::MassPropsCalc for acadrust::entities::Line {
|
||||
fn mass_props(&self) -> crate::entities::traits::MassProps {
|
||||
|
||||
Reference in new issue
Block a user