Remove initialize method from Element trait
This commit is contained in:
parent
33a808a49b
commit
c6b374ebc9
5 changed files with 53 additions and 71 deletions
|
@ -2398,21 +2398,14 @@ impl Element<Editor> for EditorElement {
|
|||
Some(self.editor_id.into())
|
||||
}
|
||||
|
||||
fn initialize(
|
||||
fn layout(
|
||||
&mut self,
|
||||
editor: &mut Editor,
|
||||
element_state: Option<Self::ElementState>,
|
||||
cx: &mut gpui::ViewContext<Editor>,
|
||||
) -> Self::ElementState {
|
||||
) -> (gpui::LayoutId, Self::ElementState) {
|
||||
editor.style = Some(self.style.clone()); // Long-term, we'd like to eliminate this.
|
||||
}
|
||||
|
||||
fn layout(
|
||||
&mut self,
|
||||
editor: &mut Editor,
|
||||
element_state: &mut Self::ElementState,
|
||||
cx: &mut gpui::ViewContext<Editor>,
|
||||
) -> gpui::LayoutId {
|
||||
let rem_size = cx.rem_size();
|
||||
let mut style = Style::default();
|
||||
style.size.width = relative(1.).into();
|
||||
|
@ -2421,7 +2414,8 @@ impl Element<Editor> for EditorElement {
|
|||
EditorMode::AutoHeight { .. } => todo!(),
|
||||
EditorMode::Full => relative(1.).into(),
|
||||
};
|
||||
cx.request_layout(&style, None)
|
||||
let layout_id = cx.request_layout(&style, None);
|
||||
(layout_id, ())
|
||||
}
|
||||
|
||||
fn paint(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue