Constellations/js/Grid/Color.js

22 lines
474 B
JavaScript

import CellSet;
import Grid;
import Toolbox;
return {
ize: colorize,
paint: paint
};
function colorize(row, column, color) {
var grid = Grid.get();
grid.data[row][column] = color || Toolbox.color();
Grid.cell(row, column).className = 'color' + grid.data[row][column];
grid.missing.remove(row, column);
}
function paint(row, column) {
var cellSet = CellSet.make(
{type: 'isochrome', row: row, column: column, data: Grid.get().data}
);
cellSet.iter(colorize);
}