forked from 1b-agent/opencadstudio-upstream
fix: honor drawing units in annotation and viewport scales
This commit is contained in:
1 parent
622da9095e
commit
cc7894cd92
4 files changed
+125
-42
No files matched your search
@@ -876,6 +876,28 @@ impl OpenCADStudio {
|
||||
}
|
||||
reframed += 1;
|
||||
}
|
||||
|
||||
// Keep the active model-space annotation scale in sync as well.
|
||||
// annotation_scale is drawing/paper, while CANNOSCALEVALUE stores
|
||||
// the reciprocal paper/drawing factor.
|
||||
if self.tabs[i].scene.annotation_scale.abs() > 1.0e-12 {
|
||||
self.tabs[i].scene.annotation_scale *= factor as f32;
|
||||
}
|
||||
|
||||
if self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.header
|
||||
.annotation_scale_value
|
||||
.abs()
|
||||
> 1.0e-12
|
||||
{
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.header
|
||||
.annotation_scale_value /= factor;
|
||||
}
|
||||
// Sizes the drawing keeps as settings rather than as geometry: dash
|
||||
// lengths, default heights and widths, the radii the fillet and chamfer
|
||||
// commands start from. They are all lengths in the unit that just
|
||||
|
||||
@@ -1720,12 +1720,29 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
pub(super) fn on_prop_geom_choice_changed(&mut self, field: &'static str, value: String) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
let handles = self.property_target_handles(i);
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
if field == "vp_ucs_name" {
|
||||
pub(super) fn on_prop_geom_choice_changed(
|
||||
&mut self,
|
||||
field: &'static str,
|
||||
value: String,
|
||||
) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
let handles = self.property_target_handles(i);
|
||||
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
|
||||
if field == "vscale_std" {
|
||||
for &handle in &handles {
|
||||
if matches!(
|
||||
self.tabs[i].scene.document.get_entity(handle),
|
||||
Some(acadrust::EntityType::Viewport(_))
|
||||
) {
|
||||
let _ = self.tabs[i]
|
||||
.scene
|
||||
.set_viewport_scale_named_for(handle, &value);
|
||||
}
|
||||
}
|
||||
} else if field == "vp_ucs_name" {
|
||||
// Resolve UCS name → cloned data, then mutate viewports.
|
||||
let ucs_data = self.tabs[i]
|
||||
.scene
|
||||
|
||||
Reference in new issue
Block a user