Skip to content

Instantly share code, notes, and snippets.

Sudoku.TopSurface = SC.View.extend({
init: function(){
sc_super();
var newButton = SC.ButtonWidget.create({
layout: { width: 100, top: 0, left: 0, height: 30 },
title: "New Game",
theme: 'square',
isDefault: true,
title : SC.LabelView.design({
valueBinding : SC.Binding.oneWay('Licenser.companiesController.length').transform(function(val) {
var ret = "none";
if (val) ret = "Total Companies [%@]".fmt(val);
return ret;
}),
classNames : [ 'title' ]
})
rotate: function() {
var transform = this.get('transform'),
that = this;
transform = SC.Transform3DRotateY(transform, Math.PI);
this.set('transform', transform);
this.set('focus', true);
setTimeout(function() {
SC.RunLoop.begin();
var xform = that.get('transform');
sc_require('sudoku/views/cell');
Sudoku.BoardSurface = SC.CompositeSurface.extend({
backgroundColor: "#268bd2",
contentBinding: SC.Binding.oneWay('Sudoku.cellsController.content'),
numberOfRows: 9,
numberOfColumns: 9,
currentSelection: -1,
contentDidChange: function() {
Sudoku.CellSurface = SC.View.extend(SC.ContentDisplay, {
contentDisplayProperties: ['value'],
content: null,
init: function() {
sc_super();
var layers = this.get('layers');
this._valueLayer = Sudoku.ValueLayer.create({
layout: {top: 0, left: 0, right: 0, bottom: 0}
sc_require('sudoku/views/cell');
Sudoku.BoardSurface = SC.CompositeSurface.extend({
backgroundColor: "#268bd2",
contentBinding: SC.Binding.oneWay('Sudoku.cellsController.arrangedObjects'),
contentDidChange: function(){
console.log('cells changed, triggering rendering');
this.triggerRendering();
}.observes('content'),
/**
* An individual cell's surface
* @author Michael Harris
*/
Sudoku.CellSurface = SC.View.extend({
init: function(){
sc_super();
var layers = this.get('layers'),
frame = this.get('frame'),
/**
* An individual cell's surface
* @author Michael Harris
*/
Sudoku.CellSurface = SC.View.extend({
updateDisplay: function() {
console.log('cell update display ');
var psurface = SC.psurfaces[this.__id__],
canvas = psurface ? psurface.__element__ : null,
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');
},
function main() {
var ui = Sudoku.null,
widget = Sudoku.widget;
// SC.View initially has no layers, so you'll add your widget to your
// view's layers so it can display itself and receive events.
ui.get('layers').pushObject(widget);
// Next, you'll tell `SC.app` that you want your `SC.View` surface to
// become the app's user interface ('ui'). Each app has only one active