forked from 1b-agent/opencadstudio-upstream
fix(sheetset): wasm build, lock files and sheet set field refresh
- `.dst` read/write go through native-only helpers (a browser answers "Not available"); the folder pickers are web no-ops; time stamps use iced::time (web-safe). - Lock files are written only for drawings that are sheets of an open set, released when the last set closes, and a lock a crashed session left (recorded with its process id, same user and machine) is taken back. The `.dwl2` header is well-formed and the date line comes from the OS long date on every platform. The 1 Hz poll runs only while a set is open. - Refreshing sheet set fields never stores `####`: fields no open set resolves keep their value, and only the hosts that changed are redrawn (and their tab marked modified). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
078306d8fc
commit
76f4bb97dc
5 files changed
+219
-71
No files matched your search
@@ -4,8 +4,8 @@
|
||||
use crate::app::{Message, OpenCADStudio};
|
||||
use crate::command::CadCommand;
|
||||
use crate::modules::annotate::field_cmd::{FieldObjectPickCommand, FieldPlaceCommand, FieldTablePickCommand};
|
||||
use crate::ui::window::field_dialog::{nav_props,
|
||||
fields_of, object_properties, FieldDialogMsg, FieldDialogState, FieldTarget, DATE_FORMATS,
|
||||
use crate::ui::window::field_dialog::{
|
||||
fields_of, nav_props, object_properties, FieldDialogMsg, FieldDialogState, FieldTarget, DATE_FORMATS,
|
||||
NAMED_TYPES,
|
||||
};
|
||||
use iced::Task;
|
||||
@@ -209,7 +209,11 @@ impl OpenCADStudio {
|
||||
state.ss_prop.clear();
|
||||
}
|
||||
FieldDialogMsg::SsNode(id) => {
|
||||
state.ss_prop = state.ss_sets.get(state.ss_set).and_then(|db| nav_props(db, &id).first().map(|p| p.0.clone())).unwrap_or_default();
|
||||
state.ss_prop = state
|
||||
.ss_sets
|
||||
.get(state.ss_set)
|
||||
.and_then(|db| nav_props(db, &id).first().map(|p| p.0.clone()))
|
||||
.unwrap_or_default();
|
||||
state.ss_node = id;
|
||||
}
|
||||
FieldDialogMsg::SsProp(p) => state.ss_prop = p,
|
||||
@@ -228,10 +232,14 @@ impl OpenCADStudio {
|
||||
);
|
||||
}
|
||||
FieldDialogMsg::SsPicked(None) => {}
|
||||
FieldDialogMsg::SsPicked(Some(path)) => match codec::sheet_set::SheetSetDatabase::read(&path.to_string_lossy()) {
|
||||
FieldDialogMsg::SsPicked(Some(path)) => match crate::app::commands::sheet_set::read_set(&path.to_string_lossy()) {
|
||||
Ok(db) => {
|
||||
let key = codec::sheet_set::path_key(&path.to_string_lossy());
|
||||
state.ss_set = match state.ss_sets.iter().position(|d| d.path.as_deref().is_some_and(|p| codec::sheet_set::path_key(p) == key)) {
|
||||
let open = state
|
||||
.ss_sets
|
||||
.iter()
|
||||
.position(|d| d.path.as_deref().is_some_and(|p| codec::sheet_set::path_key(p) == key));
|
||||
state.ss_set = match open {
|
||||
Some(k) => k,
|
||||
None => {
|
||||
state.ss_sets.push(db);
|
||||
|
||||
Reference in new issue
Block a user