fix timeout anim (hmm #215)

This commit is contained in:
end-4
2024-02-03 07:30:44 +07:00
parent fb86c7316c
commit 9cf27e6d2c
2 changed files with 26 additions and 26 deletions
+13 -13
View File
@@ -83,22 +83,22 @@ export const AnimatedCircProg = ({
// Init animation // Init animation
if (initFrom != initTo) { if (initFrom != initTo) {
// area.css = `font-size: ${initFrom}px; transition: ${initAnimTime}ms linear;`; area.css = `font-size: ${initFrom}px; transition: ${initAnimTime}ms linear;`;
Utils.timeout(20, () => { Utils.timeout(20, () => {
area.css = `font-size: ${initTo}px;`; area.css = `font-size: ${initTo}px;`;
}, area) }, area)
// const transitionDistance = initTo - initFrom; const transitionDistance = initTo - initFrom;
// const oneStep = initAnimTime / initAnimPoints; const oneStep = initAnimTime / initAnimPoints;
// area.css = ` area.css = `
// font-size: ${initFrom}px; font-size: ${initFrom}px;
// transition: ${oneStep}ms linear; transition: ${oneStep}ms linear;
// `; `;
// for (let i = 0; i < initAnimPoints; i++) { for (let i = 0; i < initAnimPoints; i++) {
// Utils.timeout(Math.max(10, i * oneStep), () => { Utils.timeout(Math.max(10, i * oneStep), () => {
// if(!area) return; if(!area) return;
// area.css = `${initFrom != initTo ? 'font-size: ' + (initFrom + (transitionDistance / initAnimPoints * (i + 1))) + 'px;' : ''}`; area.css = `${initFrom != initTo ? 'font-size: ' + (initFrom + (transitionDistance / initAnimPoints * (i + 1))) + 'px;' : ''}`;
// }); });
// } }
} }
else area.css = 'font-size: 0px;'; else area.css = 'font-size: 0px;';
extraSetup(area); extraSetup(area);
+13 -13
View File
@@ -77,7 +77,7 @@ export default ({
isPopup = false, isPopup = false,
props = {}, props = {},
} = {}) => { } = {}) => {
const popupTimeout = notifObject.urgency == 'critical' ? 8000 : 3000; const popupTimeout = notifObject.timeout || (notifObject.urgency == 'critical' ? 8000 : 3000);
const command = (isPopup ? const command = (isPopup ?
() => notifObject.dismiss() : () => notifObject.dismiss() :
() => notifObject.close() () => notifObject.close()
@@ -435,17 +435,17 @@ export default ({
}) })
widget.add(notificationBox); widget.add(notificationBox);
wholeThing.child.children = [widget]; wholeThing.child.children = [widget];
if (isPopup) Utils.timeout(popupTimeout, () => { // if (isPopup) Utils.timeout(popupTimeout, () => {
if (wholeThing) { // if (wholeThing) {
wholeThing.revealChild = false; // wholeThing.revealChild = false;
Utils.timeout(200, () => { // Utils.timeout(200, () => {
if (wholeThing) { // if (wholeThing) {
wholeThing.destroy(); // wholeThing.destroy();
wholeThing = null; // wholeThing = null;
} // }
command(); // command();
}, wholeThing); // }, wholeThing);
} // }
}) // })
return wholeThing; return wholeThing;
} }