mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Change sidebars to use the window width as a max width rather than participating in the flex
co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
5ce0472a75
commit
c9a306b4ac
@ -2,8 +2,10 @@ use collections::HashMap;
|
||||
use gpui::{
|
||||
actions,
|
||||
elements::{ChildView, Container, Empty, MouseEventHandler, ParentElement, Side, Stack, Svg},
|
||||
geometry::vector::Vector2F,
|
||||
impl_internal_actions, Border, CursorStyle, Element, ElementBox, Entity, MouseButton,
|
||||
MutableAppContext, RenderContext, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
MutableAppContext, RenderContext, SizeConstraint, View, ViewContext, ViewHandle,
|
||||
WeakViewHandle,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use settings::{DockAnchor, Settings};
|
||||
@ -312,7 +314,27 @@ impl Dock {
|
||||
}
|
||||
});
|
||||
|
||||
resizable.flex(5., false).boxed()
|
||||
if anchor == DockAnchor::Right {
|
||||
resizable
|
||||
.constrained()
|
||||
.dynamically(|constraint, cx| {
|
||||
SizeConstraint::new(
|
||||
Vector2F::new(20., constraint.min.y()),
|
||||
Vector2F::new(cx.window_size.x() * 0.8, constraint.max.y()),
|
||||
)
|
||||
})
|
||||
.boxed()
|
||||
} else {
|
||||
resizable
|
||||
.constrained()
|
||||
.dynamically(|constraint, cx| {
|
||||
SizeConstraint::new(
|
||||
Vector2F::new(constraint.min.x(), 50.),
|
||||
Vector2F::new(constraint.max.x(), cx.window_size.y() * 0.8),
|
||||
)
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
DockAnchor::Expanded => {
|
||||
enum ExpandedDockWash {}
|
||||
|
@ -32,12 +32,13 @@ use futures::{
|
||||
use gpui::{
|
||||
actions,
|
||||
elements::*,
|
||||
geometry::vector::Vector2F,
|
||||
impl_actions, impl_internal_actions,
|
||||
keymap_matcher::KeymapContext,
|
||||
platform::{CursorStyle, WindowOptions},
|
||||
AnyModelHandle, AnyViewHandle, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle,
|
||||
MouseButton, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle,
|
||||
MouseButton, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, SizeConstraint,
|
||||
Task, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ProjectItem};
|
||||
use language::LanguageRegistry;
|
||||
@ -2471,7 +2472,16 @@ impl View for Workspace {
|
||||
if self.left_sidebar.read(cx).active_item().is_some() {
|
||||
Some(
|
||||
ChildView::new(&self.left_sidebar, cx)
|
||||
.flex(0.8, false)
|
||||
.constrained()
|
||||
.dynamically(|constraint, cx| {
|
||||
SizeConstraint::new(
|
||||
Vector2F::new(20., constraint.min.y()),
|
||||
Vector2F::new(
|
||||
cx.window_size.x() * 0.8,
|
||||
constraint.max.y(),
|
||||
),
|
||||
)
|
||||
})
|
||||
.boxed(),
|
||||
)
|
||||
} else {
|
||||
@ -2508,7 +2518,16 @@ impl View for Workspace {
|
||||
if self.right_sidebar.read(cx).active_item().is_some() {
|
||||
Some(
|
||||
ChildView::new(&self.right_sidebar, cx)
|
||||
.flex(0.8, false)
|
||||
.constrained()
|
||||
.dynamically(|constraint, cx| {
|
||||
SizeConstraint::new(
|
||||
Vector2F::new(20., constraint.min.y()),
|
||||
Vector2F::new(
|
||||
cx.window_size.x() * 0.8,
|
||||
constraint.max.y(),
|
||||
),
|
||||
)
|
||||
})
|
||||
.boxed(),
|
||||
)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user