| 97 | } |
| 98 | |
| 99 | function cellStyle( |
| 100 | cellId: string, |
| 101 | unlocked: Set<string>, |
| 102 | mine: Set<string>, |
| 103 | currentCellId?: string | null |
| 104 | ) { |
| 105 | const currentCell = currentCellId === cellId; |
| 106 | if (mine.has(cellId)) { |
| 107 | return { |
| 108 | fillColor: "#f59e0b", |
| 109 | fillOpacity: currentCell ? 0.56 : 0.44, |
| 110 | strokeColor: "#2563eb", |
| 111 | strokeOpacity: currentCell ? 0.78 : 0.14, |
| 112 | strokeWeight: currentCell ? 2 : 0.6, |
| 113 | zIndex: currentCell ? 50 : 32, |
| 114 | }; |
| 115 | } |
| 116 | if (unlocked.has(cellId)) { |
| 117 | return { |
| 118 | fillColor: "#f59e0b", |
| 119 | fillOpacity: currentCell ? 0.54 : 0.4, |
| 120 | strokeColor: "#2563eb", |
| 121 | strokeOpacity: currentCell ? 0.78 : 0.12, |
| 122 | strokeWeight: currentCell ? 2 : 0.5, |
| 123 | zIndex: currentCell ? 50 : 28, |
| 124 | }; |
| 125 | } |
| 126 | return { |
| 127 | fillColor: "#173f36", |
| 128 | fillOpacity: 0.22, |
| 129 | strokeColor: currentCell ? "#2563eb" : "#173f36", |
| 130 | strokeOpacity: currentCell ? 0.72 : 0, |
| 131 | strokeWeight: currentCell ? 2 : 0, |
| 132 | zIndex: currentCell ? 50 : 20, |
| 133 | }; |
| 134 | } |
| 135 | |
| 136 | function normalizeRotation(value = 0) { |
| 137 | return ((value % 360) + 360) % 360; |