Merge branch 'main' into terminal-element

This commit is contained in:
Mikayla
2023-12-06 15:20:04 -08:00
103 changed files with 10646 additions and 3579 deletions
+7 -3
View File
@@ -1,9 +1,11 @@
use crate::{Bounds, Element, IntoElement, Pixels, StyleRefinement, Styled, WindowContext};
use refineable::Refineable as _;
use crate::{Bounds, Element, IntoElement, Pixels, Style, StyleRefinement, Styled, WindowContext};
pub fn canvas(callback: impl 'static + FnOnce(Bounds<Pixels>, &mut WindowContext)) -> Canvas {
Canvas {
paint_callback: Box::new(callback),
style: Default::default(),
style: StyleRefinement::default(),
}
}
@@ -32,7 +34,9 @@ impl Element for Canvas {
_: Option<Self::State>,
cx: &mut WindowContext,
) -> (crate::LayoutId, Self::State) {
let layout_id = cx.request_layout(&self.style.clone().into(), []);
let mut style = Style::default();
style.refine(&self.style);
let layout_id = cx.request_layout(&style, []);
(layout_id, ())
}
+3 -3
View File
@@ -55,7 +55,7 @@ pub trait InteractiveElement: Sized + Element {
E: Debug,
{
if let Some(key_context) = key_context.try_into().log_err() {
self.interactivity().key_context = key_context;
self.interactivity().key_context = Some(key_context);
}
self
}
@@ -737,7 +737,7 @@ impl DivState {
pub struct Interactivity {
pub element_id: Option<ElementId>,
pub key_context: KeyContext,
pub key_context: Option<KeyContext>,
pub focusable: bool,
pub tracked_focus_handle: Option<FocusHandle>,
pub scroll_handle: Option<ScrollHandle>,
@@ -1276,7 +1276,7 @@ impl Default for Interactivity {
fn default() -> Self {
Self {
element_id: None,
key_context: KeyContext::default(),
key_context: None,
focusable: false,
tracked_focus_handle: None,
scroll_handle: None,
+1 -1
View File
@@ -102,7 +102,7 @@ impl Element for Overlay {
let mut desired = self.anchor_corner.get_bounds(origin, size);
let limits = Bounds {
origin: Point::zero(),
origin: Point::default(),
size: cx.viewport_size(),
};