Use split direction preferences more (#16679)

Use new split direction preferences in more places (#16345)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-08-22 11:13:33 -06:00 committed by GitHub
parent 93642c9c51
commit c697eaba82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 54 additions and 41 deletions

View file

@ -1,4 +1,8 @@
use crate::{pane_group::element::pane_axis, AppState, FollowerState, Pane, Workspace};
use crate::{
pane_group::element::pane_axis,
workspace_settings::{PaneSplitDirectionHorizontal, PaneSplitDirectionVertical},
AppState, FollowerState, Pane, Workspace, WorkspaceSettings,
};
use anyhow::{anyhow, Result};
use call::{ActiveCall, ParticipantLocation};
use client::proto::PeerId;
@ -10,6 +14,7 @@ use gpui::{
use parking_lot::Mutex;
use project::Project;
use serde::Deserialize;
use settings::Settings;
use std::sync::Arc;
use ui::prelude::*;
@ -561,6 +566,20 @@ impl SplitDirection {
[Self::Up, Self::Down, Self::Left, Self::Right]
}
pub fn vertical(cx: &WindowContext) -> Self {
match WorkspaceSettings::get_global(cx).pane_split_direction_vertical {
PaneSplitDirectionVertical::Left => SplitDirection::Left,
PaneSplitDirectionVertical::Right => SplitDirection::Right,
}
}
pub fn horizontal(cx: &WindowContext) -> Self {
match WorkspaceSettings::get_global(cx).pane_split_direction_horizontal {
PaneSplitDirectionHorizontal::Down => SplitDirection::Down,
PaneSplitDirectionHorizontal::Up => SplitDirection::Up,
}
}
pub fn edge(&self, rect: Bounds<Pixels>) -> Pixels {
match self {
Self::Up => rect.origin.y,