feat: enhance image import and solvability calculation (v1.13.0)
All checks were successful
Deploy to Production / deploy (push) Successful in 18s
All checks were successful
Deploy to Production / deploy (push) Successful in 18s
- Implement non-linear threshold slider (histogram percentile method) - Add real-time solvability calculation with progress indicator - Improve solvability logic with generative lookahead (smash) - Update ImageImportModal UI (alpha preview, grid size 5-80) - Add missing translations and difficulty labels - Optimize web worker pool with queue clearing and progress reporting - Fix mobile camera support and UI layout
This commit is contained in:
@@ -93,6 +93,26 @@ export const usePuzzleStore = defineStore('puzzle', () => {
|
||||
saveState();
|
||||
}
|
||||
|
||||
function initFromImage(grid) {
|
||||
stopTimer();
|
||||
currentLevelId.value = 'custom_image';
|
||||
size.value = grid.length;
|
||||
solution.value = grid;
|
||||
|
||||
resetGrid();
|
||||
isGameWon.value = false;
|
||||
hasUsedGuide.value = false;
|
||||
guideUsageCount.value = 0;
|
||||
|
||||
// Calculate density
|
||||
const totalFilled = grid.flat().filter(c => c === 1).length;
|
||||
currentDensity.value = totalFilled / (size.value * size.value);
|
||||
|
||||
elapsedTime.value = 0;
|
||||
startTimer();
|
||||
saveState();
|
||||
}
|
||||
|
||||
function resetGrid() {
|
||||
playerGrid.value = Array(size.value).fill().map(() => Array(size.value).fill(0));
|
||||
moves.value = 0;
|
||||
@@ -332,6 +352,7 @@ export const usePuzzleStore = defineStore('puzzle', () => {
|
||||
progressPercentage,
|
||||
initGame,
|
||||
initCustomGame,
|
||||
initFromImage,
|
||||
toggleCell,
|
||||
setCell,
|
||||
resetGame,
|
||||
|
||||
Reference in New Issue
Block a user