mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-27 16:57:08 +00:00
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 {
|
||||
/// Returns true if the HSLA color is fully transparent, false otherwise.
|
||||
pub fn is_transparent(&self) -> bool {
|
||||
|
|
|
@ -39,8 +39,6 @@ impl<S: 'static> Element for Text<S> {
|
|||
_view: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> Result<(LayoutId, Self::FrameState)> {
|
||||
dbg!("layout text");
|
||||
|
||||
let text_system = cx.text_system().clone();
|
||||
let text_style = cx.text_style();
|
||||
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 available_space = cx.window.content_size.map(Into::into);
|
||||
|
||||
dbg!("computing layout");
|
||||
cx.window
|
||||
.layout_engine
|
||||
.compute_layout(root_layout_id, available_space)?;
|
||||
dbg!("asking for layout");
|
||||
let layout = cx.window.layout_engine.layout(root_layout_id)?;
|
||||
|
||||
dbg!("painting root view");
|
||||
|
||||
root_view.paint(layout, &mut (), &mut frame_state, cx)?;
|
||||
cx.window.root_view = Some(root_view);
|
||||
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<'_, '_> {
|
||||
type EntityContext<'a, 'w, T: 'static + Send + Sync> = ViewContext<'a, 'w, T>;
|
||||
type Result<T> = T;
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
themes::rose_pine_dawn,
|
||||
};
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -29,10 +29,10 @@ impl Workspace {
|
|||
let theme = rose_pine_dawn();
|
||||
div()
|
||||
.font("Helvetica")
|
||||
.text_color(black())
|
||||
.text_color(white())
|
||||
.text_base()
|
||||
.size_full()
|
||||
.fill(theme.middle.positive.default.background)
|
||||
.fill(theme.middle.base.default.background)
|
||||
.child("Hello world")
|
||||
|
||||
// TODO: Implement style.
|
||||
|
|
Loading…
Reference in a new issue