Fix layout panic on empty editors with blocks
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
40a4c18ee4
commit
e392368d89
2 changed files with 86 additions and 13 deletions
|
@ -110,13 +110,7 @@ impl Presenter {
|
|||
|
||||
if let Some(root_view_id) = cx.root_view_id(self.window_id) {
|
||||
self.layout(window_size, refreshing, cx);
|
||||
let mut paint_cx = PaintContext {
|
||||
scene: &mut scene,
|
||||
font_cache: &self.font_cache,
|
||||
text_layout_cache: &self.text_layout_cache,
|
||||
rendered_views: &mut self.rendered_views,
|
||||
app: cx.as_ref(),
|
||||
};
|
||||
let mut paint_cx = self.build_paint_context(&mut scene, cx);
|
||||
paint_cx.paint(
|
||||
root_view_id,
|
||||
Vector2F::zero(),
|
||||
|
@ -159,6 +153,20 @@ impl Presenter {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn build_paint_context<'a>(
|
||||
&'a mut self,
|
||||
scene: &'a mut Scene,
|
||||
cx: &'a mut MutableAppContext,
|
||||
) -> PaintContext {
|
||||
PaintContext {
|
||||
scene,
|
||||
font_cache: &self.font_cache,
|
||||
text_layout_cache: &self.text_layout_cache,
|
||||
rendered_views: &mut self.rendered_views,
|
||||
app: cx,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dispatch_event(&mut self, event: Event, cx: &mut MutableAppContext) {
|
||||
if let Some(root_view_id) = cx.root_view_id(self.window_id) {
|
||||
match event {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue