web: add scroll to top button and squelch some debug logging
This commit is contained in:
parent
d4fc2e2ef1
commit
bd578191a8
@ -511,13 +511,6 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
.value_of();
|
.value_of();
|
||||||
|
|
||||||
let r = el.get_bounding_client_rect();
|
let r = el.get_bounding_client_rect();
|
||||||
info!(
|
|
||||||
"window scrolled {}x{}@{},{}",
|
|
||||||
r.width(),
|
|
||||||
r.height(),
|
|
||||||
r.x(),
|
|
||||||
r.y(),
|
|
||||||
);
|
|
||||||
let end = r.height() - ih;
|
let end = r.height() - ih;
|
||||||
let y = -r.y();
|
let y = -r.y();
|
||||||
orders.send_msg(Msg::SetProgress((y / end).max(0.)));
|
orders.send_msg(Msg::SetProgress((y / end).max(0.)));
|
||||||
|
|||||||
@ -869,12 +869,13 @@ fn thread(
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
div![el_ref(content_el), messages] /* TODO(wathiede): plumb in orignal id
|
div![el_ref(content_el), messages, click_to_top()],
|
||||||
a![
|
/* TODO(wathiede): plumb in orignal id
|
||||||
attrs! {At::Href=>api::original(&thread_node.0.as_ref().expect("message missing").id)},
|
a![
|
||||||
"Original"
|
attrs! {At::Href=>api::original(&thread_node.0.as_ref().expect("message missing").id)},
|
||||||
],
|
"Original"
|
||||||
*/
|
],
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1129,7 +1130,7 @@ fn news_post(
|
|||||||
"Original"
|
"Original"
|
||||||
],
|
],
|
||||||
*/
|
*/
|
||||||
ev(Ev::Scroll, |e| info!("scroll event {e:?}"))
|
click_to_top(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg> {
|
fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg> {
|
||||||
@ -1222,3 +1223,14 @@ pub fn versions(versions: &crate::state::Version) -> Node<Msg> {
|
|||||||
])
|
])
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn click_to_top() -> Node<Msg> {
|
||||||
|
button![
|
||||||
|
C!["button", "is-danger", "is-small"],
|
||||||
|
span!["Top"],
|
||||||
|
span![C!["icon"], i![C!["fas", "fa-arrow-turn-up"]]],
|
||||||
|
ev(Ev::Click, move |_| web_sys::window()
|
||||||
|
.unwrap()
|
||||||
|
.scroll_to_with_x_and_y(0., 0.))
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user