Checkpoint
This commit is contained in:
parent
3b27d41c72
commit
d3916b84c9
4 changed files with 12 additions and 16 deletions
|
@ -146,6 +146,15 @@ pub fn black() -> Hsla {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn white() -> Hsla {
|
||||||
|
Hsla {
|
||||||
|
h: 0.,
|
||||||
|
s: 0.,
|
||||||
|
l: 1.,
|
||||||
|
a: 1.,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Hsla {
|
impl Hsla {
|
||||||
/// Returns true if the HSLA color is fully transparent, false otherwise.
|
/// Returns true if the HSLA color is fully transparent, false otherwise.
|
||||||
pub fn is_transparent(&self) -> bool {
|
pub fn is_transparent(&self) -> bool {
|
||||||
|
|
|
@ -39,8 +39,6 @@ impl<S: 'static> Element for Text<S> {
|
||||||
_view: &mut S,
|
_view: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> Result<(LayoutId, Self::FrameState)> {
|
) -> Result<(LayoutId, Self::FrameState)> {
|
||||||
dbg!("layout text");
|
|
||||||
|
|
||||||
let text_system = cx.text_system().clone();
|
let text_system = cx.text_system().clone();
|
||||||
let text_style = cx.text_style();
|
let text_style = cx.text_style();
|
||||||
let font_size = text_style.font_size * cx.rem_size();
|
let font_size = text_style.font_size * cx.rem_size();
|
||||||
|
|
|
@ -251,15 +251,11 @@ impl<'a, 'w> WindowContext<'a, 'w> {
|
||||||
let (root_layout_id, mut frame_state) = root_view.layout(&mut (), cx)?;
|
let (root_layout_id, mut frame_state) = root_view.layout(&mut (), cx)?;
|
||||||
let available_space = cx.window.content_size.map(Into::into);
|
let available_space = cx.window.content_size.map(Into::into);
|
||||||
|
|
||||||
dbg!("computing layout");
|
|
||||||
cx.window
|
cx.window
|
||||||
.layout_engine
|
.layout_engine
|
||||||
.compute_layout(root_layout_id, available_space)?;
|
.compute_layout(root_layout_id, available_space)?;
|
||||||
dbg!("asking for layout");
|
|
||||||
let layout = cx.window.layout_engine.layout(root_layout_id)?;
|
let layout = cx.window.layout_engine.layout(root_layout_id)?;
|
||||||
|
|
||||||
dbg!("painting root view");
|
|
||||||
|
|
||||||
root_view.paint(layout, &mut (), &mut frame_state, cx)?;
|
root_view.paint(layout, &mut (), &mut frame_state, cx)?;
|
||||||
cx.window.root_view = Some(root_view);
|
cx.window.root_view = Some(root_view);
|
||||||
let scene = cx.window.scene.take();
|
let scene = cx.window.scene.take();
|
||||||
|
@ -277,13 +273,6 @@ impl<'a, 'w> WindowContext<'a, 'w> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MainThread<WindowContext<'_, '_>> {
|
|
||||||
// todo!("implement other methods that use platform window")
|
|
||||||
fn platform_window(&self) -> &dyn PlatformWindow {
|
|
||||||
self.window.platform_window.borrow_on_main_thread().as_ref()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Context for WindowContext<'_, '_> {
|
impl Context for WindowContext<'_, '_> {
|
||||||
type EntityContext<'a, 'w, T: 'static + Send + Sync> = ViewContext<'a, 'w, T>;
|
type EntityContext<'a, 'w, T: 'static + Send + Sync> = ViewContext<'a, 'w, T>;
|
||||||
type Result<T> = T;
|
type Result<T> = T;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
||||||
themes::rose_pine_dawn,
|
themes::rose_pine_dawn,
|
||||||
};
|
};
|
||||||
use gpui3::{
|
use gpui3::{
|
||||||
black, div, img, svg, view, Context, Element, ParentElement, RootView, StyleHelpers, View,
|
div, img, svg, view, white, Context, Element, ParentElement, RootView, StyleHelpers, View,
|
||||||
ViewContext, WindowContext,
|
ViewContext, WindowContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@ impl Workspace {
|
||||||
let theme = rose_pine_dawn();
|
let theme = rose_pine_dawn();
|
||||||
div()
|
div()
|
||||||
.font("Helvetica")
|
.font("Helvetica")
|
||||||
.text_color(black())
|
.text_color(white())
|
||||||
.text_base()
|
.text_base()
|
||||||
.size_full()
|
.size_full()
|
||||||
.fill(theme.middle.positive.default.background)
|
.fill(theme.middle.base.default.background)
|
||||||
.child("Hello world")
|
.child("Hello world")
|
||||||
|
|
||||||
// TODO: Implement style.
|
// TODO: Implement style.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue