feat:碎片完善

This commit is contained in:
zhongyidian committed 2026-01-11 18:18:20 +08:00
1 parent ec7e8e2bd2
commit 046501705f
74 files changed
+1602 -172

No files matched your search

@@ -126,8 +126,10 @@ class FlyToAnimationManagerClass {
// 使用 cloneNode 深度克隆,包括所有子元素
const clonedElement = fromRef.current!.cloneNode(true) as HTMLElement;
// 复制计算后的样式到克隆元素
// 复制计算后的样式到克隆元素,确保尺寸正确
const computedStyle = window.getComputedStyle(fromRef.current!);
// 复制所有样式属性
const allStyles = Array.from(computedStyle);
allStyles.forEach((prop) => {
const value = computedStyle.getPropertyValue(prop);
@@ -135,6 +137,15 @@ class FlyToAnimationManagerClass {
clonedElement.style.setProperty(prop, value);
}
});
// 确保克隆元素的尺寸与原始元素一致
clonedElement.style.width = `${fromRect.width}px`;
clonedElement.style.height = `${fromRect.height}px`;
clonedElement.style.position = "absolute";
clonedElement.style.left = "0";
clonedElement.style.top = "0";
clonedElement.style.margin = "0";
clonedElement.style.padding = "0";
// 获取克隆后的 HTML(只获取内部内容,不包含外层元素)
const elementHtml = clonedElement.innerHTML;