improve:白板翻页性能

This commit is contained in:
2026-02-22 13:02:38 +08:00
parent 6d5c4b4e08
commit dd9cb1825e
2 changed files with 67 additions and 16 deletions
+1 -14
View File
@@ -245,38 +245,25 @@ namespace Ink_Canvas
{
targetCanvas.Children.Add(item.InsertedElement);
// 重新绑定事件处理器(仅对主画布)
if (targetCanvas == inkCanvas)
if (targetCanvas != inkCanvas)
{
if (item.InsertedElement is Image img)
{
// 检查图片是否有位置信息,如果没有则应用居中
double left = InkCanvas.GetLeft(img);
double top = InkCanvas.GetTop(img);
if (double.IsNaN(left) || double.IsNaN(top))
{
// 图片没有位置信息,应用居中
CenterAndScaleElement(img);
}
// 重新绑定事件处理器
BindElementEvents(img);
}
else if (item.InsertedElement is MediaElement media)
{
// 检查媒体元素是否有位置信息,如果没有则应用居中
double left = InkCanvas.GetLeft(media);
double top = InkCanvas.GetTop(media);
if (double.IsNaN(left) || double.IsNaN(top))
{
// 媒体元素没有位置信息,应用居中
CenterAndScaleElement(media);
}
// 重新绑定事件处理器
BindElementEvents(media);
}
}
}