Hotfix: Use local mod function instead of external dependency to fix rendering issue
All checks were successful
Deploy to Production / deploy (push) Successful in 5s
All checks were successful
Deploy to Production / deploy (push) Successful in 5s
This commit is contained in:
@@ -5,10 +5,18 @@ import { useCube } from '../composables/useCube'
|
||||
const { cubeState, initCube, rotateLayer, COLOR_MAP } = useCube()
|
||||
|
||||
const getFaceColors = (faceName) => {
|
||||
if (!cubeState.value || !cubeState.value[faceName]) return Array(9).fill('gray');
|
||||
if (!cubeState.value || !cubeState.value[faceName]) {
|
||||
// Return placeholder colors if state is not ready
|
||||
return Array(9).fill('#333');
|
||||
}
|
||||
// cubeState.value[faceName] is a 3x3 matrix.
|
||||
// We need to flatten it.
|
||||
return cubeState.value[faceName].flat().map(c => COLOR_MAP[c]);
|
||||
try {
|
||||
return cubeState.value[faceName].flat().map(c => COLOR_MAP[c] || 'gray');
|
||||
} catch (e) {
|
||||
console.error('Error mapping face colors', e);
|
||||
return Array(9).fill('red'); // Error state
|
||||
}
|
||||
};
|
||||
|
||||
// ...ref(25)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mod } from '@gkucmierz/utils';
|
||||
const mod = (n, m) => ((n % m) + m) % m;
|
||||
|
||||
// Enum for colors/faces
|
||||
export const COLORS = {
|
||||
|
||||
Reference in New Issue
Block a user