improve:PPT模块及浮动栏
This commit is contained in:
@@ -259,7 +259,11 @@ namespace Ink_Canvas
|
||||
PenIcon_Click(null, null);
|
||||
}
|
||||
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible)
|
||||
// 只有在PPT放映模式下且页数有效时才显示翻页按钮
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible &&
|
||||
BtnPPTSlideShowEnd.Visibility == Visibility.Visible &&
|
||||
PPTManager?.IsInSlideShow == true &&
|
||||
PPTManager?.SlidesCount > 0)
|
||||
{
|
||||
var dops = Settings.PowerPointSettings.PPTButtonsDisplayOption.ToString();
|
||||
var dopsc = dops.ToCharArray();
|
||||
@@ -267,11 +271,34 @@ namespace Ink_Canvas
|
||||
if (dopsc[1] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(RightBottomPanelForPPTNavigation);
|
||||
if (dopsc[2] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(LeftSidePanelForPPTNavigation);
|
||||
if (dopsc[3] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(RightSidePanelForPPTNavigation);
|
||||
LogHelper.WriteLogToFile($"从收纳模式恢复时显示PPT翻页按钮 - 放映状态: {PPTManager?.IsInSlideShow}, 页数: {PPTManager?.SlidesCount}", LogHelper.LogType.Trace);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果条件不满足,确保隐藏翻页按钮
|
||||
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
LogHelper.WriteLogToFile($"从收纳模式恢复时隐藏PPT翻页按钮 - 放映状态: {PPTManager?.IsInSlideShow}, 页数: {PPTManager?.SlidesCount}", LogHelper.LogType.Trace);
|
||||
}
|
||||
|
||||
// 新增:只在屏幕模式下显示浮动栏
|
||||
if (currentMode == 0)
|
||||
{
|
||||
// 强制更新布局以确保ActualWidth正确
|
||||
ViewboxFloatingBar.UpdateLayout();
|
||||
|
||||
// 等待一小段时间让布局完全更新
|
||||
await Task.Delay(50);
|
||||
|
||||
// 再次强制更新布局
|
||||
ViewboxFloatingBar.UpdateLayout();
|
||||
|
||||
// 强制重新测量和排列
|
||||
ViewboxFloatingBar.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
ViewboxFloatingBar.Arrange(new Rect(ViewboxFloatingBar.DesiredSize));
|
||||
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
|
||||
ViewboxFloatingBarMarginAnimation(60);
|
||||
else
|
||||
|
||||
@@ -652,10 +652,11 @@ namespace Ink_Canvas
|
||||
//关闭黑板
|
||||
HideSubPanelsImmediately();
|
||||
|
||||
// 只有在PPT放映模式下才显示翻页按钮
|
||||
// 只有在PPT放映模式下且页数有效时才显示翻页按钮
|
||||
if (StackPanelPPTControls.Visibility == Visibility.Visible &&
|
||||
BtnPPTSlideShowEnd.Visibility == Visibility.Visible &&
|
||||
PPTManager?.IsInSlideShow == true)
|
||||
PPTManager?.IsInSlideShow == true &&
|
||||
PPTManager?.SlidesCount > 0)
|
||||
{
|
||||
var dops = Settings.PowerPointSettings.PPTButtonsDisplayOption.ToString();
|
||||
var dopsc = dops.ToCharArray();
|
||||
@@ -663,24 +664,38 @@ namespace Ink_Canvas
|
||||
if (dopsc[1] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(RightBottomPanelForPPTNavigation);
|
||||
if (dopsc[2] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(LeftSidePanelForPPTNavigation);
|
||||
if (dopsc[3] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(RightSidePanelForPPTNavigation);
|
||||
LogHelper.WriteLogToFile($"显示PPT翻页按钮 - 放映状态: {PPTManager?.IsInSlideShow}, 页数: {PPTManager?.SlidesCount}", LogHelper.LogType.Trace);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果不在放映模式,隐藏所有翻页按钮
|
||||
// 如果不在放映模式或页数无效,隐藏所有翻页按钮
|
||||
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
LogHelper.WriteLogToFile($"隐藏PPT翻页按钮 - 放映状态: {PPTManager?.IsInSlideShow}, 页数: {PPTManager?.SlidesCount}", LogHelper.LogType.Trace);
|
||||
}
|
||||
// 修复PPT放映时点击白板按钮后翻页按钮不显示的问题
|
||||
// 只有在确实在放映模式下才强制显示翻页按钮
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible && PPTManager?.IsInSlideShow == true)
|
||||
// 只有在确实在放映模式下且页数有效时才强制显示翻页按钮
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible &&
|
||||
PPTManager?.IsInSlideShow == true &&
|
||||
PPTManager?.SlidesCount > 0)
|
||||
{
|
||||
// 强制显示PPT翻页按钮
|
||||
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Visible;
|
||||
RightBottomPanelForPPTNavigation.Visibility = Visibility.Visible;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Visible;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Visible;
|
||||
LogHelper.WriteLogToFile($"强制显示PPT翻页按钮 - 放映状态: {PPTManager?.IsInSlideShow}, 页数: {PPTManager?.SlidesCount}", LogHelper.LogType.Trace);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果条件不满足,确保隐藏翻页按钮
|
||||
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||
LogHelper.WriteLogToFile($"隐藏PPT翻页按钮 - 放映状态: {PPTManager?.IsInSlideShow}, 页数: {PPTManager?.SlidesCount}", LogHelper.LogType.Trace);
|
||||
}
|
||||
|
||||
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
|
||||
@@ -1383,9 +1398,33 @@ namespace Ink_Canvas
|
||||
var toolbarHeight = ForegroundWindowInfo.GetTaskbarHeight(screen, dpiScaleY);
|
||||
|
||||
// 计算浮动栏位置,考虑快捷调色盘的显示状态
|
||||
// 确保获取到正确的浮动栏宽度,如果ActualWidth为0则使用DesiredSize
|
||||
double baseWidth = ViewboxFloatingBar.ActualWidth > 0 ? ViewboxFloatingBar.ActualWidth : ViewboxFloatingBar.DesiredSize.Width;
|
||||
// 使用更可靠的方法获取浮动栏宽度
|
||||
double baseWidth = ViewboxFloatingBar.ActualWidth;
|
||||
|
||||
// 如果ActualWidth为0,尝试使用DesiredSize
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
baseWidth = ViewboxFloatingBar.DesiredSize.Width;
|
||||
}
|
||||
|
||||
// 如果仍然为0,使用RenderSize
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
baseWidth = ViewboxFloatingBar.RenderSize.Width;
|
||||
}
|
||||
|
||||
// 如果所有方法都失败,使用一个基于内容的估算值
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
// 根据浮动栏内容估算宽度
|
||||
baseWidth = 200; // 最小宽度
|
||||
LogHelper.WriteLogToFile($"浮动栏宽度无法获取,使用估算值: {baseWidth}");
|
||||
}
|
||||
|
||||
double floatingBarWidth = baseWidth * ViewboxFloatingBarScaleTransform.ScaleX;
|
||||
|
||||
// 添加调试日志
|
||||
LogHelper.WriteLogToFile($"浮动栏居中计算 - ActualWidth: {ViewboxFloatingBar.ActualWidth}, DesiredSize.Width: {ViewboxFloatingBar.DesiredSize.Width}, RenderSize.Width: {ViewboxFloatingBar.RenderSize.Width}, baseWidth: {baseWidth}, ScaleX: {ViewboxFloatingBarScaleTransform.ScaleX}, floatingBarWidth: {floatingBarWidth}, screenWidth: {screenWidth}");
|
||||
|
||||
// 如果快捷调色盘显示,确保有足够空间
|
||||
if ((QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible) ||
|
||||
@@ -1506,9 +1545,33 @@ namespace Ink_Canvas
|
||||
var toolbarHeight = ForegroundWindowInfo.GetTaskbarHeight(screen, dpiScaleY);
|
||||
|
||||
// 计算浮动栏位置,考虑快捷调色盘的显示状态
|
||||
// 确保获取到正确的浮动栏宽度,如果ActualWidth为0则使用DesiredSize
|
||||
double baseWidth = ViewboxFloatingBar.ActualWidth > 0 ? ViewboxFloatingBar.ActualWidth : ViewboxFloatingBar.DesiredSize.Width;
|
||||
// 使用更可靠的方法获取浮动栏宽度
|
||||
double baseWidth = ViewboxFloatingBar.ActualWidth;
|
||||
|
||||
// 如果ActualWidth为0,尝试使用DesiredSize
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
baseWidth = ViewboxFloatingBar.DesiredSize.Width;
|
||||
}
|
||||
|
||||
// 如果仍然为0,使用RenderSize
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
baseWidth = ViewboxFloatingBar.RenderSize.Width;
|
||||
}
|
||||
|
||||
// 如果所有方法都失败,使用一个基于内容的估算值
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
// 根据浮动栏内容估算宽度
|
||||
baseWidth = 200; // 最小宽度
|
||||
LogHelper.WriteLogToFile($"浮动栏宽度无法获取,使用估算值: {baseWidth}");
|
||||
}
|
||||
|
||||
double floatingBarWidth = baseWidth * ViewboxFloatingBarScaleTransform.ScaleX;
|
||||
|
||||
// 添加调试日志
|
||||
LogHelper.WriteLogToFile($"浮动栏居中计算 - ActualWidth: {ViewboxFloatingBar.ActualWidth}, DesiredSize.Width: {ViewboxFloatingBar.DesiredSize.Width}, RenderSize.Width: {ViewboxFloatingBar.RenderSize.Width}, baseWidth: {baseWidth}, ScaleX: {ViewboxFloatingBarScaleTransform.ScaleX}, floatingBarWidth: {floatingBarWidth}, screenWidth: {screenWidth}");
|
||||
|
||||
// 如果快捷调色盘显示,确保有足够空间
|
||||
if ((QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible) ||
|
||||
@@ -1590,9 +1653,33 @@ namespace Ink_Canvas
|
||||
var toolbarHeight = ForegroundWindowInfo.GetTaskbarHeight(screen, dpiScaleY);
|
||||
|
||||
// 计算浮动栏位置,考虑快捷调色盘的显示状态
|
||||
// 确保获取到正确的浮动栏宽度,如果ActualWidth为0则使用DesiredSize
|
||||
double baseWidth = ViewboxFloatingBar.ActualWidth > 0 ? ViewboxFloatingBar.ActualWidth : ViewboxFloatingBar.DesiredSize.Width;
|
||||
// 使用更可靠的方法获取浮动栏宽度
|
||||
double baseWidth = ViewboxFloatingBar.ActualWidth;
|
||||
|
||||
// 如果ActualWidth为0,尝试使用DesiredSize
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
baseWidth = ViewboxFloatingBar.DesiredSize.Width;
|
||||
}
|
||||
|
||||
// 如果仍然为0,使用RenderSize
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
baseWidth = ViewboxFloatingBar.RenderSize.Width;
|
||||
}
|
||||
|
||||
// 如果所有方法都失败,使用一个基于内容的估算值
|
||||
if (baseWidth <= 0)
|
||||
{
|
||||
// 根据浮动栏内容估算宽度
|
||||
baseWidth = 200; // 最小宽度
|
||||
LogHelper.WriteLogToFile($"浮动栏宽度无法获取,使用估算值: {baseWidth}");
|
||||
}
|
||||
|
||||
double floatingBarWidth = baseWidth * ViewboxFloatingBarScaleTransform.ScaleX;
|
||||
|
||||
// 添加调试日志
|
||||
LogHelper.WriteLogToFile($"浮动栏居中计算 - ActualWidth: {ViewboxFloatingBar.ActualWidth}, DesiredSize.Width: {ViewboxFloatingBar.DesiredSize.Width}, RenderSize.Width: {ViewboxFloatingBar.RenderSize.Width}, baseWidth: {baseWidth}, ScaleX: {ViewboxFloatingBarScaleTransform.ScaleX}, floatingBarWidth: {floatingBarWidth}, screenWidth: {screenWidth}");
|
||||
|
||||
// 如果快捷调色盘显示,确保有足够空间
|
||||
if ((QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible) ||
|
||||
|
||||
@@ -199,11 +199,21 @@ namespace Ink_Canvas
|
||||
val > 0.5 && val < 1.25 ? val : val <= 0.5 ? 0.5 : val >= 1.25 ? 1.25 : 1;
|
||||
|
||||
// 等待UI更新后再重新计算浮动栏位置,确保居中计算准确
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
Dispatcher.BeginInvoke(new Action(async () =>
|
||||
{
|
||||
// 强制更新布局以确保ActualWidth正确
|
||||
ViewboxFloatingBar.UpdateLayout();
|
||||
|
||||
// 等待一小段时间让布局完全更新
|
||||
await Task.Delay(100);
|
||||
|
||||
// 再次强制更新布局
|
||||
ViewboxFloatingBar.UpdateLayout();
|
||||
|
||||
// 强制重新测量和排列
|
||||
ViewboxFloatingBar.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
ViewboxFloatingBar.Arrange(new Rect(ViewboxFloatingBar.DesiredSize));
|
||||
|
||||
// auto align - 新增:只在屏幕模式下重新计算浮动栏位置
|
||||
if (currentMode == 0)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,14 @@
|
||||
Title="Ink Canvas 画板 - 计时器" Height="700" Width="1100">
|
||||
<Border Background="#F0F3F9" CornerRadius="10" BorderThickness="1" BorderBrush="#0066BF" Margin="60">
|
||||
<Grid>
|
||||
<TextBlock x:Name="TbCurrentTime" MouseDown="BtnMinimal_OnMouseUp" Visibility="Collapsed" FontSize="56" FontWeight="Black" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="TbCurrentTime" MouseDown="BtnMinimal_OnMouseUp" Visibility="Collapsed" FontSize="56" FontWeight="Black" HorizontalAlignment="Center" VerticalAlignment="Center" Text="00:00:00">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock" BasedOn="{x:Null}">
|
||||
<Setter Property="TextWrapping" Value="NoWrap" />
|
||||
<Setter Property="TextTrimming" Value="None" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<Border MouseMove="WindowDragMove" Visibility="{Binding ElementName=TbCurrentTime, Path=Visibility}" Width="64" Height="15" CornerRadius="8" Background="Gray" Margin="0,0,0,5" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
|
||||
<Viewbox x:Name="BigViewController" Margin="20,20,20,20">
|
||||
<Grid Height="180" Width="200">
|
||||
@@ -179,7 +186,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Name="FontIconMinimal" Glyph="" Foreground="Black"/>
|
||||
<TextBlock Name="FontIconMinimal" Text="" Foreground="Black" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnFullscreen" MouseUp="BtnFullscreen_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
@@ -189,7 +196,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Name="FontIconFullscreen" Glyph="" Foreground="Black"/>
|
||||
<TextBlock Name="FontIconFullscreen" Text="" Foreground="Black" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
@@ -199,7 +206,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Glyph="" Foreground="White"/>
|
||||
<TextBlock Text="" Foreground="White" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Name="FontIconFullscreen" Glyph="" Foreground="Black"/>
|
||||
<ui:FontIcon Name="FontIconFullscreen" Glyph="" Foreground="Black" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
@@ -90,7 +90,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Glyph="" Foreground="White"/>
|
||||
<ui:FontIcon Glyph="" Foreground="White" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
Reference in New Issue
Block a user