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