@chao-component/bag-animation-ui 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -845,7 +845,12 @@ function BagAnimation({
845
845
  }
846
846
  }, [isAnimating]);
847
847
  (0, import_react.useEffect)(() => {
848
- if (!isAnimating || !canvasRef.current) return;
848
+ if (!isAnimating || !canvasRef.current || !hasChances) {
849
+ if (!hasChances && isAnimating) {
850
+ setIsAnimating(false);
851
+ }
852
+ return;
853
+ }
849
854
  const canvas = canvasRef.current;
850
855
  const ctx = canvas.getContext("2d");
851
856
  if (!ctx) return;
@@ -940,7 +945,7 @@ function BagAnimation({
940
945
  animationRefs.current[frame].stop();
941
946
  }
942
947
  };
943
- }, [frame, isAnimating, setIsAnimating, doneFunction]);
948
+ }, [frame, isAnimating, doneFunction]);
944
949
  (0, import_react.useEffect)(() => {
945
950
  if (isPausedAtThird && thirdFrameCtxRef.current && thirdFrameApngRef.current && thirdFramePlayerRef.current && canvasRef.current && thirdFrameOriginalSizeRef.current) {
946
951
  const apng = thirdFrameApngRef.current;
@@ -1051,7 +1056,7 @@ function BagAnimation({
1051
1056
  }
1052
1057
  )
1053
1058
  ] }) }),
1054
- isAnimating && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1059
+ isAnimating && hasChances && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1055
1060
  showMask && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1056
1061
  "div",
1057
1062
  {
package/dist/index.mjs CHANGED
@@ -829,7 +829,12 @@ function BagAnimation({
829
829
  }
830
830
  }, [isAnimating]);
831
831
  useEffect(() => {
832
- if (!isAnimating || !canvasRef.current) return;
832
+ if (!isAnimating || !canvasRef.current || !hasChances) {
833
+ if (!hasChances && isAnimating) {
834
+ setIsAnimating(false);
835
+ }
836
+ return;
837
+ }
833
838
  const canvas = canvasRef.current;
834
839
  const ctx = canvas.getContext("2d");
835
840
  if (!ctx) return;
@@ -924,7 +929,7 @@ function BagAnimation({
924
929
  animationRefs.current[frame].stop();
925
930
  }
926
931
  };
927
- }, [frame, isAnimating, setIsAnimating, doneFunction]);
932
+ }, [frame, isAnimating, doneFunction]);
928
933
  useEffect(() => {
929
934
  if (isPausedAtThird && thirdFrameCtxRef.current && thirdFrameApngRef.current && thirdFramePlayerRef.current && canvasRef.current && thirdFrameOriginalSizeRef.current) {
930
935
  const apng = thirdFrameApngRef.current;
@@ -1035,7 +1040,7 @@ function BagAnimation({
1035
1040
  }
1036
1041
  )
1037
1042
  ] }) }),
1038
- isAnimating && /* @__PURE__ */ jsxs(Fragment, { children: [
1043
+ isAnimating && hasChances && /* @__PURE__ */ jsxs(Fragment, { children: [
1039
1044
  showMask && /* @__PURE__ */ jsx(
1040
1045
  "div",
1041
1046
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chao-component/bag-animation-ui",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",