T11b loading: progress bars and rings that glide, loading overlay, lazy load, suspense and async view, refresh and typing indicators, upload list; draw-time notifies ask for a frame
This commit is contained in:
38 files changed
+1646
-91
No files matched your search
@@ -46,11 +46,12 @@ impl ParentElement for Collapsible {
|
||||
|
||||
fn measured(state: Entity<Fold>) -> impl IntoElement {
|
||||
canvas(
|
||||
move |bounds, _, cx| {
|
||||
move |bounds, window, cx| {
|
||||
if state.read(cx).height != bounds.size.height {
|
||||
state.update(cx, |fold, cx| {
|
||||
fold.height = bounds.size.height;
|
||||
cx.notify();
|
||||
window.request_animation_frame();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
+4
-2
@@ -22,11 +22,12 @@ fn shortest(heights: &[Pixels]) -> usize {
|
||||
|
||||
fn measure_width(state: gpui::Entity<Pixels>) -> impl IntoElement {
|
||||
canvas(
|
||||
move |bounds, _, cx| {
|
||||
move |bounds, window, cx| {
|
||||
if *state.read(cx) != bounds.size.width {
|
||||
state.update(cx, |width, cx| {
|
||||
*width = bounds.size.width;
|
||||
cx.notify();
|
||||
window.request_animation_frame();
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -135,11 +136,12 @@ impl RenderOnce for Masonry {
|
||||
.child(child)
|
||||
.child(
|
||||
canvas(
|
||||
move |bounds, _, cx| {
|
||||
move |bounds, window, cx| {
|
||||
if state.read(cx)[ix] != bounds.size.height {
|
||||
state.update(cx, |heights, cx| {
|
||||
heights[ix] = bounds.size.height;
|
||||
cx.notify();
|
||||
window.request_animation_frame();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -177,11 +177,12 @@ impl RenderOnce for StickyHeader {
|
||||
.child((self.header)(window, cx))
|
||||
.child(
|
||||
canvas(
|
||||
move |bounds, _, cx| {
|
||||
move |bounds, window, cx| {
|
||||
if header_state.read(cx).header != bounds.size.height {
|
||||
header_state.update(cx, |at, cx| {
|
||||
at.header = bounds.size.height;
|
||||
cx.notify();
|
||||
window.request_animation_frame();
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -196,7 +197,7 @@ impl RenderOnce for StickyHeader {
|
||||
.children(self.body)
|
||||
.child(
|
||||
canvas(
|
||||
move |bounds, _, cx| {
|
||||
move |bounds, window, cx| {
|
||||
let content_top = handle.bounds().top() + handle.offset().y;
|
||||
let (top, height) = (bounds.top() - content_top, bounds.size.height);
|
||||
let at = *section_state.read(cx);
|
||||
@@ -205,6 +206,7 @@ impl RenderOnce for StickyHeader {
|
||||
at.top = top;
|
||||
at.height = height;
|
||||
cx.notify();
|
||||
window.request_animation_frame();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user