@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/index.mjs CHANGED
@@ -31123,9 +31123,30 @@ function DiceRoller({
31123
31123
  }, capturedStep * stepMs);
31124
31124
  timersRef.current.push(timer);
31125
31125
  }
31126
+ let dealtAll = null;
31127
+ const writeDealtValues = () => {
31128
+ if (!dealtAll) return;
31129
+ for (let i = 0; i < clampedCount; i++) {
31130
+ const texts = faceTextRefs.current[i];
31131
+ const dealt = dealtAll[i];
31132
+ if (!texts || !dealt) continue;
31133
+ for (let fi = 0; fi < dealt.length; fi++) {
31134
+ const el = texts[fi];
31135
+ if (el) el.textContent = formatDieValue(dealt[fi], sides);
31136
+ }
31137
+ }
31138
+ };
31126
31139
  if (sides !== 6) {
31127
- const flickerTicks = 8;
31128
- const flickerStep = Math.max(60, Math.floor(TUMBLE_MS / flickerTicks));
31140
+ const geo = buildPolyhedron(sides);
31141
+ dealtAll = vals.map(
31142
+ (v) => dealFaceValues(geo, sides, v)
31143
+ );
31144
+ const finalAt = Math.floor(TUMBLE_MS * 0.72);
31145
+ const flickerTicks = 6;
31146
+ const flickerStep = Math.max(
31147
+ 50,
31148
+ Math.floor((finalAt - 60) / flickerTicks)
31149
+ );
31129
31150
  for (let f = 1; f <= flickerTicks; f++) {
31130
31151
  const t = setTimeout(() => {
31131
31152
  for (let i = 0; i < clampedCount; i++) {
@@ -31142,6 +31163,8 @@ function DiceRoller({
31142
31163
  }, f * flickerStep);
31143
31164
  timersRef.current.push(t);
31144
31165
  }
31166
+ const finalTimer = setTimeout(writeDealtValues, finalAt);
31167
+ timersRef.current.push(finalTimer);
31145
31168
  }
31146
31169
  requestAnimationFrame(() => {
31147
31170
  requestAnimationFrame(() => {
@@ -31163,22 +31186,7 @@ function DiceRoller({
31163
31186
  });
31164
31187
  });
31165
31188
  const settleTimer = setTimeout(() => {
31166
- if (sides !== 6) {
31167
- const geo = buildPolyhedron(sides);
31168
- for (let i = 0; i < clampedCount; i++) {
31169
- const texts = faceTextRefs.current[i];
31170
- if (!texts) continue;
31171
- const dealt = dealFaceValues(
31172
- geo,
31173
- sides,
31174
- vals[i]
31175
- );
31176
- for (let fi = 0; fi < dealt.length; fi++) {
31177
- const el = texts[fi];
31178
- if (el) el.textContent = formatDieValue(dealt[fi], sides);
31179
- }
31180
- }
31181
- }
31189
+ writeDealtValues();
31182
31190
  setResults(vals);
31183
31191
  setRolling(false);
31184
31192
  rollingRef.current = false;