修复训练页长文本撑宽图像区域的问题
This commit is contained in:
parent
557ab871ed
commit
f12f5d30e1
@ -5,7 +5,7 @@
|
||||
<UserControl.Resources>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer Margin="12" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<Grid Height="{Binding Viewport.Height, RelativeSource={RelativeSource AncestorType=ScrollViewer}}" MinWidth="1080" MinHeight="720">
|
||||
<Grid Width="{Binding Viewport.Width, RelativeSource={RelativeSource AncestorType=ScrollViewer}}" Height="{Binding Viewport.Height, RelativeSource={RelativeSource AncestorType=ScrollViewer}}" MinWidth="1080" MinHeight="720">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
@ -202,6 +202,7 @@ internal static class Smoke
|
||||
trainer.RecipeName="另一配方";
|
||||
Check(trainer.Project is null&&trainer.Frames.Count==0,"Switching recipes clears the previous recipe's annotation project");
|
||||
trainer.RecipeName=savedRecipe;trainer.Load(project.FilePath);
|
||||
await CheckTrainingLayout(window,trainingView,trainer);
|
||||
Save(window,"training-project");
|
||||
trainer.DoctorCommand.Execute();
|
||||
for(var i=0;i<300&&trainer.IsBusy;i++)await Task.Delay(100);
|
||||
@ -271,6 +272,31 @@ internal static class Smoke
|
||||
catch(Exception ex){Console.Error.WriteLine(ex);}
|
||||
finally{lifetime.Shutdown(_exit);}
|
||||
}
|
||||
private static async Task CheckTrainingLayout(Window window,TrainingPage view,SopHelper.Training.MainViewModel trainer)
|
||||
{
|
||||
var width=window.Width;var logs=trainer.Logs;var status=trainer.Status;
|
||||
var scroll=(ScrollViewer)view.Content!;var layout=(Grid)scroll.Content!;
|
||||
var canvas=view.GetVisualDescendants().OfType<AnnotationCanvas>().Single();
|
||||
var tabs=view.GetVisualDescendants().OfType<TabControl>().Single();var selectedTab=tabs.SelectedIndex;
|
||||
try
|
||||
{
|
||||
trainer.Logs="训练日志:"+new string('W',3000);trainer.Status="训练状态:"+new string('W',1000);
|
||||
foreach(var size in new[]{1180d,1600d,1000d,1180d})
|
||||
{
|
||||
window.Width=size;
|
||||
for(var tab=0;tab<tabs.ItemCount;tab++)
|
||||
{
|
||||
tabs.SelectedIndex=tab;await Task.Delay(60);window.UpdateLayout();
|
||||
var expected=Math.Max(1080,scroll.Viewport.Width);
|
||||
Check(Math.Abs(layout.Bounds.Width-expected)<1,
|
||||
$"Training layout stays within viewport/minimum width with long logs and status ({size}, tab {tab}); actual={layout.Bounds.Width}, expected={expected}");
|
||||
Check(canvas.Bounds.Width>100&&canvas.Bounds.Width<=expected-574,
|
||||
"Annotation canvas stays within the center column after resizing and tab changes");
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {window.Width=width;trainer.Logs=logs;trainer.Status=status;tabs.SelectedIndex=selectedTab;}
|
||||
}
|
||||
private static void CheckCameraPreferences(App app)
|
||||
{
|
||||
var path=Path.Combine(Environment.GetEnvironmentVariable("SOPHELPER_WORKSPACE_ROOT")!,"workspace","last-camera.json");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user