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
+52
-1
@@ -223,7 +223,58 @@ impl TruckConvertible for Arc {
|
||||
}
|
||||
}
|
||||
|
||||
crate::impl_entity_basics!(Arc);
|
||||
impl crate::entities::traits::Grippable for Arc {
|
||||
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};
|
||||
match grip_id {
|
||||
0 => vec![GripMenuItem { label: "Stretch", action: GripMenuAction::Stretch }],
|
||||
3 => vec![
|
||||
GripMenuItem { label: "Stretch", action: GripMenuAction::Stretch },
|
||||
GripMenuItem { label: "Radius", action: GripMenuAction::Radius },
|
||||
GripMenuItem { label: "Arc Length", action: GripMenuAction::ArcLength },
|
||||
],
|
||||
_ => 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,
|
||||
) {
|
||||
// Radius / Arc Length / Lengthen all need a follow-up prompt
|
||||
// (numeric distance / length / radius) — Phase 3.
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::entities::traits::PropertyEditable for Arc {
|
||||
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 Arc {
|
||||
fn apply_transform(&mut self, t: &EntityTransform) {
|
||||
apply_transform(self, t);
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::entities::traits::MassPropsCalc for acadrust::entities::Arc {
|
||||
fn mass_props(&self) -> crate::entities::traits::MassProps {
|
||||
|
||||
Reference in new issue
Block a user