forked from 1b-agent/opencadstudio-upstream
fix(plot): write page setups in the file format's canonical form
One writer (plot_settings_from_dialog) now serves both the layout's embedded settings and named page setups, so the two can no longer drift apart: - media are stored as the portrait sheet with the orientation in the rotation code (0/90/180/270; upside-down adds a half turn) instead of swapped width/height with rotation limited to 0/180 - standard scales are written by their code (1:1 … 100:1) with matching numerator/denominator; other scales as a readable custom ratio in the layout's own paper unit, converting from the drawing's scale-family unit (a metre drawing plotting "1:100" stores 10 mm = 1 unit, an inch layout stores 1 in = 2540 units); reading converts back and keeps a ratio the scale list has no name for instead of snapping to 1:1 - the layout's paper unit and every flag the dialog does not edit survive a round trip untouched; layout limits follow the paper-space unit - new drawings, new layouts, CLEAR and the automation "new" op share one default page setup (canonical A4 name, rotation 90, none_device, 1:1 layout plot) through Scene::reset_to_new_drawing Scene gains scale_family_unit_mm, scale_ratio and a scale-name ratio parser (ratios and architectural names). Round-trip tests cover orientation, standard/custom/fit scales, unit conversion, named-setup parity, preserved flags and the default layout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef0c6bf403
commit
276e7c7bf1
8 files changed
+641
-263
No files matched your search
@@ -1508,8 +1508,7 @@ impl OpenCADStudio {
|
||||
Message::ClearScene => {
|
||||
let i = self.active_tab;
|
||||
self.push_undo_snapshot(i, "CLEAR");
|
||||
self.tabs[i].scene.clear();
|
||||
crate::io::linetypes::populate_document(&mut self.tabs[i].scene.document);
|
||||
self.tabs[i].scene.reset_to_new_drawing();
|
||||
self.tabs[i].properties = PropertiesPanel::empty();
|
||||
let doc_layers = self.tabs[i].scene.document.layers.clone();
|
||||
let vp_info = self.tabs[i].scene.viewport_list();
|
||||
|
||||
Reference in new issue
Block a user