Merge remote-tracking branch 'origin/main' into codex/dwf-dgn-underlays

# Conflicts:
#	Cargo.lock
This commit is contained in:
ramox81 committed 2026-09-28 16:13:14 +03:00
commit fecbcd8138
51 files changed
+4155 -294

No files matched your search

+49
View File
@@ -929,6 +929,55 @@ impl OpenCADStudio {
}
}
}
// TRANSPARENCY — raster images show transparent pixels (ON) or
// draw every pixel in its colour (OFF).
"TRANSPARENCY" => {
let c = crate::modules::insert::image_transparency::TransparencyCommand::new();
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
}
"TRANSPARENCY MODE" | "TRANSPARENCY ON" | "TRANSPARENCY OFF" => {
use codec::entities::ImageDisplayFlags;
let images: Vec<(codec::Handle, bool)> = self.tabs[i]
.scene
.selected_entities()
.iter()
.filter(|(handle, _)| !self.tabs[i].scene.is_layer_locked(*handle))
.filter_map(|(handle, _)| match self.tabs[i].scene.document.get_entity(*handle) {
Some(codec::EntityType::RasterImage(image)) => {
Some((*handle, image.flags.contains(ImageDisplayFlags::TRANSPARENCY_ON)))
}
_ => None,
})
.collect();
let Some(&(_, first_on)) = images.first() else {
return Some(Task::none());
};
let handles: Vec<codec::Handle> = images.iter().map(|(handle, _)| *handle).collect();
if cmd == "TRANSPARENCY MODE" {
let c = crate::modules::insert::image_transparency::TransparencyCommand::mode(
handles, first_on,
);
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
} else {
let on = cmd == "TRANSPARENCY ON";
self.push_undo_snapshot(i, "TRANSPARENCY");
for handle in &handles {
if let Some(codec::EntityType::RasterImage(image)) =
self.tabs[i].scene.document.get_entity_mut(*handle)
{
image.flags.set(ImageDisplayFlags::TRANSPARENCY_ON, on);
}
}
let changes: Vec<_> = handles
.iter()
.map(|handle| (*handle, crate::scene::ChangeKind::Modified))
.collect();
self.tabs[i].scene.bump_entities(&changes);
self.tabs[i].dirty = true;
}
}
// UNDERLAY — edit properties of selected PDF/DWF/DGN underlay entities.
// Usage:
// UNDERLAY FADE <0-80>
+1
View File
@@ -717,6 +717,7 @@ inventory::submit!(crate::command::CommandRegistration {
"IM",
"IMAGE",
"IMAGEATTACH",
"TRANSPARENCY",
"IMAGEEMBED",
"IMPORTOBJ",
"ISOLATEOBJECTS",
+22 -9
View File
@@ -1417,7 +1417,7 @@ impl OpenCADStudio {
// The engaged grip is the rubber-band origin. Perpendicular
// snapping must drop its foot from this point, including when a
// hot-grip set is moved by the same drag vector.
self.snapper.from_point = Some(grip.origin_world.as_vec3());
self.snapper.from_point = Some(grip.origin_world);
let (go, gr) = self.drafting_grid_basis(i);
let base = grip.origin_world;
let construction_ray =
@@ -2137,10 +2137,9 @@ impl OpenCADStudio {
)
} else {
let (go, gr) = self.drafting_grid_basis(i);
// The snapper is a screen-space (f32) engine; the f64
// base only matters for typed-input precision, so hand it
// the downcast point here.
self.snapper.from_point = self.last_point.map(|p| p.as_vec3());
// Construction anchor for perpendicular and tangent snaps
// in full f64 precision.
self.snapper.from_point = self.last_point;
let construction_ray = if is_window_corner {
None
@@ -2556,8 +2555,15 @@ impl OpenCADStudio {
.as_ref()
.map(|c| c.object_pick_hover_previews(&self.tabs[i].scene, effective))
.unwrap_or_default();
let live_tangent = self.tabs[i].snap_result.and_then(|s| {
if s.snap_type == crate::snap::SnapType::Tangent {
s.tangent_obj
} else {
None
}
});
if let Some(cmd) = self.tabs[i].active_cmd.as_mut() {
p.extend(cmd.on_preview_wires(effective));
p.extend(cmd.on_preview_wires_with_tangent(effective, live_tangent));
}
p
} else if needs_entity && deferred_command_hover {
@@ -2693,10 +2699,17 @@ impl OpenCADStudio {
} else if let Some(wires) = self.dimension_preview_wires(i, effective) {
wires
} else {
let live_tangent = self.tabs[i].snap_result.and_then(|s| {
if s.snap_type == crate::snap::SnapType::Tangent {
s.tangent_obj
} else {
None
}
});
self.tabs[i]
.active_cmd
.as_mut()
.map(|c| c.on_preview_wires(effective))
.map(|c| c.on_preview_wires_with_tangent(effective, live_tangent))
.unwrap_or_default()
};
// Polar tracking guide line: dotted line from last_point along
@@ -2943,7 +2956,7 @@ impl OpenCADStudio {
// Perpendicular and tangent measure from `from`, else the running
// command's last point; the live cursor's base point is restored.
let live_from = self.snapper.from_point;
self.snapper.from_point = from.or(self.last_point).map(|p| p.as_vec3());
self.snapper.from_point = from.or(self.last_point);
let (go, gr) = self.drafting_grid_basis(i);
let hit = self
.snapper
@@ -3784,7 +3797,7 @@ impl OpenCADStudio {
)
} else {
let (go, gr) = self.drafting_grid_basis(i);
self.snapper.from_point = self.last_point.map(|p| p.as_vec3());
self.snapper.from_point = self.last_point;
let construction_ray = if is_window_corner {
None
+1 -1
View File
@@ -234,7 +234,7 @@ impl OpenCADStudio {
let saved_from = self.snapper.from_point;
self.snapper.grid_snap_on = false;
self.snapper.from_point =
saved_from.map(|p| frame.paper_to_model(p.as_dvec3()).as_vec3());
saved_from.map(|p| frame.paper_to_model(p));
let hit = self.snapper.snap(
model_cursor,
local,