Fix widget resizing handles, edge anchoring, scroll sync, and axis limits
Launcher / test (pull_request) Successful in 1m19s
Launcher / apk (pull_request) Skipped

This commit is contained in:
Sprite committed 2026-11-23 05:29:33 +00:00
1 parent 216c80252d
commit bb978fd6de
13 files changed
+538 -76

No files matched your search

+27 -6
View File
@@ -22,12 +22,17 @@ fn cell_style(c : @grid.Cell) -> String {
}
///|
fn handle(edge : String, e : Edge) -> Node[Msg] {
fn handle(edge : String, e : Edge, active : Bool) -> Node[Msg] {
el(
"span",
classes=["resize-handle"],
classes=["resize-handle", cls_if("active", active)],
attrs=[("data-edge", edge), ("aria-hidden", "true")],
handlers={ ..Handlers::none(), down: Some(ResizeBegin(e)), tap: Some(Nop), },
handlers={
..Handlers::none(),
down: Some(ResizeBegin(e)),
tap: Some(Nop),
press: Some(Nop),
},
)
}
@@ -53,9 +58,22 @@ fn Model::view_slot(
el("span", classes=["widget-label"], children=[text(s.str)]),
]
if i == self.resizing {
children.push(handle("r", Right))
children.push(handle("b", Bottom))
children.push(handle("rb", Corner))
let lim = self.limits.get(s.wid).unwrap_or(default_limits)
let active = match self.resize {
Some(r) if r.slot == i => Some(r.edge)
_ => None
}
if lim.h {
children.push(handle("l", Left, active == Some(Left)))
children.push(handle("r", Right, active == Some(Right)))
}
if lim.v {
children.push(handle("t", Top, active == Some(Top)))
children.push(handle("b", Bottom, active == Some(Bottom)))
}
if lim.h && lim.v {
children.push(handle("rb", Corner, active == Some(Corner)))
}
}
Some(
el(
@@ -463,7 +481,10 @@ fn Model::view_sheet(self : Model) -> Array[Node[Msg]] {
///|
fn Model::view_resize_bar(self : Model) -> Node[Msg] {
let s = self.home[self.resizing]
let size = "\{s.cols(self.cols)} × \{s.height()}"
el("div", key=5, classes=["resize-bar"], attrs=[("role", "toolbar")], children=[
el("span", classes=["resize-size"], children=[text(size)]),
el("span", classes=["resize-hint"], children=[
text("Drag to move, or drag the handles to resize"),
]),