fix(kiosk): pin NavRail row to root.width so tiles distribute
The tiles still collapsed to the bottom-left even with per-tile horizontal-stretch: a HorizontalLayout nested in the rail's VerticalLayout was taking its preferred (content) width, not the rail width. Drop the wrapper, make the tile row an explicit width: root.width child with the hairline as an overlay, and the 6 tiles now spread evenly across the panel. cc
This commit is contained in:
1 file changed
+69
-68
@@ -2,11 +2,8 @@
|
|||||||
//
|
//
|
||||||
// Six ~80px icon+label tiles (Radius.sm rectangles, NO pills — ADR-008)
|
// Six ~80px icon+label tiles (Radius.sm rectangles, NO pills — ADR-008)
|
||||||
// replacing the desktop Sidebar on the kiosk panel, driving the SAME NavState
|
// replacing the desktop Sidebar on the kiosk panel, driving the SAME NavState
|
||||||
// routes. Net-new component; patterned after the Sidebar's nav rows and the
|
// routes. Net-new component; tokens/accent/radii/icons from the existing set.
|
||||||
// control-alignment standard: tokens/accent/radii only, no invented values,
|
// Labels reuse existing `@tr` msgids so no new `.po` strings are introduced.
|
||||||
// icons from the existing `assets/icons` set. Labels reuse existing `@tr`
|
|
||||||
// msgids (Discover/Library/Search/Now Playing/Visualizer/Settings) so no new
|
|
||||||
// `.po` strings are introduced.
|
|
||||||
import { Theme } from "../foundation/semantic-colors.slint";
|
import { Theme } from "../foundation/semantic-colors.slint";
|
||||||
import { Radius } from "../foundation/radius.slint";
|
import { Radius } from "../foundation/radius.slint";
|
||||||
import { NavState, ContentView, ImmersiveState } from "../state.slint";
|
import { NavState, ContentView, ImmersiveState } from "../state.slint";
|
||||||
@@ -63,75 +60,79 @@ export component NavRail inherits Rectangle {
|
|||||||
|
|
||||||
background: Theme.surface-main;
|
background: Theme.surface-main;
|
||||||
|
|
||||||
VerticalLayout {
|
// Top hairline (overlay — kept out of the tile row).
|
||||||
spacing: 0px;
|
Rectangle {
|
||||||
// Top hairline separating the rail from the transport bar.
|
x: 0;
|
||||||
Rectangle {
|
y: 0;
|
||||||
height: 1px;
|
width: root.width;
|
||||||
background: Theme.border-subtle;
|
height: 1px;
|
||||||
}
|
background: Theme.border-subtle;
|
||||||
HorizontalLayout {
|
}
|
||||||
// Fill the height below the hairline so tiles are full-height touch
|
|
||||||
// targets, and stretch each tile at the MOUNT site (a stretch set
|
|
||||||
// only inside the child component's root is not honored by the
|
|
||||||
// parent layout — that was why the tiles collapsed to icon width).
|
|
||||||
vertical-stretch: 1;
|
|
||||||
padding: 8px;
|
|
||||||
spacing: 6px;
|
|
||||||
|
|
||||||
NavTile {
|
// Tile row. EXPLICIT `width: root.width` — a HorizontalLayout nested inside
|
||||||
horizontal-stretch: 1;
|
// a VerticalLayout was not filling the rail width, so the tiles collapsed to
|
||||||
icon: @image-url("../assets/icons/compass.svg");
|
// icon width packed on the left. Pinning the row to the rail's full width
|
||||||
label: @tr("Discover");
|
// lets each tile's horizontal-stretch distribute them evenly across it.
|
||||||
active: NavState.view == ContentView.home;
|
HorizontalLayout {
|
||||||
clicked => {
|
x: 0;
|
||||||
root.discover();
|
y: 1px;
|
||||||
}
|
width: root.width;
|
||||||
|
height: root.height - 1px;
|
||||||
|
padding: 8px;
|
||||||
|
spacing: 6px;
|
||||||
|
|
||||||
|
NavTile {
|
||||||
|
horizontal-stretch: 1;
|
||||||
|
icon: @image-url("../assets/icons/compass.svg");
|
||||||
|
label: @tr("Discover");
|
||||||
|
active: NavState.view == ContentView.home;
|
||||||
|
clicked => {
|
||||||
|
root.discover();
|
||||||
}
|
}
|
||||||
NavTile {
|
}
|
||||||
horizontal-stretch: 1;
|
NavTile {
|
||||||
icon: @image-url("../assets/icons/library-big.svg");
|
horizontal-stretch: 1;
|
||||||
label: @tr("Library");
|
icon: @image-url("../assets/icons/library-big.svg");
|
||||||
active: NavState.view == ContentView.favorites;
|
label: @tr("Library");
|
||||||
clicked => {
|
active: NavState.view == ContentView.favorites;
|
||||||
root.library();
|
clicked => {
|
||||||
}
|
root.library();
|
||||||
}
|
}
|
||||||
NavTile {
|
}
|
||||||
horizontal-stretch: 1;
|
NavTile {
|
||||||
icon: @image-url("../assets/icons/search.svg");
|
horizontal-stretch: 1;
|
||||||
label: @tr("Search");
|
icon: @image-url("../assets/icons/search.svg");
|
||||||
active: NavState.view == ContentView.search;
|
label: @tr("Search");
|
||||||
clicked => {
|
active: NavState.view == ContentView.search;
|
||||||
root.search();
|
clicked => {
|
||||||
}
|
root.search();
|
||||||
}
|
}
|
||||||
NavTile {
|
}
|
||||||
horizontal-stretch: 1;
|
NavTile {
|
||||||
icon: @image-url("../assets/icons/play-fill.svg");
|
horizontal-stretch: 1;
|
||||||
label: @tr("Now Playing");
|
icon: @image-url("../assets/icons/play-fill.svg");
|
||||||
active: ImmersiveState.open;
|
label: @tr("Now Playing");
|
||||||
clicked => {
|
active: ImmersiveState.open;
|
||||||
root.playing();
|
clicked => {
|
||||||
}
|
root.playing();
|
||||||
}
|
}
|
||||||
NavTile {
|
}
|
||||||
horizontal-stretch: 1;
|
NavTile {
|
||||||
icon: @image-url("../assets/icons/sliders-horizontal.svg");
|
horizontal-stretch: 1;
|
||||||
label: @tr("Visualizer");
|
icon: @image-url("../assets/icons/sliders-horizontal.svg");
|
||||||
active: false;
|
label: @tr("Visualizer");
|
||||||
clicked => {
|
active: false;
|
||||||
root.visualizer();
|
clicked => {
|
||||||
}
|
root.visualizer();
|
||||||
}
|
}
|
||||||
NavTile {
|
}
|
||||||
horizontal-stretch: 1;
|
NavTile {
|
||||||
icon: @image-url("../assets/icons/settings.svg");
|
horizontal-stretch: 1;
|
||||||
label: @tr("Settings");
|
icon: @image-url("../assets/icons/settings.svg");
|
||||||
active: NavState.view == ContentView.settings;
|
label: @tr("Settings");
|
||||||
clicked => {
|
active: NavState.view == ContentView.settings;
|
||||||
root.menu();
|
clicked => {
|
||||||
}
|
root.menu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user