mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Fix an assortment of small bugs (#3968)
* Fix an assertion failure bug when scaling a line in the transform cage * Fix missing defaults on node gradient inputs * Fix Blend Shapes path input wire not updating to show in the UI after Layer > Blend * Fix assertion failure due to browser non-monotonic timestamp * Fix SVG renderer drawing 1px strokes as half-width when using stroke alignment * Fix incorrect appearance of the ColorInput widget when set to "none" and "disabled" * Fix lerp function in Fill enum to handle None cases correctly * Fix stroke alignment bug
This commit is contained in:
@@ -127,6 +127,9 @@ macro_rules! tagged_value {
|
||||
// Tries using the default for the tagged value type. If it not implemented, then uses the default used in document_node_types. If it is not used there, then TaggedValue::None is returned.
|
||||
Some(match concrete_type.id? {
|
||||
x if x == TypeId::of::<()>() => TaggedValue::None,
|
||||
// Table-wrapped types need a single-row default with the element's default, not an empty table
|
||||
x if x == TypeId::of::<Table<Color>>() => TaggedValue::Color(Table::new_from_element(Color::default())),
|
||||
x if x == TypeId::of::<Table<GradientStops>>() => TaggedValue::GradientTable(Table::new_from_element(GradientStops::default())),
|
||||
$( x if x == TypeId::of::<$ty>() => TaggedValue::$identifier(Default::default()), )*
|
||||
_ => return None,
|
||||
})
|
||||
|
||||
@@ -112,8 +112,10 @@ impl RenderExt for Stroke {
|
||||
return String::new();
|
||||
}
|
||||
|
||||
let default_weight = if self.align != StrokeAlign::Center && render_params.aligned_strokes { 1. / 2. } else { 1. };
|
||||
|
||||
// Set to None if the value is the SVG default
|
||||
let weight = (self.weight != 1.).then_some(self.weight);
|
||||
let weight = (self.weight != default_weight).then_some(self.weight);
|
||||
let dash_array = (!self.dash_lengths.is_empty()).then_some(self.dash_lengths());
|
||||
let dash_offset = (self.dash_offset != 0.).then_some(self.dash_offset);
|
||||
let stroke_cap = (self.cap != StrokeCap::Butt).then_some(self.cap);
|
||||
|
||||
@@ -64,8 +64,8 @@ impl Fill {
|
||||
|
||||
pub fn lerp(&self, other: &Self, time: f64) -> Self {
|
||||
let transparent = Self::solid(Color::TRANSPARENT);
|
||||
let a = if *self == Self::None { &transparent } else { self };
|
||||
let b = if *other == Self::None { &transparent } else { other };
|
||||
let a = if *self == Self::None && *other != Self::None { &transparent } else { self };
|
||||
let b = if *other == Self::None && *self != Self::None { &transparent } else { other };
|
||||
|
||||
match (a, b) {
|
||||
(Self::Solid(a), Self::Solid(b)) => Self::Solid(a.lerp(b, time as f32)),
|
||||
@@ -82,7 +82,7 @@ impl Fill {
|
||||
Self::Gradient(a.lerp(b, time))
|
||||
}
|
||||
(Self::Gradient(a), Self::Gradient(b)) => Self::Gradient(a.lerp(b, time)),
|
||||
_ => Self::None,
|
||||
(Self::None, _) | (_, Self::None) => Self::None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user