Fix incorrect rendering of toolbar in right anchored dock
Make dock keybinding activate the dock if it wasn't hidden, and hide it if it was already active Make clicking the expanded dock wash, hide the dock Fix some issues with programmatically activating other panes, not hiding the dock Tweak dock anchor menu text Swap dock hide button for thin variant Fix dock sidebar interactions Add clicked state to search button and fix presenter issue sending clicked events when mouse not overlapping MouseRegion Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
co-authored by
Mikayla Maki
parent
3c88aa3d18
commit
0b5952e1bd
@@ -571,6 +571,7 @@ pub struct CodeActions {
|
||||
pub struct Interactive<T> {
|
||||
pub default: T,
|
||||
pub hover: Option<T>,
|
||||
pub clicked: Option<T>,
|
||||
pub active: Option<T>,
|
||||
pub disabled: Option<T>,
|
||||
}
|
||||
@@ -579,6 +580,8 @@ impl<T> Interactive<T> {
|
||||
pub fn style_for(&self, state: MouseState, active: bool) -> &T {
|
||||
if active {
|
||||
self.active.as_ref().unwrap_or(&self.default)
|
||||
} else if state.clicked == Some(gpui::MouseButton::Left) && self.clicked.is_some() {
|
||||
self.clicked.as_ref().unwrap()
|
||||
} else if state.hovered {
|
||||
self.hover.as_ref().unwrap_or(&self.default)
|
||||
} else {
|
||||
@@ -601,6 +604,7 @@ impl<'de, T: DeserializeOwned> Deserialize<'de> for Interactive<T> {
|
||||
#[serde(flatten)]
|
||||
default: Value,
|
||||
hover: Option<Value>,
|
||||
clicked: Option<Value>,
|
||||
active: Option<Value>,
|
||||
disabled: Option<Value>,
|
||||
}
|
||||
@@ -627,6 +631,7 @@ impl<'de, T: DeserializeOwned> Deserialize<'de> for Interactive<T> {
|
||||
};
|
||||
|
||||
let hover = deserialize_state(json.hover)?;
|
||||
let clicked = deserialize_state(json.clicked)?;
|
||||
let active = deserialize_state(json.active)?;
|
||||
let disabled = deserialize_state(json.disabled)?;
|
||||
let default = serde_json::from_value(json.default).map_err(serde::de::Error::custom)?;
|
||||
@@ -634,6 +639,7 @@ impl<'de, T: DeserializeOwned> Deserialize<'de> for Interactive<T> {
|
||||
Ok(Interactive {
|
||||
default,
|
||||
hover,
|
||||
clicked,
|
||||
active,
|
||||
disabled,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user