Skip to content

Commit

Permalink
[fix] updateBorderStrokeSelectionControlLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangSakura committed Jul 31, 2024
1 parent ed50163 commit 238498d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Ink Canvas/Helpers/DelAutoSavedFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal class DelAutoSavedFiles
{
public static void DeleteFilesOlder(string directoryPath, int daysThreshold)
{
string[] extensionsToDel = { ".icstk", ".png" };
string[] extensionsToDel = { ".icstk", ".icart", ".png" };
if (Directory.Exists(directoryPath))
{
// 获取目录中的所有子目录
Expand Down
2 changes: 1 addition & 1 deletion Ink Canvas/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3699,7 +3699,7 @@
Foreground="{DynamicResource SettingsPageForeground}"
Text="定期自动删除超过保存时间的墨迹、截图文件" />
</ikw:SimpleStackPanel>
<TextBlock FontWeight="Bold" Foreground="{DynamicResource RedBrush}" Text="请注意将会删除自动保存目录下所有后缀名为 .icstk 和 .png 的文件!" TextWrapping="Wrap" />
<TextBlock FontWeight="Bold" Foreground="{DynamicResource RedBrush}" Text="请注意自动删除功能将会删除自动保存目录下所有后缀名为 .icstk / .icart 和 .png 的文件!" TextWrapping="Wrap" />
<ikw:SimpleStackPanel Margin="0,5,0,0" HorizontalAlignment="Left" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" FontSize="15" Foreground="{DynamicResource SettingsPageForeground}" Text="保存时间设置(Days): " />
<ComboBox Name="ComboBoxAutoDelSavedFilesDaysThreshold" SelectedIndex="4" SelectionChanged="ComboBoxAutoDelSavedFilesDaysThreshold_SelectionChanged">
Expand Down
22 changes: 18 additions & 4 deletions Ink Canvas/MainWindow_cs/MW_PPT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,16 +463,30 @@ private async void PptApplication_SlideShowEnd(Presentation Pres)
{
try
{
string baseFilePath = folderPath + @"\" + i.ToString("0000");
string icartFilePath = baseFilePath + ".icart";
string icstkFilePath = baseFilePath + ".icstk";

if (memoryStreams[i].Length > 8)
{
byte[] srcBuf = new Byte[memoryStreams[i].Length];
byte[] srcBuf = new byte[memoryStreams[i].Length];
int byteLength = memoryStreams[i].Read(srcBuf, 0, srcBuf.Length);
File.WriteAllBytes(folderPath + @"\" + i.ToString("0000") + ".icstk", srcBuf);
LogHelper.WriteLogToFile(string.Format("Saved strokes for Slide {0}, size={1}, byteLength={2}", i.ToString(), memoryStreams[i].Length, byteLength));

if (File.Exists(icartFilePath))
{
File.WriteAllBytes(icartFilePath, srcBuf);
LogHelper.WriteLogToFile(string.Format("Saved strokes for Slide {0} as .icart, size={1}, byteLength={2}", i.ToString(), memoryStreams[i].Length, byteLength));
}
else
{
File.WriteAllBytes(icstkFilePath, srcBuf);
LogHelper.WriteLogToFile(string.Format("Saved strokes for Slide {0} as .icstk, size={1}, byteLength={2}", i.ToString(), memoryStreams[i].Length, byteLength));
}
}
else
{
File.Delete(folderPath + @"\" + i.ToString("0000") + ".icstk");
File.Delete(icartFilePath);
File.Delete(icstkFilePath);
}
}
catch (Exception ex)
Expand Down
11 changes: 9 additions & 2 deletions Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ private void inkCanvas_SelectionChanged(object sender, EventArgs e)

private void updateBorderStrokeSelectionControlLocation()
{
var selectionBounds = inkCanvas.GetSelectionBounds();
Rect selectionBounds = inkCanvas.GetSelectionBounds();
double borderLeft = (selectionBounds.Left + selectionBounds.Right - BorderStrokeSelectionControlWidth) / 2;
double borderTop = selectionBounds.Bottom + 15;

Expand Down Expand Up @@ -482,7 +482,14 @@ private void updateBorderStrokeSelectionControlLocation()
{
borderTop = Math.Min(Height - BorderStrokeSelectionControlHeight - 60, borderTop);
}
BorderStrokeSelectionControl.Margin = new Thickness(borderLeft, borderTop, 0, 0);
if (!double.IsNaN(borderLeft) && !double.IsNaN(borderTop))
{
BorderStrokeSelectionControl.Margin = new Thickness(borderLeft, borderTop, 0, 0);
}
else
{
BorderStrokeSelectionControl.Margin = new Thickness(0, 0, 0, 0);
}
}

private void GridInkCanvasSelectionCover_ManipulationStarting(object sender, ManipulationStartingEventArgs e)
Expand Down

0 comments on commit 238498d

Please sign in to comment.