♻️: 完善layer.notify()入场动画,不再依赖anim属性

This commit is contained in:
0o张不歪o0
2022-06-30 21:46:04 +08:00
parent f780ba6625
commit 2664e941fe
4 changed files with 20 additions and 10 deletions

View File

@@ -344,9 +344,7 @@ export function removeNotifiyFromQueen(layerId: string | undefined) {
// 间隙
let transOffsetTop = 15;
// @ts-ignore 删除项的高度
let offsetHeight =
document.getElementById(layerId)?.firstElementChild?.firstElementChild
?.offsetHeight;
let offsetHeight = document.getElementById(layerId)?.firstElementChild?.firstElementChild?.offsetHeight;
// @ts-ignore
window.NotifiyQueen = window.NotifiyQueen || [];
// @ts-ignore
@@ -366,17 +364,25 @@ export function removeNotifiyFromQueen(layerId: string | undefined) {
?.firstElementChild;
if (offsetType === "rt" || offsetType === "lt") {
// @ts-ignore
dom.style["top"] =
parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
} else {
// @ts-ignore
let bottom =
parseFloat(dom.style["top"].split(" - ")[1]) -
transOffsetTop -
offsetHeight;
let bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight;
// @ts-ignore
dom.style["top"] = "calc(100vh - " + bottom + "px)";
}
});
notifiyQueen.splice(index, 1); //删除
}
// Notify动画类
export function getNotifyAnimationClass(offset: any) {
const prefix = "layer-drawer-anim layer-anim";
let suffix = "";
if (offset === "lt" || offset === "lb") {
suffix = "lr";
} else {
suffix = "rl";
}
return `${prefix}-${suffix}`;
}