settings_ui: Fix stepper buttons to Inactive Opacity to 0.1 increment adjustments (#40477)
Closes #40279 Release Notes: - Fix stepper buttons (+/-) to the Inactive Opacity setting for 0.1 increment adjustments on settings UI --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
@@ -803,3 +803,28 @@ impl Display for MinimumContrast {
|
||||
write!(f, "{:.1}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Opacity of the inactive panes. 0 means transparent, 1 means opaque.
|
||||
///
|
||||
/// Valid range: 0.0 to 1.0
|
||||
/// Default: 1.0
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
derive_more::FromStr,
|
||||
)]
|
||||
#[serde(transparent)]
|
||||
pub struct InactiveOpacity(pub f32);
|
||||
|
||||
impl Display for InactiveOpacity {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:.1}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use settings_macros::MergeFrom;
|
||||
|
||||
use crate::{DockPosition, DockSide, ScrollbarSettingsContent, ShowIndentGuides};
|
||||
use crate::{DockPosition, DockSide, InactiveOpacity, ScrollbarSettingsContent, ShowIndentGuides};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
|
||||
@@ -256,7 +256,8 @@ pub struct ActivePaneModifiers {
|
||||
/// Values are clamped to the [0.0, 1.0] range.
|
||||
///
|
||||
/// Default: `1.0`
|
||||
pub inactive_opacity: Option<f32>,
|
||||
#[schemars(range(min = 0.0, max = 1.0))]
|
||||
pub inactive_opacity: Option<InactiveOpacity>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
||||
@@ -843,7 +843,7 @@ impl VsCodeSettings {
|
||||
{
|
||||
Some(ActivePaneModifiers {
|
||||
border_size: None,
|
||||
inactive_opacity: Some(opacity),
|
||||
inactive_opacity: Some(InactiveOpacity(opacity)),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user