forked from 1b-agent/opencadstudio-upstream
fix(precision): keep BLOCK base and TEXT/MTEXT insertion points in f64 (#311)
Three commit helpers narrowed a typed/picked point back to f32 before it reached the persisted entity, so the coordinate was quantized to the f32 grid (worse at large/UTM extents): - Scene::create_block_from_entities took the base point as glam::Vec3, so the block's local-space translation and the replacement INSERT's insert point were f32. Param is now DVec3 (matching the sibling define_block_from_owned_entities); the command_driver handler no longer downcasts with as_vec3(). - The MTEXT and TEXT in-place editors stored `pos` as Vec3 and built the committed insertion_point from it, quantizing a new label's position and re-quantizing an existing one on edit. Both `pos` fields are now DVec3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f89b78a7e
commit
553b91015f
5 files changed
+20
-20
No files matched your search
+3
-3
@@ -250,7 +250,7 @@ impl Scene {
|
||||
&mut self,
|
||||
handles: &[Handle],
|
||||
name: &str,
|
||||
base: glam::Vec3,
|
||||
base: glam::DVec3,
|
||||
) -> Result<Handle, String> {
|
||||
let name = name.trim();
|
||||
if name.is_empty() {
|
||||
@@ -299,7 +299,7 @@ impl Scene {
|
||||
.add_entity(EntityType::BlockEnd(block_end))
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let local = EntityTransform::Translate((-base).as_dvec3());
|
||||
let local = EntityTransform::Translate(-base);
|
||||
for (old_handle, mut entity) in source_entities {
|
||||
view::dispatch::apply_transform(&mut entity, &local);
|
||||
entity = crate::modules::draw::modify::explode::normalize_entity_for_block(entity);
|
||||
@@ -313,7 +313,7 @@ impl Scene {
|
||||
|
||||
let insert = DxfInsert::new(
|
||||
name,
|
||||
acadrust::types::Vector3::new(base.x as f64, base.y as f64, base.z as f64),
|
||||
acadrust::types::Vector3::new(base.x, base.y, base.z),
|
||||
);
|
||||
Ok(self.add_entity(EntityType::Insert(insert)))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user