forked from 1b-agent/opencadstudio-upstream
feat: apply OCS→WCS to Text and Attribute insertion snap points
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
5297aea001
commit
9dcb5ad718
2 files changed
+15
-12
No files matched your search
@@ -14,11 +14,12 @@ use crate::scene::{cxf, transform};
|
||||
|
||||
impl TruckConvertible for AttributeDefinition {
|
||||
fn to_truck(&self, document: &acadrust::CadDocument) -> Option<TruckEntity> {
|
||||
let snap_pt = Vec3::new(
|
||||
self.insertion_point.x as f32,
|
||||
self.insertion_point.y as f32,
|
||||
self.insertion_point.z as f32,
|
||||
let normal = (self.normal.x, self.normal.y, self.normal.z);
|
||||
let (wsx, wsy, wsz) = transform::ocs_point_to_wcs(
|
||||
(self.insertion_point.x, self.insertion_point.y, self.insertion_point.z),
|
||||
normal,
|
||||
);
|
||||
let snap_pt = Vec3::new(wsx as f32, wsy as f32, wsz as f32);
|
||||
let resolved = resolve_text_style(&self.text_style, document);
|
||||
let display = if self.default_value.is_empty() {
|
||||
format!("[{}]", self.tag)
|
||||
@@ -122,11 +123,12 @@ impl Transformable for AttributeDefinition {
|
||||
|
||||
impl TruckConvertible for AttributeEntity {
|
||||
fn to_truck(&self, document: &acadrust::CadDocument) -> Option<TruckEntity> {
|
||||
let snap_pt = Vec3::new(
|
||||
self.insertion_point.x as f32,
|
||||
self.insertion_point.y as f32,
|
||||
self.insertion_point.z as f32,
|
||||
let normal = (self.normal.x, self.normal.y, self.normal.z);
|
||||
let (wsx, wsy, wsz) = transform::ocs_point_to_wcs(
|
||||
(self.insertion_point.x, self.insertion_point.y, self.insertion_point.z),
|
||||
normal,
|
||||
);
|
||||
let snap_pt = Vec3::new(wsx as f32, wsy as f32, wsz as f32);
|
||||
let resolved = resolve_text_style(&self.text_style, document);
|
||||
let wf = (self.width_factor as f32).max(0.01);
|
||||
let origin = [self.insertion_point.x, self.insertion_point.y];
|
||||
|
||||
@@ -47,11 +47,12 @@ fn sync_text_alignment_point(t: &mut Text) {
|
||||
}
|
||||
|
||||
fn to_truck(t: &Text, document: &acadrust::CadDocument) -> TruckEntity {
|
||||
let snap_pt = Vec3::new(
|
||||
t.insertion_point.x as f32,
|
||||
t.insertion_point.y as f32,
|
||||
t.insertion_point.z as f32,
|
||||
let normal = (t.normal.x, t.normal.y, t.normal.z);
|
||||
let (wsx, wsy, wsz) = crate::scene::transform::ocs_point_to_wcs(
|
||||
(t.insertion_point.x, t.insertion_point.y, t.insertion_point.z),
|
||||
normal,
|
||||
);
|
||||
let snap_pt = Vec3::new(wsx as f32, wsy as f32, wsz as f32);
|
||||
let resolved_style = resolve_text_style(&t.style, document);
|
||||
let font_name = resolved_style.font_name;
|
||||
let base_wf = (if t.width_factor > 0.0 { t.width_factor as f32 } else { 1.0 }
|
||||
|
||||
Reference in new issue
Block a user