Add piano roll note snapping

This commit is contained in:
Skyler Lehmkuhl
2026-03-24 19:24:24 -04:00
parent 123fe3f21a
commit 65a550d8f4
6 changed files with 286 additions and 29 deletions
@@ -20,6 +20,8 @@ pub enum LayerProperty {
Visible(bool),
/// Video layer only: toggle live webcam preview
CameraEnabled(bool),
/// Rename the layer; sets has_custom_name = true
Name(String),
}
/// Stored old value for rollback
@@ -33,6 +35,7 @@ enum OldValue {
Opacity(f64),
Visible(bool),
CameraEnabled(bool),
Name(String),
}
/// Action that sets a property on one or more layers
@@ -101,6 +104,7 @@ impl Action for SetLayerPropertiesAction {
};
OldValue::CameraEnabled(val)
}
LayerProperty::Name(_) => OldValue::Name(layer.name().to_string()),
});
}
@@ -118,6 +122,10 @@ impl Action for SetLayerPropertiesAction {
v.camera_enabled = *c;
}
}
LayerProperty::Name(n) => {
layer.set_name(n.clone());
layer.set_has_custom_name(true);
}
}
}
}
@@ -143,6 +151,10 @@ impl Action for SetLayerPropertiesAction {
v.camera_enabled = *c;
}
}
OldValue::Name(n) => {
layer.set_name(n.clone());
layer.set_has_custom_name(false);
}
}
}
}
@@ -206,6 +218,7 @@ impl Action for SetLayerPropertiesAction {
LayerProperty::InputGain(_) => "input gain",
LayerProperty::Muted(_) => "mute",
LayerProperty::Soloed(_) => "solo",
LayerProperty::Name(_) => "name",
LayerProperty::Locked(_) => "lock",
LayerProperty::Opacity(_) => "opacity",
LayerProperty::Visible(_) => "visibility",