This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ] | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |