From bbcc136946e9e0f69a169758728aabb160803dad Mon Sep 17 00:00:00 2001 From: cadlaxa Date: Thu, 28 May 2026 17:41:09 +0800 Subject: [PATCH 1/2] scrollable options param --- OpenUtau/Controls/ExpressionCanvas.cs | 20 +++++++++++++++++++- OpenUtau/Views/PianoRollWindow.axaml | 27 +++++++++++++++------------ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/OpenUtau/Controls/ExpressionCanvas.cs b/OpenUtau/Controls/ExpressionCanvas.cs index 6dfccd07f..3187ed4ea 100644 --- a/OpenUtau/Controls/ExpressionCanvas.cs +++ b/OpenUtau/Controls/ExpressionCanvas.cs @@ -87,9 +87,27 @@ public ExpressionCanvas() { protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { base.OnPropertyChanged(change); + if (change.Property == KeyProperty || change.Property == PartProperty) { + InvalidateMeasure(); + } InvalidateVisual(); } + protected override Size MeasureOverride(Size availableSize) { + double requiredHeight = 0; + if (Part != null && !string.IsNullOrEmpty(Key)) { + var project = DocManager.Inst.Project; + if (project.tracks[Part.trackNo].TryGetExpDescriptor(project, Key, out var descriptor)) { + if (descriptor.type == UExpressionType.Options) { + requiredHeight = descriptor.options.Length * 24; + } + } + } + return new Size( + double.IsInfinity(availableSize.Width) ? 0 : availableSize.Width, + requiredHeight + ); + } public override void Render(DrawingContext context) { base.Render(context); if (Part == null) { @@ -111,7 +129,7 @@ public override void Render(DrawingContext context) { double leftTick = TickOffset - 480; double rightTick = TickOffset + Bounds.Width / TickWidth + 480; double optionHeight = descriptor.type == UExpressionType.Options - ? Bounds.Height / descriptor.options.Length + ? Math.Max(Bounds.Height / descriptor.options.Length, 24.0) : 0; if (descriptor.type == UExpressionType.Curve) { var curve = Part.curves.FirstOrDefault(c => c.descriptor == descriptor); diff --git a/OpenUtau/Views/PianoRollWindow.axaml b/OpenUtau/Views/PianoRollWindow.axaml index b98e456d8..4c548e1b5 100644 --- a/OpenUtau/Views/PianoRollWindow.axaml +++ b/OpenUtau/Views/PianoRollWindow.axaml @@ -624,18 +624,21 @@ Part="{Binding NotesViewModel.Part}" Key="{Binding NotesViewModel.SecondaryKey}" ShowRealCurve="False"/> - - + + + + Date: Fri, 29 May 2026 16:10:41 +0800 Subject: [PATCH 2/2] Fix expression panel --- OpenUtau/Controls/PianoRoll.axaml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/OpenUtau/Controls/PianoRoll.axaml b/OpenUtau/Controls/PianoRoll.axaml index 7f7ff44bd..885e7b95f 100644 --- a/OpenUtau/Controls/PianoRoll.axaml +++ b/OpenUtau/Controls/PianoRoll.axaml @@ -659,18 +659,20 @@ Part="{Binding NotesViewModel.Part}" Key="{Binding NotesViewModel.SecondaryKey}" ShowRealCurve="False"/> - + + +