mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-28 01:10:54 +01:00
Reserve native Link Info space in the panel footer
This commit is contained in:
1 parent
f9d08c1816
commit
f8520c1c19
4 files changed
+15
-74
No files matched your search
@@ -98,33 +98,8 @@ pub(crate) fn copy_shown(ui: &mut Ui, shown: &egui::Response, value: &str) -> bo
|
||||
});
|
||||
}
|
||||
ui.ctx().accesskit_node_builder(shown.id, |node| {
|
||||
// TEMPORARY diagnostic: MUST REMOVE before publication.
|
||||
if value.contains("Überlagerung") || value.contains("Éléments-originaux") {
|
||||
eprintln!(
|
||||
"LINK_LOCATION_COPY_BEFORE id={:?} role={:?} label={:?} value={:?} description={:?} bounds={:?} children={:?}",
|
||||
shown.id,
|
||||
node.role(),
|
||||
node.label(),
|
||||
node.value(),
|
||||
node.description(),
|
||||
node.bounds(),
|
||||
node.children()
|
||||
);
|
||||
}
|
||||
node.set_description(tl!("Copy"));
|
||||
node.add_action(egui::accesskit::Action::Click);
|
||||
if value.contains("Überlagerung") || value.contains("Éléments-originaux") {
|
||||
eprintln!(
|
||||
"LINK_LOCATION_COPY_AFTER id={:?} role={:?} label={:?} value={:?} description={:?} bounds={:?} children={:?}",
|
||||
shown.id,
|
||||
node.role(),
|
||||
node.label(),
|
||||
node.value(),
|
||||
node.description(),
|
||||
node.bounds(),
|
||||
node.children()
|
||||
);
|
||||
}
|
||||
});
|
||||
let activated = ui.input(|i| i.num_accesskit_action_requests(shown.id, egui::accesskit::Action::Click) > 0);
|
||||
eligible
|
||||
|
||||
@@ -29,7 +29,7 @@ use craft::ui::buttons::IconButton;
|
||||
use craft::ui::contract::{Bind, CollectionEvent, Props as _, Show as _, ShowCollection as _, ShowContainer as _};
|
||||
use craft::ui::display::{Elide, Shade, Text};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::layout_components::{Row, Stack};
|
||||
use craft::ui::list::{List, ListRow, ThumbSize};
|
||||
use craft::ui::menu::{Menu, MenuItem, PanelRow};
|
||||
use craft::ui::runtime::commands::{CommandState, CommandStates};
|
||||
@@ -768,10 +768,15 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
Panel::new(tl!("Links"))
|
||||
.collection_body()
|
||||
.footer(|ui, _| {
|
||||
let info = FooterAction::new(IconId::new(if o.info { "chevron-down" } else { "chevron-right" }), tl!("Show Link Info"));
|
||||
let actions = std::iter::once(info)
|
||||
.chain(FOOTER.iter().map(|(a, icon, label)| FooterAction::new(IconId::new(icon), tl!(label)).enabled(can(view, *a, &facts, None))));
|
||||
footer_pick = FooterBar::actions(actions).at_start(1).show_footer(ui).picked;
|
||||
Stack::new().fill_width().show(ui, |ui, _| {
|
||||
if o.info {
|
||||
info_reveal = link_info(ui, view, cache.info.as_ref().map(|(id, i)| (*id, i)), units, &mut info_copy);
|
||||
}
|
||||
let info = FooterAction::new(IconId::new(if o.info { "chevron-down" } else { "chevron-right" }), tl!("Show Link Info"));
|
||||
let actions = std::iter::once(info)
|
||||
.chain(FOOTER.iter().map(|(a, icon, label)| FooterAction::new(IconId::new(icon), tl!(label)).enabled(can(view, *a, &facts, None))));
|
||||
footer_pick = FooterBar::actions(actions).at_start(1).show_footer(ui).picked;
|
||||
});
|
||||
})
|
||||
.show(ui, |ui, _| {
|
||||
let empty = if o.show == "all" { tl!("No images") } else { tl!("Nothing matches the Show filter.") };
|
||||
@@ -817,9 +822,6 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
if let Some(r) = menu_for.or(open_menu).and_then(|id| by_id.get(&id).copied()) {
|
||||
row_act = show_row_menu(ui, &out.response, view, &facts, r);
|
||||
}
|
||||
if o.info {
|
||||
info_reveal = link_info(ui, view, cache.info.as_ref().map(|(id, i)| (*id, i)), units, &mut info_copy);
|
||||
}
|
||||
});
|
||||
|
||||
app.ui.links.selection = selection;
|
||||
|
||||
@@ -484,29 +484,6 @@ pub(crate) fn floated(mut app: VectorcraftApp, panel: &str, lang: &str, place: P
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let rect = |node: &Node| node.bounds().map(|b| Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32), pos2(b.x1 as f32, b.y1 as f32)));
|
||||
let by_id: HashMap<NodeId, &Node> = nodes.iter().map(|(id, n)| (*id, n)).collect();
|
||||
// TEMPORARY diagnostic: MUST REMOVE before publication.
|
||||
if panel == "links" && names.iter().any(|(asked, _)| asked.contains("Überlagerung") || asked.contains("location-width")) {
|
||||
for (root, _) in nodes.iter().filter(|(_, node)| node.role() == Role::TabPanel) {
|
||||
let mut todo = vec![(*root, vec![*root])];
|
||||
while let Some((id, ancestry)) = todo.pop() {
|
||||
let Some(node) = by_id.get(&id) else { continue };
|
||||
eprintln!(
|
||||
"LINK_LOCATION_FINAL lang={lang} id={id:?} role={:?} label={:?} value={:?} description={:?} bounds={:?} children={:?} tab_panel_ancestry={ancestry:?}",
|
||||
node.role(),
|
||||
node.label(),
|
||||
node.value(),
|
||||
node.description(),
|
||||
node.bounds(),
|
||||
node.children()
|
||||
);
|
||||
for child in node.children() {
|
||||
let mut child_ancestry = ancestry.clone();
|
||||
child_ancestry.push(*child);
|
||||
todo.push((*child, child_ancestry));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let under = |root: NodeId| {
|
||||
let mut found = Vec::new();
|
||||
let mut todo = vec![root];
|
||||
|
||||
@@ -525,7 +525,7 @@ fn panel_readout_long_location_fits_and_copies_by_pointer_accessibility_and_keyb
|
||||
for _ in 0..4 {
|
||||
out = a.frame(vec![]);
|
||||
}
|
||||
// TEMPORARY allocation control: MUST REMOVE traces before publication. Activate the real footer button,
|
||||
// Hiding Link Info returns its space to the list. Activate the real footer button,
|
||||
// not private state: Links applies FooterBar's first pick by toggling its existing info option.
|
||||
let layout = |out: &egui::FullOutput| {
|
||||
let nodes = &out.platform_output.accesskit_update.as_ref().expect("the actual floated Links tree").nodes;
|
||||
@@ -562,25 +562,12 @@ fn panel_readout_long_location_fits_and_copies_by_pointer_accessibility_and_keyb
|
||||
out = a.settle();
|
||||
let (list_on, info_on, _) = layout(&out);
|
||||
assert!(info_on.is_some(), "{locale}: the real footer action restores Link Info before the original oracles");
|
||||
eprintln!(
|
||||
"LINK_LOCATION_ALLOCATION locale={locale} list_before={list_before:?} info_before={info_before:?} list_off={list_off:?} info_off={info_off:?} list_on={list_on:?} info_on={info_on:?} off_minus_on_height={}",
|
||||
list_off.height() - list_on.height()
|
||||
);
|
||||
assert!(info_before.is_some(), "{locale}: Link Info starts visible before the real toggle control");
|
||||
assert!(list_before.height() < list_off.height(), "{locale}: initially visible Link Info reserves list space");
|
||||
assert!(list_on.height() < list_off.height(), "{locale}: showing Link Info reserves list space again");
|
||||
assert!(list_on.height() > 0.0, "{locale}: the visible details leave room for the image list");
|
||||
assert_eq!(a.snapshot(), before_toggle, "showing and hiding link details leaves document, selection and history intact");
|
||||
let nodes = &out.platform_output.accesskit_update.as_ref().expect("the floated Links tree").nodes;
|
||||
// TEMPORARY diagnostic: MUST REMOVE before publication. One final snapshot per locale, before the unchanged assertions.
|
||||
eprintln!("LINK_LOCATION_INTEGRATION_FINAL locale={locale} node_count={}", nodes.len());
|
||||
for (id, node) in nodes {
|
||||
eprintln!(
|
||||
"LINK_LOCATION_INTEGRATION_FINAL locale={locale} id={id:?} role={:?} label={:?} value={:?} description={:?} bounds={:?} children={:?}",
|
||||
node.role(),
|
||||
node.label(),
|
||||
node.value(),
|
||||
node.description(),
|
||||
node.bounds(),
|
||||
node.children()
|
||||
);
|
||||
}
|
||||
let body = nodes
|
||||
.iter()
|
||||
.filter(|(_, n)| n.role() == Role::TabPanel)
|
||||
|
||||
Reference in new issue
Block a user