@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.js CHANGED
@@ -31178,9 +31178,30 @@ function DiceRoller({
31178
31178
  }, capturedStep * stepMs);
31179
31179
  timersRef.current.push(timer);
31180
31180
  }
31181
+ let dealtAll = null;
31182
+ const writeDealtValues = () => {
31183
+ if (!dealtAll) return;
31184
+ for (let i = 0; i < clampedCount; i++) {
31185
+ const texts = faceTextRefs.current[i];
31186
+ const dealt = dealtAll[i];
31187
+ if (!texts || !dealt) continue;
31188
+ for (let fi = 0; fi < dealt.length; fi++) {
31189
+ const el = texts[fi];
31190
+ if (el) el.textContent = formatDieValue(dealt[fi], sides);
31191
+ }
31192
+ }
31193
+ };
31181
31194
  if (sides !== 6) {
31182
- const flickerTicks = 8;
31183
- const flickerStep = Math.max(60, Math.floor(TUMBLE_MS / flickerTicks));
31195
+ const geo = buildPolyhedron(sides);
31196
+ dealtAll = vals.map(
31197
+ (v) => dealFaceValues(geo, sides, v)
31198
+ );
31199
+ const finalAt = Math.floor(TUMBLE_MS * 0.72);
31200
+ const flickerTicks = 6;
31201
+ const flickerStep = Math.max(
31202
+ 50,
31203
+ Math.floor((finalAt - 60) / flickerTicks)
31204
+ );
31184
31205
  for (let f = 1; f <= flickerTicks; f++) {
31185
31206
  const t = setTimeout(() => {
31186
31207
  for (let i = 0; i < clampedCount; i++) {
@@ -31197,6 +31218,8 @@ function DiceRoller({
31197
31218
  }, f * flickerStep);
31198
31219
  timersRef.current.push(t);
31199
31220
  }
31221
+ const finalTimer = setTimeout(writeDealtValues, finalAt);
31222
+ timersRef.current.push(finalTimer);
31200
31223
  }
31201
31224
  requestAnimationFrame(() => {
31202
31225
  requestAnimationFrame(() => {
@@ -31218,22 +31241,7 @@ function DiceRoller({
31218
31241
  });
31219
31242
  });
31220
31243
  const settleTimer = setTimeout(() => {
31221
- if (sides !== 6) {
31222
- const geo = buildPolyhedron(sides);
31223
- for (let i = 0; i < clampedCount; i++) {
31224
- const texts = faceTextRefs.current[i];
31225
- if (!texts) continue;
31226
- const dealt = dealFaceValues(
31227
- geo,
31228
- sides,
31229
- vals[i]
31230
- );
31231
- for (let fi = 0; fi < dealt.length; fi++) {
31232
- const el = texts[fi];
31233
- if (el) el.textContent = formatDieValue(dealt[fi], sides);
31234
- }
31235
- }
31236
- }
31244
+ writeDealtValues();
31237
31245
  setResults(vals);
31238
31246
  setRolling(false);
31239
31247
  rollingRef.current = false;