Place import destination warning beside scope selector

This commit is contained in:
Dandaedre 2026-11-14 21:59:52 +01:00
parent c9880a5aeb
commit f332150947
2 changed files with 19 additions and 8 deletions

View File

@ -240,6 +240,14 @@ impl Paste {
};
layout.apply_mapped_import_with_zoom(&values, &zooms)
}
fn destination_count_warning(&self, layout: &Layout) -> Option<String> {
let count = self.ignored.iter().filter(|ignored| !**ignored).count();
let available = self.candidates(layout).len();
(count > available).then(|| format!(
"Not enough destinations: {available} available, {count} detected ({} excluded). Widen the scope or exclude items.",
self.shapes.len() - count
))
}
fn values(&self, layout: &Layout) -> Result<Vec<(usize, Geometry)>, String> {
if !self.include_size
&& !self.include_position
@ -253,13 +261,8 @@ impl Paste {
if count == 0 {
return Err("No rectangles to import. Include at least one rectangle.".into());
}
if count > self.candidates(layout).len() {
return Err(format!(
"Not enough destinations: {} available, {} detected ({} excluded). Widen the scope or exclude items.",
self.candidates(layout).len(),
count,
self.shapes.len() - count
));
if let Some(error) = self.destination_count_warning(layout) {
return Err(error);
}
if self
.targets
@ -1075,6 +1078,9 @@ impl Editor {
}
});
if scope != p.scope { p.set_scope(scope, &self.layout); }
if let Some(warning) = p.destination_count_warning(&self.layout) {
ui.colored_label(palette.amber, warning);
}
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);
@ -1153,7 +1159,10 @@ impl Editor {
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 let Err(e)=&valid
&& p.destination_count_warning(&self.layout).as_ref() != Some(e) {
ui.colored_label(palette.amber,e);
}
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}

View File

@ -4,6 +4,8 @@
## Unreleased
- Place insufficient import-destination warnings directly below the destination scope selector instead of repeating them near the Import button.
- 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.