From 1595cb282aab5399862fac6406b5de550863e3b6 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 03 四月 2023 00:05:09 +0800
Subject: [PATCH] update 调整代码格式

---
 src/utils/scroll-to.ts |   82 ++++++++++++++++++++--------------------
 1 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/src/utils/scroll-to.ts b/src/utils/scroll-to.ts
index bbb4709..c2fa379 100644
--- a/src/utils/scroll-to.ts
+++ b/src/utils/scroll-to.ts
@@ -1,22 +1,22 @@
 const easeInOutQuad = (t: number, b: number, c: number, d: number) => {
-	t /= d / 2;
-	if (t < 1) {
-		return (c / 2) * t * t + b;
-	}
-	t--;
-	return (-c / 2) * (t * (t - 2) - 1) + b;
+  t /= d / 2;
+  if (t < 1) {
+    return (c / 2) * t * t + b;
+  }
+  t--;
+  return (-c / 2) * (t * (t - 2) - 1) + b;
 };
 
 // requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
 const requestAnimFrame = (function () {
-	return (
-		window.requestAnimationFrame ||
-		(window as any).webkitRequestAnimationFrame ||
-		(window as any).mozRequestAnimationFrame ||
-		function (callback) {
-			window.setTimeout(callback, 1000 / 60);
-		}
-	);
+  return (
+    window.requestAnimationFrame ||
+    (window as any).webkitRequestAnimationFrame ||
+    (window as any).mozRequestAnimationFrame ||
+    function (callback) {
+      window.setTimeout(callback, 1000 / 60);
+    }
+  );
 })();
 
 /**
@@ -24,13 +24,13 @@
  * @param {number} amount
  */
 const move = (amount: number) => {
-	document.documentElement.scrollTop = amount;
-	(document.body.parentNode as HTMLElement).scrollTop = amount;
-	document.body.scrollTop = amount;
+  document.documentElement.scrollTop = amount;
+  (document.body.parentNode as HTMLElement).scrollTop = amount;
+  document.body.scrollTop = amount;
 };
 
 const position = () => {
-	return document.documentElement.scrollTop || (document.body.parentNode as HTMLElement).scrollTop || document.body.scrollTop;
+  return document.documentElement.scrollTop || (document.body.parentNode as HTMLElement).scrollTop || document.body.scrollTop;
 };
 
 /**
@@ -39,27 +39,27 @@
  * @param {Function} callback
  */
 export const scrollTo = (to: number, duration: number, callback?: any) => {
-	const start = position();
-	const change = to - start;
-	const increment = 20;
-	let currentTime = 0;
-	duration = typeof duration === 'undefined' ? 500 : duration;
-	const animateScroll = function () {
-		// increment the time
-		currentTime += increment;
-		// find the value with the quadratic in-out easing function
-		const val = easeInOutQuad(currentTime, start, change, duration);
-		// move the document.body
-		move(val);
-		// do the animation unless its over
-		if (currentTime < duration) {
-			requestAnimFrame(animateScroll);
-		} else {
-			if (callback && typeof callback === 'function') {
-				// the animation is done so lets callback
-				callback();
-			}
-		}
-	};
-	animateScroll();
+  const start = position();
+  const change = to - start;
+  const increment = 20;
+  let currentTime = 0;
+  duration = typeof duration === 'undefined' ? 500 : duration;
+  const animateScroll = function () {
+    // increment the time
+    currentTime += increment;
+    // find the value with the quadratic in-out easing function
+    const val = easeInOutQuad(currentTime, start, change, duration);
+    // move the document.body
+    move(val);
+    // do the animation unless its over
+    if (currentTime < duration) {
+      requestAnimFrame(animateScroll);
+    } else {
+      if (callback && typeof callback === 'function') {
+        // the animation is done so lets callback
+        callback();
+      }
+    }
+  };
+  animateScroll();
 };

--
Gitblit v1.9.3