Seperate pane and panel styling

co-authored-by: max <max@zed.dev>
This commit is contained in:
Mikayla Maki 2023-05-30 16:23:16 -07:00
parent 9c707eff27
commit 685e8d7007
No known key found for this signature in database
4 changed files with 32 additions and 22 deletions

View file

@ -89,7 +89,8 @@ pub struct Workspace {
pub breadcrumbs: Interactive<ContainedText>, pub breadcrumbs: Interactive<ContainedText>,
pub disconnected_overlay: ContainedText, pub disconnected_overlay: ContainedText,
pub modal: ContainerStyle, pub modal: ContainerStyle,
pub zoomed_foreground: ContainerStyle, pub zoomed_panel_foreground: ContainerStyle,
pub zoomed_pane_foreground: ContainerStyle,
pub zoomed_background: ContainerStyle, pub zoomed_background: ContainerStyle,
pub notification: ContainerStyle, pub notification: ContainerStyle,
pub notifications: Notifications, pub notifications: Notifications,

View file

@ -2,7 +2,7 @@ mod dragged_item_receiver;
use super::{ItemHandle, SplitDirection}; use super::{ItemHandle, SplitDirection};
use crate::{ use crate::{
item::WeakItemHandle, toolbar::Toolbar, AutosaveSetting, Item, NewFile, NewSearch, NewTerminal, item::WeakItemHandle, toolbar::Toolbar, AutosaveSetting, Item, NewFile, NewSearch,
ToggleZoom, Workspace, WorkspaceSettings, NewCenterTerminal, ToggleZoom, Workspace, WorkspaceSettings, NewCenterTerminal,
}; };
use anyhow::Result; use anyhow::Result;

View file

@ -3270,37 +3270,42 @@ impl View for Workspace {
enum ZoomBackground {} enum ZoomBackground {}
let zoomed = zoomed.upgrade(cx)?; let zoomed = zoomed.upgrade(cx)?;
let mut background_style = let mut foreground_style;
theme.workspace.zoomed_background;
match self.zoomed_position { match self.zoomed_position {
Some(DockPosition::Left) => { Some(DockPosition::Left) => {
background_style.padding.left = 0.; foreground_style =
background_style.padding.top = 0.; theme.workspace.zoomed_panel_foreground;
background_style.padding.bottom = 0.; foreground_style.margin.left = 0.;
background_style.padding.right *= 1.; foreground_style.margin.top = 0.;
foreground_style.margin.bottom = 0.;
} }
Some(DockPosition::Right) => { Some(DockPosition::Right) => {
background_style.padding.right = 0.; foreground_style =
background_style.padding.top = 0.; theme.workspace.zoomed_panel_foreground;
background_style.padding.bottom = 0.; foreground_style.margin.right = 0.;
background_style.padding.left *= 1.; foreground_style.margin.top = 0.;
foreground_style.margin.bottom = 0.;
} }
Some(DockPosition::Bottom) => { Some(DockPosition::Bottom) => {
background_style.padding.left = 0.; foreground_style =
background_style.padding.right = 0.; theme.workspace.zoomed_panel_foreground;
background_style.padding.bottom = 0.; foreground_style.margin.left = 0.;
background_style.padding.top *= 1.; foreground_style.margin.right = 0.;
foreground_style.margin.bottom = 0.;
}
None => {
foreground_style =
theme.workspace.zoomed_pane_foreground;
} }
None => {}
} }
Some( Some(
ChildView::new(&zoomed, cx) ChildView::new(&zoomed, cx)
.contained() .contained()
.with_style(theme.workspace.zoomed_foreground) .with_style(foreground_style)
.aligned() .aligned()
.contained() .contained()
.with_style(background_style) .with_style(theme.workspace.zoomed_background)
.mouse::<ZoomBackground>(0) .mouse::<ZoomBackground>(0)
.capture_all() .capture_all()
.on_down( .on_down(

View file

@ -119,14 +119,18 @@ export default function workspace(colorScheme: ColorScheme) {
cursor: "Arrow", cursor: "Arrow",
}, },
zoomedBackground: { zoomedBackground: {
padding: 10,
cursor: "Arrow", cursor: "Arrow",
background: withOpacity(background(colorScheme.lowest), 0.5) background: withOpacity(background(colorScheme.lowest), 0.85)
}, },
zoomedForeground: { zoomedPaneForeground: {
margin: 10,
shadow: colorScheme.modalShadow, shadow: colorScheme.modalShadow,
border: border(colorScheme.highest, { overlay: true }), border: border(colorScheme.highest, { overlay: true }),
}, },
zoomedPanelForeground: {
margin: 18,
border: border(colorScheme.highest, { overlay: true }),
},
dock: { dock: {
left: { left: {
border: border(layer, { right: true }), border: border(layer, { right: true }),