mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-22 18:41:27 +01:00
ui-widgets: a TileGrid rule head stays a section the grid draws and only stops taking the lead
Under GroupHeads::Rule the outline reported the head as no section stop, so the collection built it as an item and handed the group's key to the app's tile painter (the rule-heads story indexed its tiles past their end). The head stays a section stop, cannot take the lead (enabled is false), and declares its section part so its heading node keeps the group's name.
This commit is contained in:
1 parent
241e37e03c
commit
91c54be4d2
2 files changed
+6
-8
No files matched your search
@@ -570,8 +570,9 @@ impl<K: Clone + Eq + Hash + Send + Sync + 'static> Component for TileGrid<'_, K>
|
||||
continue;
|
||||
}
|
||||
if rule {
|
||||
// A divider takes no press and no stop: it is placed for its paint only.
|
||||
// A divider takes no press and no stop: its part only carries the heading node.
|
||||
self.placed.push(Placed { group, rect, pinned: false, toggle: false });
|
||||
cx.part(section_part(&declared.key), rect);
|
||||
continue;
|
||||
}
|
||||
let column = self
|
||||
|
||||
@@ -24,7 +24,7 @@ pub(super) struct Outline<'s, K> {
|
||||
/// The keys of the tail rows.
|
||||
tail: Vec<K>,
|
||||
collapsible: bool,
|
||||
/// Under `Rule` a header is a divider: it is a row of the outline but no stop.
|
||||
/// Under `Rule` a header is a divider: it is a row of the outline the grid draws, but it never takes the lead.
|
||||
heads: GroupHeads,
|
||||
}
|
||||
|
||||
@@ -97,11 +97,7 @@ impl<K: Clone + PartialEq> DisplayOrder<K> for Outline<'_, K> {
|
||||
}
|
||||
|
||||
fn section_stop(&self, at: usize) -> bool {
|
||||
match self.slot(at) {
|
||||
Slot::Header(_) => self.heads == GroupHeads::Titled,
|
||||
Slot::Tail(_) => true,
|
||||
Slot::Tile(_) => false,
|
||||
}
|
||||
self.is_section(at)
|
||||
}
|
||||
|
||||
fn section_stops_before(&self, at: usize) -> usize {
|
||||
@@ -110,7 +106,8 @@ impl<K: Clone + PartialEq> DisplayOrder<K> for Outline<'_, K> {
|
||||
|
||||
fn enabled(&self, at: usize) -> bool {
|
||||
match self.slot(at) {
|
||||
Slot::Header(_) | Slot::Tail(_) => true,
|
||||
Slot::Header(_) => self.heads == GroupHeads::Titled,
|
||||
Slot::Tail(_) => true,
|
||||
Slot::Tile(tile) => self.inner.enabled(tile),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user