mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
Set Pane Size
This commit is contained in:
parent
fea0ff3745
commit
008655b879
2 changed files with 30 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
||||||
use crate::{status_bar::StatusItemView, Axis, Workspace};
|
use crate::{status_bar::StatusItemView, Axis, Workspace};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
div, Action, AnyView, AppContext, Div, Entity, EntityId, EventEmitter, FocusHandle,
|
div, px, Action, AnyView, AppContext, Component, Div, Entity, EntityId, EventEmitter,
|
||||||
ParentElement, Render, Styled, Subscription, View, ViewContext, WeakView, WindowContext,
|
FocusHandle, ParentElement, Render, Styled, Subscription, View, ViewContext, WeakView,
|
||||||
|
WindowContext,
|
||||||
};
|
};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -429,7 +430,14 @@ impl Render for Dock {
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||||
if let Some(entry) = self.visible_entry() {
|
if let Some(entry) = self.visible_entry() {
|
||||||
div().size_full().child(entry.panel.to_any())
|
let size = entry.panel.size(cx);
|
||||||
|
|
||||||
|
div()
|
||||||
|
.map(|this| match self.position().axis() {
|
||||||
|
Axis::Horizontal => this.w(px(size)).h_full(),
|
||||||
|
Axis::Vertical => this.h(px(size)).w_full(),
|
||||||
|
})
|
||||||
|
.child(entry.panel.to_any())
|
||||||
} else {
|
} else {
|
||||||
div()
|
div()
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,8 @@ use std::{
|
||||||
};
|
};
|
||||||
use theme2::ActiveTheme;
|
use theme2::ActiveTheme;
|
||||||
pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
|
pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
|
||||||
use ui::{h_stack, Button, ButtonVariant, KeyBinding, Label, TextColor, TextTooltip};
|
use ui::TextColor;
|
||||||
|
use ui::{h_stack, Button, ButtonVariant, KeyBinding, Label, TextTooltip};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
pub use workspace_settings::{AutosaveSetting, WorkspaceSettings};
|
pub use workspace_settings::{AutosaveSetting, WorkspaceSettings};
|
||||||
|
@ -3744,7 +3745,15 @@ impl Render for Workspace {
|
||||||
.flex_row()
|
.flex_row()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.h_full()
|
.h_full()
|
||||||
.child(div().flex().flex_1().child(self.left_dock.clone()))
|
// Left Dock
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.flex()
|
||||||
|
.flex_none()
|
||||||
|
.overflow_hidden()
|
||||||
|
.child(self.left_dock.clone()),
|
||||||
|
)
|
||||||
|
// Panes
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
|
@ -3761,7 +3770,14 @@ impl Render for Workspace {
|
||||||
))
|
))
|
||||||
.child(div().flex().flex_1().child(self.bottom_dock.clone())),
|
.child(div().flex().flex_1().child(self.bottom_dock.clone())),
|
||||||
)
|
)
|
||||||
.child(div().flex().flex_1().child(self.right_dock.clone())),
|
// Right Dock
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.flex()
|
||||||
|
.flex_none()
|
||||||
|
.overflow_hidden()
|
||||||
|
.child(self.right_dock.clone()),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.child(self.status_bar.clone())
|
.child(self.status_bar.clone())
|
||||||
|
|
Loading…
Reference in a new issue