forked from 1b-agent/opencadstudio-upstream
Merge PR #1215: add rectangle grip dimensions
This commit is contained in:
commit
7c5a388f19
12 files changed
+559
-64
No files matched your search
@@ -175,6 +175,9 @@ pub enum GripMenuAction {
|
||||
Lengthen,
|
||||
Radius,
|
||||
ArcLength,
|
||||
RectangleWidth,
|
||||
RectangleHeight,
|
||||
RectangleResize,
|
||||
AddVertex,
|
||||
RemoveVertex,
|
||||
ConvertToArc,
|
||||
|
||||
@@ -48,6 +48,8 @@ pub struct GripEdit {
|
||||
pub axis: Option<DVec3>,
|
||||
/// Every hot grip moved by this edit. A normal grip edit contains one target.
|
||||
pub targets: Vec<GripTarget>,
|
||||
/// Opposite corner and local width/height axes for rectangle corner resize.
|
||||
pub rectangle_frame: Option<(DVec3, DVec3, DVec3)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
@@ -56,6 +58,9 @@ pub enum GripEditMode {
|
||||
Lengthen,
|
||||
Radius,
|
||||
ArcLength,
|
||||
RectangleWidth,
|
||||
RectangleHeight,
|
||||
RectangleResize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -86,6 +91,7 @@ impl GripEdit {
|
||||
is_translate,
|
||||
last_world: world,
|
||||
}],
|
||||
rectangle_frame: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +112,32 @@ impl GripEdit {
|
||||
edit.mode = GripEditMode::ArcLength;
|
||||
edit
|
||||
}
|
||||
|
||||
pub fn rectangle_width(handle: Handle, grip_id: usize, world: DVec3) -> Self {
|
||||
let mut edit = Self::single(handle, grip_id, false, world);
|
||||
edit.mode = GripEditMode::RectangleWidth;
|
||||
edit
|
||||
}
|
||||
|
||||
pub fn rectangle_height(handle: Handle, grip_id: usize, world: DVec3) -> Self {
|
||||
let mut edit = Self::single(handle, grip_id, false, world);
|
||||
edit.mode = GripEditMode::RectangleHeight;
|
||||
edit
|
||||
}
|
||||
|
||||
pub fn rectangle_resize(
|
||||
handle: Handle,
|
||||
grip_id: usize,
|
||||
world: DVec3,
|
||||
opposite: DVec3,
|
||||
width_axis: DVec3,
|
||||
height_axis: DVec3,
|
||||
) -> Self {
|
||||
let mut edit = Self::single(handle, grip_id, false, world);
|
||||
edit.mode = GripEditMode::RectangleResize;
|
||||
edit.rectangle_frame = Some((opposite, width_axis, height_axis));
|
||||
edit
|
||||
}
|
||||
}
|
||||
|
||||
// ── Screen-space helpers ───────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user