Enable more collab UI features (#3496)

* Current Call section of the collab panel
* Improve the collab titlebar
* Add basic UI for following

Following only partially works, but the UI for following is now in
place.
This commit is contained in:
Max Brunsfeld 2023-12-04 18:01:11 -08:00 committed by GitHub
commit ae6ddceb67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 1473 additions and 1781 deletions

View file

@ -0,0 +1,48 @@
use crate::{Bounds, Element, IntoElement, Pixels, StyleRefinement, Styled, WindowContext};
pub fn canvas(callback: impl 'static + FnOnce(Bounds<Pixels>, &mut WindowContext)) -> Canvas {
Canvas {
paint_callback: Box::new(callback),
style: Default::default(),
}
}
pub struct Canvas {
paint_callback: Box<dyn FnOnce(Bounds<Pixels>, &mut WindowContext)>,
style: StyleRefinement,
}
impl IntoElement for Canvas {
type Element = Self;
fn element_id(&self) -> Option<crate::ElementId> {
None
}
fn into_element(self) -> Self::Element {
self
}
}
impl Element for Canvas {
type State = ();
fn layout(
&mut self,
_: Option<Self::State>,
cx: &mut WindowContext,
) -> (crate::LayoutId, Self::State) {
let layout_id = cx.request_layout(&self.style.clone().into(), []);
(layout_id, ())
}
fn paint(self, bounds: Bounds<Pixels>, _: &mut (), cx: &mut WindowContext) {
(self.paint_callback)(bounds, cx)
}
}
impl Styled for Canvas {
fn style(&mut self) -> &mut crate::StyleRefinement {
&mut self.style
}
}

View file

@ -1,3 +1,4 @@
mod canvas;
mod div;
mod img;
mod overlay;
@ -5,6 +6,7 @@ mod svg;
mod text;
mod uniform_list;
pub use canvas::*;
pub use div::*;
pub use img::*;
pub use overlay::*;