Skip to content

Instantly share code, notes, and snippets.

@hvgotcodes
Created March 4, 2012 18:40
Show Gist options
  • Save hvgotcodes/1974313 to your computer and use it in GitHub Desktop.
Save hvgotcodes/1974313 to your computer and use it in GitHub Desktop.
updateDisplay: function() {
if (!this.getPath('subsurfaces.length')) this._createSubsurfaces();
console.log('board update display');
// console.log('SC.ContainerSurface#updateDisplay()');
var subsurfaces = this.get('subsurfaces');
if (subsurfaces) subsurfaces.invoke('updateDisplay');
},
_createSubsurfaces: function() {
console.log('creating subsurfaces');
var subsurfaces = this.get('subsurfaces');
for (var i = 1; i < 10; i++) {
for (var j = 1; j < 10; j++) {
var height = this._cellHeight,
width = this._cellWidth,
x, y, surface;
x = (i - 1) * width;
y = (j - 1) * height;
surface = Sudoku.CellSurface.create({
i: i,
j: j
});
surface.set('frame', SC.MakeRect(x, y, width, height));
subsurfaces.pushObject(surface);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment