feat(area): support multi-object selection

This commit is contained in:
Hakan Seven committed 2026-08-04 00:01:12 +03:00
1 parent 48332ee807
commit 5662e07303
8 files changed
+427 -100

No files matched your search

+33
View File
@@ -20,6 +20,25 @@ pub struct ObjectPickHit {
pub label: &'static str,
}
#[derive(Clone)]
pub struct SelectionEntity {
pub handle: Handle,
pub entity: EntityType,
pub surface_area: Option<f64>,
}
#[derive(Clone)]
pub enum AreaPreviewSource {
Handles(Vec<Handle>),
Boundary(Vec<[f64; 2]>),
}
#[derive(Clone)]
pub struct AreaPreviewRegion {
pub source: AreaPreviewSource,
pub subtract: bool,
}
// ── Transform ─────────────────────────────────────────────────────────────
/// A geometric transformation applied to existing entities.
@@ -908,6 +927,10 @@ pub enum CmdResult {
Measurement(String),
/// Print a measurement result and keep the command active.
ReportMeasurement(String),
/// Print a measurement result, clear the current selection, and keep the command active.
ReportMeasurementAndDeselect(String),
/// Clear the current selection and keep the command active at its updated step.
DeselectAndContinue,
/// Break `handle` at points `p1` and `p2`; replace with computed fragments.
BreakEntity { handle: Handle, p1: DVec3, p2: DVec3 },
/// Attempt to join the given entities into fewer merged entities.
@@ -1473,6 +1496,10 @@ pub trait CadCommand: Send {
false
}
fn selection_forces_add(&self) -> bool {
false
}
/// Called after a selection action completes while `is_selection_gathering` is true.
/// `handles` is the full set of currently selected entities.
/// Return `Relaunch` to fire the pending command, or `NeedPoint` to keep gathering.
@@ -1480,6 +1507,12 @@ pub trait CadCommand: Send {
CmdResult::Cancel
}
fn inject_selection_entities(&mut self, _entities: Vec<SelectionEntity>) {}
fn area_preview_regions(&self) -> Option<Vec<AreaPreviewRegion>> {
None
}
/// Returns `true` when the current step picks a corner of a selection
/// *window* by point (e.g. STRETCH's crossing window). Such a pick must be a
/// free point: applying the Ortho/Polar lock would pin the opposite corner to