@digilogiclabs/saas-factory-ui 2.9.1 → 2.9.2

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.
@@ -31011,9 +31011,30 @@ function DiceRoller({
31011
31011
  }, capturedStep * stepMs);
31012
31012
  timersRef.current.push(timer);
31013
31013
  }
31014
+ let dealtAll = null;
31015
+ const writeDealtValues = () => {
31016
+ if (!dealtAll) return;
31017
+ for (let i = 0; i < clampedCount; i++) {
31018
+ const texts = faceTextRefs.current[i];
31019
+ const dealt = dealtAll[i];
31020
+ if (!texts || !dealt) continue;
31021
+ for (let fi = 0; fi < dealt.length; fi++) {
31022
+ const el = texts[fi];
31023
+ if (el) el.textContent = formatDieValue(dealt[fi], sides);
31024
+ }
31025
+ }
31026
+ };
31014
31027
  if (sides !== 6) {
31015
- const flickerTicks = 8;
31016
- const flickerStep = Math.max(60, Math.floor(TUMBLE_MS / flickerTicks));
31028
+ const geo = buildPolyhedron(sides);
31029
+ dealtAll = vals.map(
31030
+ (v) => dealFaceValues(geo, sides, v)
31031
+ );
31032
+ const finalAt = Math.floor(TUMBLE_MS * 0.72);
31033
+ const flickerTicks = 6;
31034
+ const flickerStep = Math.max(
31035
+ 50,
31036
+ Math.floor((finalAt - 60) / flickerTicks)
31037
+ );
31017
31038
  for (let f = 1; f <= flickerTicks; f++) {
31018
31039
  const t = setTimeout(() => {
31019
31040
  for (let i = 0; i < clampedCount; i++) {
@@ -31030,6 +31051,8 @@ function DiceRoller({
31030
31051
  }, f * flickerStep);
31031
31052
  timersRef.current.push(t);
31032
31053
  }
31054
+ const finalTimer = setTimeout(writeDealtValues, finalAt);
31055
+ timersRef.current.push(finalTimer);
31033
31056
  }
31034
31057
  requestAnimationFrame(() => {
31035
31058
  requestAnimationFrame(() => {
@@ -31051,22 +31074,7 @@ function DiceRoller({
31051
31074
  });
31052
31075
  });
31053
31076
  const settleTimer = setTimeout(() => {
31054
- if (sides !== 6) {
31055
- const geo = buildPolyhedron(sides);
31056
- for (let i = 0; i < clampedCount; i++) {
31057
- const texts = faceTextRefs.current[i];
31058
- if (!texts) continue;
31059
- const dealt = dealFaceValues(
31060
- geo,
31061
- sides,
31062
- vals[i]
31063
- );
31064
- for (let fi = 0; fi < dealt.length; fi++) {
31065
- const el = texts[fi];
31066
- if (el) el.textContent = formatDieValue(dealt[fi], sides);
31067
- }
31068
- }
31069
- }
31077
+ writeDealtValues();
31070
31078
  setResults(vals);
31071
31079
  setRolling(false);
31072
31080
  rollingRef.current = false;