Simplify layer import review and destination scopes
Beffroi/beffroi-tools/pipeline/head This commit looks good
Details
Beffroi/beffroi-tools/pipeline/head This commit looks good
Details
This commit is contained in:
parent
feb0e1dd51
commit
c9880a5aeb
|
|
@ -100,7 +100,24 @@ struct Marquee {
|
|||
base: Vec<bool>,
|
||||
previous: Vec<bool>,
|
||||
}
|
||||
#[derive(Clone, PartialEq)]
|
||||
enum ImportScope {
|
||||
All,
|
||||
Selected,
|
||||
Folder(String),
|
||||
}
|
||||
impl ImportScope {
|
||||
fn label(&self) -> String {
|
||||
match self {
|
||||
Self::All => "All layers".into(),
|
||||
Self::Selected => "Selected layers".into(),
|
||||
Self::Folder(name) => format!("Folder: {name}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
struct Paste {
|
||||
clipboard_entry: bool,
|
||||
scope: ImportScope,
|
||||
pages: Vec<midra_layout::interchange::Page>,
|
||||
page_index: usize,
|
||||
import_job:
|
||||
|
|
@ -121,6 +138,37 @@ struct Paste {
|
|||
error: String,
|
||||
}
|
||||
impl Paste {
|
||||
fn candidates(&self, layout: &Layout) -> Vec<usize> {
|
||||
let indices = if self.scope == ImportScope::All {
|
||||
(0..layout.layers().len()).collect()
|
||||
} else {
|
||||
self.targets.clone()
|
||||
};
|
||||
indices
|
||||
.into_iter()
|
||||
.filter(|&i| i < layout.layers().len() && layout.visible(i) && !layout.locked(i))
|
||||
.collect()
|
||||
}
|
||||
fn set_scope(&mut self, scope: ImportScope, layout: &Layout) {
|
||||
self.targets = match &scope {
|
||||
ImportScope::All => Vec::new(),
|
||||
ImportScope::Selected => layout.selected_indices(),
|
||||
ImportScope::Folder(folder) => layout.folder_members(folder),
|
||||
};
|
||||
self.target_ids = self
|
||||
.targets
|
||||
.iter()
|
||||
.map(|&i| layout.layer_info(i).id)
|
||||
.collect();
|
||||
self.scope = scope;
|
||||
// Keep valid explicit choices; only clear mappings outside the new scope.
|
||||
let candidates = self.candidates(layout);
|
||||
for target in &mut self.mapping {
|
||||
if target.is_some_and(|i| !candidates.contains(&i)) {
|
||||
*target = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
fn set_document(&mut self, doc: ImportDocument) {
|
||||
self.shapes = doc.shapes;
|
||||
self.note = doc.note;
|
||||
|
|
@ -190,11 +238,7 @@ impl Paste {
|
|||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
if self.targets.is_empty() {
|
||||
layout.apply_mapped_import_with_zoom(&values, &zooms)
|
||||
} else {
|
||||
layout.apply_import_with_zoom(&values, &zooms)
|
||||
}
|
||||
layout.apply_mapped_import_with_zoom(&values, &zooms)
|
||||
}
|
||||
fn values(&self, layout: &Layout) -> Result<Vec<(usize, Geometry)>, String> {
|
||||
if !self.include_size
|
||||
|
|
@ -209,28 +253,21 @@ impl Paste {
|
|||
if count == 0 {
|
||||
return Err("No rectangles to import. Include at least one rectangle.".into());
|
||||
}
|
||||
if !self.targets.is_empty() && count > self.targets.len() {
|
||||
if count > self.candidates(layout).len() {
|
||||
return Err(format!(
|
||||
"Layer count mismatch: {} selected, {} detected ({} excluded). Choose at least {} destination layer(s), or supply at most {} rectangle(s).",
|
||||
self.targets.len(),
|
||||
"Not enough destinations: {} available, {} detected ({} excluded). Widen the scope or exclude items.",
|
||||
self.candidates(layout).len(),
|
||||
count,
|
||||
self.shapes.len() - count,
|
||||
count,
|
||||
self.targets.len()
|
||||
self.shapes.len() - count
|
||||
));
|
||||
}
|
||||
if layout.selected_indices() != self.targets
|
||||
|| self
|
||||
.targets
|
||||
.iter()
|
||||
.map(|i| layout.layer_info(*i).id)
|
||||
.collect::<Vec<_>>()
|
||||
!= self.target_ids
|
||||
if self
|
||||
.targets
|
||||
.iter()
|
||||
.zip(&self.target_ids)
|
||||
.any(|(&i, &id)| i >= layout.layers().len() || layout.layer_info(i).id != id)
|
||||
{
|
||||
return Err(
|
||||
"Selection changed. Close this review and import again for the current selection."
|
||||
.into(),
|
||||
);
|
||||
return Err("Destination layers changed. Close this review and import again.".into());
|
||||
}
|
||||
let mut values = Vec::new();
|
||||
for (row, shape) in self.shapes.iter().enumerate() {
|
||||
|
|
@ -249,10 +286,10 @@ impl Paste {
|
|||
.into(),
|
||||
);
|
||||
}
|
||||
if (!self.targets.is_empty() && !self.targets.contains(&target))
|
||||
if (self.scope != ImportScope::All && !self.targets.contains(&target))
|
||||
|| values.iter().any(|(i, _)| *i == target)
|
||||
{
|
||||
return Err("Each imported rectangle needs a different selected destination; choose a different destination for duplicate mappings.".into());
|
||||
return Err("Each imported rectangle needs a different destination within the chosen scope; choose a different destination for duplicate mappings.".into());
|
||||
}
|
||||
values.push((target, self.geometry(shape, layout.layers()[target])?));
|
||||
}
|
||||
|
|
@ -609,6 +646,12 @@ impl Editor {
|
|||
fn open_paste(&mut self, text: String) {
|
||||
let targets = self.layout.selected_indices();
|
||||
let mut p = Paste {
|
||||
clipboard_entry: true,
|
||||
scope: if targets.is_empty() {
|
||||
ImportScope::All
|
||||
} else {
|
||||
ImportScope::Selected
|
||||
},
|
||||
pages: Vec::new(),
|
||||
page_index: 0,
|
||||
import_job: None,
|
||||
|
|
@ -673,6 +716,7 @@ impl Editor {
|
|||
fn read_geometry_files(files: Vec<egui::DroppedFile>, p: &mut Paste) {
|
||||
use std::io::Read;
|
||||
let (tx, rx) = std::sync::mpsc::channel();
|
||||
p.clipboard_entry = false;
|
||||
p.import_job = Some(rx);
|
||||
p.pages.clear();
|
||||
p.shapes.clear();
|
||||
|
|
@ -995,6 +1039,7 @@ impl Editor {
|
|||
ui.set_width(600.0);
|
||||
ui.heading("Import layer values");
|
||||
if p.import_job.is_some() { ui.spinner(); ui.label("Reading document…"); }
|
||||
if p.pages.len() == 1 { ui.label(&p.pages[0].name); }
|
||||
if p.pages.len() > 1 {
|
||||
let previous = p.page_index;
|
||||
egui::ComboBox::from_label("File / page / frame / slide").selected_text(&p.pages[p.page_index].name).show_ui(ui, |ui| {
|
||||
|
|
@ -1002,26 +1047,38 @@ impl Editor {
|
|||
});
|
||||
if previous != p.page_index { p.set_document(p.pages[p.page_index].document.clone()); }
|
||||
}
|
||||
if self.transfer_layer_picker(ui, "Choose destination layers…") {
|
||||
p.targets = self.layout.selected_indices();
|
||||
p.target_ids = p.targets.iter().map(|&i| self.layout.layer_info(i).id).collect();
|
||||
p.reset_mapping();
|
||||
if p.clipboard_entry && p.shapes.is_empty() && p.import_job.is_none() {
|
||||
ui.label("Paste layer values to review their geometry and destinations.");
|
||||
ui.add(egui::TextEdit::multiline(&mut p.text).desired_rows(4).desired_width(f32::INFINITY));
|
||||
if ui.button("Review pasted values").clicked() { p.parse(); }
|
||||
}
|
||||
if p.targets.is_empty() {
|
||||
ui.label("Choose a destination beside each rectangle below; no viewport selection is needed.");
|
||||
} else {
|
||||
ui.label(format!("Selected destinations: {}",p.targets.iter().map(|i|self.layout.layer_label(*i)).collect::<Vec<_>>().join(", ")));
|
||||
}
|
||||
ui.label("Paste Midra Layout values or supported geometry data, or import a geometry file.");
|
||||
egui::ScrollArea::vertical().max_height((ctx.screen_rect().height()-360.0).max(150.0)).show(ui,|ui| {
|
||||
if ui.add(egui::TextEdit::multiline(&mut p.text).desired_rows(3).desired_width(f32::INFINITY)).changed() {p.shapes.clear();p.error.clear();p.pages.clear();p.import_job=None;}
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Read geometry").clicked() {p.parse();}
|
||||
if ui.button("Import file…").clicked() && let Some(path)=rfd::FileDialog::new().add_filter("Layer geometry", &midra_layout::interchange::extensions()).pick_file() {Self::read_geometry(&path,&mut p);}
|
||||
});
|
||||
egui::ScrollArea::vertical().id_salt("import-review").max_height((ctx.screen_rect().height()-260.0).max(150.0)).show(ui,|ui| {
|
||||
if !p.error.is_empty() {ui.colored_label(palette.amber,&p.error);}
|
||||
if p.shapes.is_empty() {return;}
|
||||
ui.label(&p.note);
|
||||
ui.small(format!("{} detected items · review mappings before importing", p.shapes.len()));
|
||||
if !p.text.is_empty() {
|
||||
egui::CollapsingHeader::new("Clipboard data").show(ui, |ui| {
|
||||
egui::ScrollArea::vertical().id_salt("clipboard-preview").max_height(100.0).show(ui, |ui| {
|
||||
ui.add(egui::TextEdit::multiline(&mut p.text).interactive(false).desired_width(f32::INFINITY));
|
||||
});
|
||||
});
|
||||
}
|
||||
ui.add_space(8.0);
|
||||
ui.strong("Destination layers");
|
||||
let mut scope = p.scope.clone();
|
||||
egui::ComboBox::from_id_salt("import-scope").width(280.0).selected_text(scope.label()).show_ui(ui, |ui| {
|
||||
ui.selectable_value(&mut scope, ImportScope::All, "All layers");
|
||||
ui.selectable_value(&mut scope, ImportScope::Selected, "Selected layers");
|
||||
ui.separator();
|
||||
for folder in self.layout.folders() {
|
||||
ui.selectable_value(&mut scope, ImportScope::Folder(folder.clone()), format!("Folder: {folder}"));
|
||||
}
|
||||
});
|
||||
if scope != p.scope { p.set_scope(scope, &self.layout); }
|
||||
ui.small(format!("{} available destinations · hidden and locked layers are excluded", p.candidates(&self.layout).len()));
|
||||
ui.small("Choose a destination for each item below. Other layers stay unchanged.");
|
||||
ui.add_space(8.0);
|
||||
ui.strong("Values to apply");
|
||||
ui.horizontal(|ui| {
|
||||
ui.checkbox(&mut p.include_size,"Format (width / height)");
|
||||
ui.checkbox(&mut p.include_position,"Position");
|
||||
|
|
@ -1032,56 +1089,78 @@ impl Editor {
|
|||
if !p.zoom_available() {ui.small("Crop zoom is not included in this data.");}
|
||||
ui.small("Unchecked values keep the destination settings. Format changes may adjust existing crops to fit.");
|
||||
ui.add_enabled(p.include_size && p.shapes.iter().any(|s|s.outline.iter().any(|v|*v>0.0)),egui::Checkbox::new(&mut p.include_outline,"Include outline in bounds"));
|
||||
ui.small("Source format, crop offsets, colors and outline appearance are not imported.");
|
||||
egui::CollapsingHeader::new("Import details").show(ui, |ui| {
|
||||
ui.label(&p.note);
|
||||
ui.small("Source format, crop offsets, colors and outline appearance are not imported.");
|
||||
});
|
||||
if !p.include_size {ui.small("Outline adjustment requires Format. Position uses the source top-left when enabled.");}
|
||||
ui.separator();
|
||||
ui.strong("Detected rectangles / destination layers");
|
||||
ui.small("Map each rectangle to one destination. Unmapped layers stay unchanged.");
|
||||
ui.strong("Map source items to destination layers");
|
||||
ui.small("Each included item needs a different destination.");
|
||||
let mut reset_mapping=false;
|
||||
for row in 0..p.shapes.len() {
|
||||
let shape=p.shapes[row].clone();
|
||||
ui.push_id(row,|ui| {
|
||||
ui.label(format!("{} · {}",row+1,shape.id));
|
||||
ui.small(bounds(shape.geometry));
|
||||
if let Some(zoom)=shape.zoom {ui.small(format!("Crop zoom: {:.1}%{}",zoom*100.0,if p.include_zoom { " (will apply)" } else { " (not applied)" }));}
|
||||
else if p.include_zoom && p.zoom_available() {ui.small("No crop zoom in this rectangle; destination zoom is retained.");}
|
||||
egui::Frame::group(ui.style()).show(ui, |ui| {
|
||||
ui.set_min_width(ui.available_width());
|
||||
ui.horizontal(|ui| {
|
||||
ui.strong(format!("{} · {}",row+1,shape.id));
|
||||
});
|
||||
if shape.background_only {
|
||||
ui.small("Background artwork · excluded from layer mapping");
|
||||
} else if shape.background {
|
||||
reset_mapping|=ui.checkbox(&mut p.ignored[row],"Ignore full-page background").changed();
|
||||
} else {
|
||||
let mut include = !p.ignored[row];
|
||||
if ui.checkbox(&mut include, if shape.background { "Include full-page background" } else { "Include item" }).changed() {
|
||||
p.ignored[row] = !include;
|
||||
reset_mapping = true;
|
||||
}
|
||||
}
|
||||
if !p.ignored[row] {
|
||||
egui::ComboBox::from_id_salt("destination").selected_text(p.mapping[row].map(|i| self.layout.layer_label(i)).unwrap_or_else(|| "Choose destination…".into())).show_ui(ui,|ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.strong("Destination");
|
||||
egui::ComboBox::from_id_salt("destination").width(330.0).selected_text(p.mapping[row].map(|i| self.layout.layer_label(i)).unwrap_or_else(|| "Choose destination…".into())).show_ui(ui,|ui| {
|
||||
ui.selectable_value(&mut p.mapping[row], None, "Choose destination…");
|
||||
let candidates: Vec<_> = if p.targets.is_empty() { (0..self.layout.layers().len()).collect() } else { p.targets.clone() };
|
||||
let candidates = p.candidates(&self.layout);
|
||||
for target in candidates {
|
||||
ui.add_enabled_ui(self.layout.visible(target) && !self.layout.locked(target), |ui| {
|
||||
ui.selectable_value(&mut p.mapping[row],Some(target),self.layout.layer_label(target));
|
||||
});
|
||||
}
|
||||
});
|
||||
if let Some(target)=p.mapping[row] {
|
||||
});
|
||||
egui::CollapsingHeader::new("Geometry · before / after").show(ui, |ui| {
|
||||
ui.small(bounds(shape.geometry));
|
||||
if let Some(zoom) = shape.zoom { ui.small(format!("Crop zoom: {:.1}%", zoom * 100.0)); }
|
||||
if let Some(target)=p.mapping[row].filter(|&i| i < self.layout.layers().len()) {
|
||||
let before=self.layout.layers()[target];
|
||||
if let Ok(after)=p.geometry(&shape,before) {
|
||||
ui.columns(2,|cols| {cols[0].label("Before");cols[0].small(bounds(before));cols[1].label("After");cols[1].small(bounds(after));});
|
||||
if after.outside_on(self.layout.formats().output) {ui.colored_label(palette.amber,"Outside the screen; imported coordinates will be preserved.");}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
ui.separator();
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
});
|
||||
}
|
||||
if reset_mapping {p.reset_mapping();}
|
||||
if reset_mapping {
|
||||
for row in 0..p.mapping.len() {
|
||||
if p.ignored[row] { p.mapping[row] = None; }
|
||||
}
|
||||
}
|
||||
});
|
||||
if !p.shapes.is_empty() {
|
||||
let mut preview=self.layout.clone();
|
||||
let valid=p.apply(&mut preview);
|
||||
if let Err(e)=&valid {ui.colored_label(palette.amber,e);}
|
||||
if apply_button(ui,"Import mapped values", valid.is_ok() && (preview.layers()!=self.layout.layers() || preview.formats()!=self.layout.formats())).clicked() {
|
||||
match p.apply(&mut self.layout) {Ok(())=>{self.sync();close=true;},Err(e)=>p.error=e}
|
||||
}
|
||||
}
|
||||
if ui.button("Cancel").clicked() {close=true;}
|
||||
ui.horizontal(|ui| {
|
||||
if apply_button(ui,"Import mapped values", valid.is_ok() && (preview.layers()!=self.layout.layers() || preview.formats()!=self.layout.formats())).clicked() {
|
||||
match p.apply(&mut self.layout) {Ok(())=>{self.sync();close=true;},Err(e)=>p.error=e}
|
||||
}
|
||||
if ui.button("Cancel").clicked() {close=true;}
|
||||
});
|
||||
} else if ui.button("Cancel").clicked() {close=true;}
|
||||
});
|
||||
if response.should_close() && !close && !p.shapes.is_empty() {
|
||||
p.closing = true;
|
||||
|
|
@ -5326,7 +5405,7 @@ mod tests {
|
|||
.unwrap()
|
||||
.values(&app.layout)
|
||||
.unwrap_err()
|
||||
.contains("Selection changed")
|
||||
.contains("Destination layers changed")
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
|
|
@ -6434,52 +6513,77 @@ mod tests {
|
|||
assert_eq!(*app.layout.layers(), before);
|
||||
}
|
||||
#[test]
|
||||
fn import_can_choose_destination_inside_review_without_initial_selection() {
|
||||
fn import_review_hides_acquisition_and_collapses_clipboard_details() {
|
||||
let mut app = Editor::default();
|
||||
let ctx = egui::Context::default();
|
||||
app.layout.select(None);
|
||||
let before = app.layout.layers().clone();
|
||||
app.open_paste(include_str!("../tests/fixtures/drawio-rectangle.txt").into());
|
||||
assert!(app.paste.as_ref().unwrap().targets.is_empty());
|
||||
fn text_position(output: &egui::FullOutput, label: &str) -> Pos2 {
|
||||
let source = include_str!("../tests/fixtures/drawio-rectangle.txt");
|
||||
app.open_paste(source.into());
|
||||
fn texts(output: &egui::FullOutput) -> Vec<String> {
|
||||
output
|
||||
.shapes
|
||||
.iter()
|
||||
.rev()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::epaint::Shape::Text(t) if t.galley.job.text == label => {
|
||||
Some(t.pos + Vec2::new(12.0, 6.0))
|
||||
}
|
||||
.filter_map(|s| match &s.shape {
|
||||
egui::epaint::Shape::Text(t) => Some(t.galley.job.text.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or_else(|| panic!("Missing label {label}"))
|
||||
.collect()
|
||||
}
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
let output = frame(&mut app, &ctx, vec![]);
|
||||
let pos = text_position(&output, "Choose destination layers…");
|
||||
frame(
|
||||
&mut app,
|
||||
&ctx,
|
||||
vec![egui::Event::PointerMoved(pos), mouse(pos, true)],
|
||||
let labels = texts(&frame(&mut app, &ctx, vec![]));
|
||||
for label in [
|
||||
"Clipboard data",
|
||||
"Destination layers",
|
||||
"Destination",
|
||||
"Import mapped values",
|
||||
] {
|
||||
assert!(labels.iter().any(|t| t == label), "Missing {label}");
|
||||
}
|
||||
for label in [
|
||||
"Import file…",
|
||||
"Read geometry",
|
||||
"Review pasted values",
|
||||
source,
|
||||
"Before",
|
||||
"After",
|
||||
] {
|
||||
assert!(!labels.iter().any(|t| t == label), "Unexpected {label}");
|
||||
}
|
||||
click_text(&mut app, &ctx, "Clipboard data");
|
||||
for _ in 0..20 {
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
}
|
||||
assert!(
|
||||
texts(&frame(&mut app, &ctx, vec![]))
|
||||
.iter()
|
||||
.any(|t| t == source)
|
||||
);
|
||||
frame(&mut app, &ctx, vec![mouse(pos, false)]);
|
||||
let output = frame(&mut app, &ctx, vec![]);
|
||||
let pos = text_position(&output, &app.layout.layer_label(0));
|
||||
frame(
|
||||
&mut app,
|
||||
&ctx,
|
||||
vec![egui::Event::PointerMoved(pos), mouse(pos, true)],
|
||||
);
|
||||
frame(&mut app, &ctx, vec![mouse(pos, false)]);
|
||||
let paste = app.paste.as_ref().unwrap();
|
||||
assert_eq!(paste.targets, vec![0]);
|
||||
assert_eq!(paste.mapping, vec![Some(0)]);
|
||||
assert_eq!(*app.layout.layers(), before);
|
||||
paste.apply(&mut app.layout).unwrap();
|
||||
app.open_paste("invalid".into());
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
assert!(texts(&frame(&mut app, &ctx, vec![])).contains(&"Review pasted values".into()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_scope_filters_destinations_without_changing_selection() {
|
||||
let mut app = Editor::default();
|
||||
let selection = app.layout.selected_indices();
|
||||
let id = app.layout.layer_info(0).id;
|
||||
app.layout.move_layer_to_folder(id, "Memory A", 0).unwrap();
|
||||
app.open_paste(include_str!("../tests/fixtures/drawio-rectangle.txt").into());
|
||||
let p = app.paste.as_mut().unwrap();
|
||||
p.set_scope(ImportScope::Folder("Memory A".into()), &app.layout);
|
||||
assert_eq!(p.candidates(&app.layout), vec![0]);
|
||||
assert_eq!(p.mapping, vec![None]);
|
||||
p.mapping[0] = Some(0);
|
||||
p.apply(&mut app.layout).unwrap();
|
||||
assert_eq!(app.layout.selected_indices(), selection);
|
||||
assert_eq!(app.layout.layers()[0].width, 945.0);
|
||||
assert_eq!(app.layout.layers()[1], before[1]);
|
||||
app.layout.undo();
|
||||
assert_eq!(*app.layout.layers(), before);
|
||||
p.set_scope(ImportScope::All, &app.layout);
|
||||
assert_eq!(p.mapping, vec![Some(0)]);
|
||||
p.set_scope(ImportScope::Selected, &app.layout);
|
||||
assert_eq!(p.mapping, vec![None]);
|
||||
p.set_scope(ImportScope::Folder("Empty".into()), &app.layout);
|
||||
assert!(p.candidates(&app.layout).is_empty());
|
||||
assert!(p.values(&app.layout).is_err());
|
||||
}
|
||||
#[test]
|
||||
fn fewer_pasted_rectangles_can_map_to_either_selected_layer() {
|
||||
|
|
@ -6565,7 +6669,7 @@ mod tests {
|
|||
assert!(
|
||||
p.values(&app.layout)
|
||||
.unwrap_err()
|
||||
.contains("2 selected, 3 detected")
|
||||
.contains("2 available, 3 detected")
|
||||
);
|
||||
p.ignored[0] = true;
|
||||
p.reset_mapping();
|
||||
|
|
|
|||
|
|
@ -299,7 +299,13 @@ byte importer as the picker; native-codec build restrictions still apply. Path-b
|
|||
and in-memory file drops are supported. Raster images retain reference-image behavior.
|
||||
Several geometry files become named choices in the file/page/frame/slide selector,
|
||||
with a combined 16 MiB input limit. Parsing is atomic across the geometry batch;
|
||||
errors report the failed filename, and no geometry is applied before mapping confirmation. Destination count need not match current selection. Import with
|
||||
errors report the failed filename, and no geometry is applied before mapping confirmation. Destination count need not match current selection. The review offers All / Selected /
|
||||
Folder destination scopes without changing canvas selection; hidden and locked layers
|
||||
are unavailable. Every included item needs a distinct destination, while excluded
|
||||
items and unmapped editor layers remain unchanged. Existing mappings survive scope
|
||||
changes when still eligible. Clipboard text and per-item geometry details are
|
||||
collapsed, read-only previews. These review choices are session-only and do not
|
||||
change any file schema. Import with
|
||||
size and position enabled restores the rounded geometry in one Undo step. Output
|
||||
screen resolution is not imported. Mapped names, sources and Midra links stay with
|
||||
the destination layers. File replacement retains the existing explicit overwrite
|
||||
|
|
|
|||
|
|
@ -212,8 +212,8 @@ and `viewBox="0 0 W H"` equal to the output screen. The root carries
|
|||
- The file is a geometry interchange, not a project backup. It deliberately omits
|
||||
source assignments, crops, content zoom, reference image, lock/visibility flags,
|
||||
selection and camera. Use project JSON to preserve those.
|
||||
- Select the same number of destination layers, then use **Import → SVG file**
|
||||
and review the mappings. A full-screen rectangle bearing this export marker
|
||||
- Use **Import → Geometry file…** and review the mappings. Choose destinations
|
||||
from All / Selected / Folder scopes; each included item needs a distinct layer. A full-screen rectangle bearing this export marker
|
||||
is treated as a layer, not an automatically ignored background. Other SVGs keep
|
||||
the existing full-page background detection rule.
|
||||
- Reimporting restores rounded box geometry through the regular import options;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
- Simplify geometry/clipboard import into a shared review without repeated acquisition controls. Collapse clipboard and before/after details, emphasize destination mapping, and add independent All / Selected / Folder scopes plus per-item exclusion. Preserve compatible mappings and canvas selection; regression tests cover scope filtering, atomic import and review visibility.
|
||||
|
||||
- Route supported geometry file drops through the regular asynchronous import/mapping review, including SVG/draw.io and native formats when available. Keep raster drops as references; support path/data drops and multiple documents through the file/page chooser, with a combined 16 MiB limit and atomic failure. Regression tests cover codecs, case-insensitive names, batches and invalid/oversized inputs.
|
||||
|
||||
- Add an mdBook manual built from the existing guides, with local assets and downloads. Jenkins publishes successful main builds under `/mnt/books/manuals/`; staging, link validation and scoped publication have regression coverage.
|
||||
|
|
|
|||
|
|
@ -13,23 +13,23 @@ choose one document/page to map at a time. Reading runs in the background, and
|
|||
nothing changes in the layout until Apply. The entire geometry drop is limited
|
||||
to 16 MiB; a failed document leaves the batch unapplied and reports its filename.
|
||||
|
||||
1. Choose destinations using **Choose destination layers…** in the Import menu
|
||||
or review window. Selecting them on the canvas or right-hand list also works
|
||||
(Shift-click for multiple layers).
|
||||
2. Copy layer values in Midra Layout or rectangles in draw.io, then press **Ctrl/Cmd-V** with the viewport
|
||||
focused. Alternatively, click **Paste layer(s) values**, paste into the text
|
||||
area and click **Read geometry**. **Import → Geometry file…** opens SVG, draw.io,
|
||||
geometry JSON/CSV, DXF or HTML in the same review window; supported text can
|
||||
also be pasted. **Import → Clipboard values**
|
||||
reads the clipboard directly and opens the mapping review.
|
||||
3. Review each detected rectangle and choose its destination layer. With nothing
|
||||
selected, each rectangle's dropdown lists all editor layers (hidden/locked
|
||||
destinations are disabled). Map the rectangles individually; no selection
|
||||
step is required, and applying leaves the viewport selection unchanged. Initial
|
||||
mapping follows document order and the selected layer list. Each rectangle must map to a different
|
||||
destination (restricted to the selection when one exists). Fewer rectangles than selected layers are allowed;
|
||||
unmapped layers stay unchanged. Too many rectangles or duplicate mappings
|
||||
block Apply and explain what needs changing. Nothing changes yet.
|
||||
1. Copy layer values or geometry and use **Import → Clipboard values** or
|
||||
**Ctrl/Cmd-V** with the viewport focused. Alternatively use **Import → Geometry
|
||||
file…** or drop a supported file. These entry points share one mapping review.
|
||||
If entering text manually, paste it and click **Review pasted values**.
|
||||
2. Once geometry is detected, the review only shows the loaded data, mapping and
|
||||
import options. **Clipboard data** is a collapsed, read-only preview; there are
|
||||
no additional file/paste buttons inside the review. Multiple documents/pages
|
||||
retain their page chooser.
|
||||
3. Under **Destination layers**, choose **All layers**, **Selected layers**, or
|
||||
**Folder: …**. Existing selection initially scopes and pre-maps the import;
|
||||
with no selection, choose destinations individually from All layers. Changing
|
||||
the scope never changes canvas selection and preserves mappings still in scope.
|
||||
Hidden/locked layers are excluded. Each source item has a prominent destination
|
||||
dropdown and collapsed **Geometry · before / after** details. Uncheck **Include
|
||||
item** to skip an item. Each included item must map to a different destination;
|
||||
fewer source items than destinations are fine. Duplicate or missing mappings
|
||||
block import. Other layers stay unchanged.
|
||||
4. Choose independently what to paste: **Format (width / height)**, **Position**,
|
||||
and **Crop zoom**. Zoom is enabled only when present in the data (new Midra
|
||||
clipboard values include it; older copies, draw.io and SVG do not). All
|
||||
|
|
@ -39,7 +39,7 @@ to 16 MiB; a failed document leaves the batch unapplied and reports its filename
|
|||
Zoom applies to the resulting layer size; existing crop offsets clamp if
|
||||
necessary. Mixed batches keep destination zoom where the source lacks it.
|
||||
At least one available value must be enabled.
|
||||
5. Click **Import mapped values** to update the entire selection in one undo step.
|
||||
5. Click **Import mapped values** to update the mapped layers in one undo step.
|
||||
Cancel leaves all layers unchanged. Invalid geometry
|
||||
blocks the whole batch, without partial changes.
|
||||
|
||||
|
|
@ -54,8 +54,8 @@ page dimensions and `viewBox` transforms, using CSS units at 96 px/in. Coordinat
|
|||
are relative to the SVG page; exporting only a selection may lose its original
|
||||
document position. The SVG is used for bounds, not rendered as a reference image.
|
||||
|
||||
A first full-page rectangle or image is marked as a possible background. Check
|
||||
**Ignore full-page background** to exclude it from the count and mapping. This
|
||||
A first full-page rectangle or image is marked as a possible background. Uncheck
|
||||
**Include full-page background** to exclude it from the count and mapping. This
|
||||
is explicit: a full-page rectangle can also be a real layer. Image backgrounds
|
||||
must be excluded; their contents and external links are never loaded.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue