mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
fix: make hard controls also limit range movement
This commit is contained in:
@@ -162,8 +162,14 @@ fn blending<T: SetBlendMode + MultiplyAlpha + MultiplyFill + SetClip>(
|
||||
)]
|
||||
mut value: T,
|
||||
blend_mode: BlendMode,
|
||||
#[default(100.)] opacity: Percentage,
|
||||
#[default(100.)] fill: Percentage,
|
||||
#[hard_min(0.)]
|
||||
#[hard_max(100.)]
|
||||
#[default(100.)]
|
||||
opacity: Percentage,
|
||||
#[hard_min(0.)]
|
||||
#[hard_max(100.)]
|
||||
#[default(100.)]
|
||||
fill: Percentage,
|
||||
#[default(false)] clip: bool,
|
||||
) -> T {
|
||||
// TODO: Find a way to make this apply once to the table's parent (i.e. its row in its parent table or Instance<T>) rather than applying to each row in its own table, which produces the undesired result
|
||||
|
||||
@@ -55,6 +55,8 @@ pub struct FieldMetadata {
|
||||
pub default_type: Option<Type>,
|
||||
pub number_min: Option<f64>,
|
||||
pub number_max: Option<f64>,
|
||||
pub number_hard_min: Option<f64>,
|
||||
pub number_hard_max: Option<f64>,
|
||||
pub number_mode_range: Option<(f64, f64)>,
|
||||
pub number_display_decimal_places: Option<u32>,
|
||||
pub number_step: Option<f64>,
|
||||
|
||||
@@ -154,6 +154,23 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
|
||||
_ => quote!(None),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let number_hard_min_values: Vec<_> = fields
|
||||
.iter()
|
||||
.map(|field| match field {
|
||||
ParsedField::Regular { number_hard_min: Some(hard_min), .. } => quote!(Some(#hard_min)),
|
||||
_ => quote!(None),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let number_hard_max_values: Vec<_> = fields
|
||||
.iter()
|
||||
.map(|field| match field {
|
||||
ParsedField::Regular { number_hard_max: Some(hard_max), .. } => quote!(Some(#hard_max)),
|
||||
_ => quote!(None),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let number_mode_range_values: Vec<_> = fields
|
||||
.iter()
|
||||
.map(|field| match field {
|
||||
@@ -419,6 +436,8 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
|
||||
default_type: #default_types,
|
||||
number_min: #number_min_values,
|
||||
number_max: #number_max_values,
|
||||
number_hard_min: #number_hard_min_values,
|
||||
number_hard_max: #number_hard_max_values,
|
||||
number_mode_range: #number_mode_range_values,
|
||||
number_display_decimal_places: #number_display_decimal_places,
|
||||
number_step: #number_step,
|
||||
|
||||
Reference in New Issue
Block a user