@jjlmoya/utils-tabletop 1.8.0 → 1.10.0
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/package.json
CHANGED
|
@@ -106,7 +106,9 @@ function animateSpin(targetIndex: number): Promise<void> {
|
|
|
106
106
|
const targetAngle = startAngleSeg + (endAngleSeg - startAngleSeg) / 2;
|
|
107
107
|
|
|
108
108
|
const fullSpins = 4 + Math.floor(Math.random() * 3);
|
|
109
|
-
const
|
|
109
|
+
const currentNormalize = currentAngle % 360;
|
|
110
|
+
const angleDiff = (360 - targetAngle - currentNormalize) % 360;
|
|
111
|
+
const totalRotation = fullSpins * 360 + (angleDiff >= 0 ? angleDiff : angleDiff + 360);
|
|
110
112
|
const duration = 2500 + fullSpins * 300;
|
|
111
113
|
|
|
112
114
|
const state: SpinState = {
|
|
@@ -48,7 +48,7 @@ function drawSegments(c: CanvasCtx, segments: WheelSegment[], currentAngle: numb
|
|
|
48
48
|
const seg = segments[i];
|
|
49
49
|
const weight = seg.weight || 1;
|
|
50
50
|
const sliceAngle = (weight / totalWeight) * 2 * Math.PI;
|
|
51
|
-
const startAngle = accumulatedAngle + currentAngle - Math.PI / 2;
|
|
51
|
+
const startAngle = accumulatedAngle + (currentAngle * Math.PI) / 180 - Math.PI / 2;
|
|
52
52
|
const endAngle = startAngle + sliceAngle;
|
|
53
53
|
|
|
54
54
|
ctx.beginPath();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as interactModule from 'interactjs';
|
|
2
|
+
const interact = (interactModule.default || interactModule) as unknown as typeof interactModule.default;
|
|
2
3
|
import { state } from './dom';
|
|
3
4
|
import { getHighlightPath } from './logic';
|
|
4
5
|
import { drawConnections } from './renderer';
|