This commit is contained in:
2509_92447106 committed 2026-11-07 20:18:34 +08:00
1 parent 639ff1ba57
commit e4ea4f054e
4 files changed
+46 -17

No files matched your search

+5 -1
View File
@@ -679,7 +679,11 @@ public class CelestialView : Control, IDisposable
private Vector3 RotationLight(Matrix4x4 cam, double tiltDeg)
{
var axisCam = Vector3.TransformNormal(AxisWorld(tiltDeg), cam);
var forwardRight = Vector3.Normalize(new Vector3(0.86f, 0f, 0.50f));
// 特写模式:光从正右方水平射来,晨昏线竖直居中、正对观察者,
// 便于课堂直观看昼夜半球;主画布仍用斜向光体现立体感。
var forwardRight = InsetMode
? new Vector3(1f, 0f, 0f)
: Vector3.Normalize(new Vector3(0.86f, 0f, 0.50f));
var u = forwardRight - axisCam * Vector3.Dot(forwardRight, axisCam);
if (u.Length() < 0.001f) u = new Vector3(1, 0, 0);
u = Vector3.Normalize(u);
+21 -10
View File
@@ -216,8 +216,7 @@ public sealed class EarthModelView : UserControl, IDisposable
// ---------------------------------------------------------------- 顶部主工具栏
private Control BuildTopBar()
{
var close = MakeButton(_texts["close"], () => _context.RequestClose());
// 关闭按钮统一放在窗口右上角的自建标题栏,这里不再重复放左上角
var title = new StackPanel { Spacing = 1, VerticalAlignment = VerticalAlignment.Center };
title.Children.Add(new TextBlock
{
@@ -268,14 +267,13 @@ public sealed class EarthModelView : UserControl, IDisposable
actions.Children.Add(MakeButton(_texts["classroom"], () => SetLessonsVisible(!_showLessons)));
actions.Children.Add(MakeButton("⛶", ToggleFullScreen, large: true));
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,Auto,*,Auto") };
grid.Children.Add(close);
Grid.SetColumn(title, 1);
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*,Auto") };
Grid.SetColumn(title, 0);
title.Margin = new Thickness(14, 0, 0, 0);
grid.Children.Add(title);
Grid.SetColumn(_viewSwitch, 2);
Grid.SetColumn(_viewSwitch, 1);
grid.Children.Add(_viewSwitch);
Grid.SetColumn(actions, 4);
Grid.SetColumn(actions, 3);
grid.Children.Add(actions);
return new Border { Background = PanelBg, Padding = new Thickness(16, 9), Child = grid };
@@ -716,10 +714,23 @@ public sealed class EarthModelView : UserControl, IDisposable
? _texts.Pick(season.TeachingI18n, _texts["orbitTeach"])
: _texts["orbitTeach"];
if (_showCloseup && (double.IsNaN(_lastDeclination) || Math.Abs(_lastDeclination - decl) > 0.04))
// 特写的直射纬度用缓动逼近目标,而不是瞬间跳变:
// 公转时拖动/改变轨道角,晨昏线会平滑地移过去(每次 timer 步进一帧)。
if (_showCloseup)
{
_closeup.DeclinationDeg = decl;
_lastDeclination = decl;
var target = decl;
var current = _closeup.DeclinationDeg;
var diff = target - current;
if (Math.Abs(diff) < 0.02)
{
_closeup.DeclinationDeg = target;
}
else
{
// 每 140ms 走剩余距离的 ~18%,形成自然的 ease-out 动画
_closeup.DeclinationDeg = current + diff * 0.18;
}
_lastDeclination = target;
}
}
@@ -252,28 +252,40 @@
<Setter Property="FontSize" Value="12.5" />
</Style>
<!-- 自建标题栏按钮 -->
<!--
自建标题栏按钮只做背景/前景色渐变,不参与全局的 scale 动画:
titlebtn 用优先级更高的选择器把 RenderTransform 固定为恒等变换,
并清空 Transitions 里的 TransformOperationsTransition,彻底避开
hover 时 RenderTransform 类型/过渡器不匹配导致的渲染异常。
-->
<Style Selector="Button.titlebtn">
<Setter Property="Width" Value="38" />
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#A9B8D4" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="FontSize" Value="13" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="CornerRadius" Value="7" />
<Setter Property="Margin" Value="2,0" />
<Setter Property="RenderTransform" Value="scale(1)" />
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.12" />
<BrushTransition Property="Background" Duration="0:0:0.12" />
<BrushTransition Property="Foreground" Duration="0:0:0.12" />
</Transitions>
</Setter>
</Style>
<Style Selector="Button.titlebtn:pointerover">
<Setter Property="Background" Value="#223252" />
<Setter Property="Foreground" Value="#FFFFFF" />
<Setter Property="RenderTransform" Value="scale(1)" />
</Style>
<Style Selector="Button.titlebtn:pressed">
<Setter Property="RenderTransform" Value="scale(1)" />
</Style>
<Style Selector="Button.titlebtn.close:pointerover">
<Setter Property="Background" Value="#D64545" />
@@ -5,16 +5,18 @@
Title="{loc:Loc app.name}"
Width="1220" Height="800"
MinWidth="1040" MinHeight="700"
Background="#0A1120"
TransparencyLevelHint="None"
Background="Transparent"
TransparencyLevelHint="Transparent"
SystemDecorations="None"
WindowStartupLocation="CenterScreen">
<!-- 禁用系统标题栏,改用自建标题栏;外层圆角容器让整个窗口四角变圆。
用深色不透明底,避免透明/亚克力在无边框窗口下露出系统白边。 -->
<!-- 禁用系统标题栏,改用自建标题栏。
窗口本身透明(四角露出桌面 => 圆角可见),内容 Border 自己不透明并
用 CornerRadius + ClipToBounds 裁出圆角;AcrylicBlur 会引入系统白色,
所以这里用纯 Transparent 避免白边。 -->
<Border CornerRadius="16" ClipToBounds="True"
Background="{DynamicResource AppBg}"
BorderBrush="#0A1120" BorderThickness="1"
BorderBrush="#1B2740" BorderThickness="1"
BoxShadow="0 18 50 0 #400A1226">
<Grid RowDefinitions="44,*">
<!-- 自建标题栏 -->