Skip to content

Numbering incorrect? #18

@joetime

Description

@joetime

I'm not sure if there's already a way to do this and I'm just missing it... in the image below, the number 19 shouldn't be there, right? There's no word that starts there, either down or across.

I'd be glad to take a look and work on this (this is an incredible tool!), I just don't want to duplicate work if there's already a way.

screen shot 2018-09-26 at 2 58 22 pm

I believe the relevant code is here:

Phil/cross.js

Lines 535 to 566 in 58243dd

function updateLabelsAndClues() {
let count = 1;
for (let i = 0; i < xw.rows; i++) {
for (let j = 0; j < xw.cols; j++) {
let isAcross = false;
let isDown = false;
if (xw.fill[i][j] != BLACK) {
isDown = i == 0 || xw.fill[i - 1][j] == BLACK;
isAcross = j == 0 || xw.fill[i][j - 1] == BLACK;
}
const grid = document.getElementById("grid");
let currentCell = grid.querySelector('[data-row="' + i + '"]').querySelector('[data-col="' + j + '"]');
if (isAcross || isDown) {
currentCell.firstChild.innerHTML = count; // Set square's label to the count
count++;
} else {
currentCell.firstChild.innerHTML = "";
}
if (isAcross) {
xw.clues[[i, j, ACROSS]] = xw.clues[[i, j, ACROSS]] || DEFAULT_CLUE;
} else {
delete xw.clues[[i, j, ACROSS]];
}
if (isDown) {
xw.clues[[i, j, DOWN]] = xw.clues[[i, j, DOWN]] || DEFAULT_CLUE;
} else {
delete xw.clues[[i, j, DOWN]];
}
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions