Skip to content

Commit

Permalink
update to Dart 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanr committed Nov 9, 2013
1 parent a532ac7 commit 5ff04d9
Show file tree
Hide file tree
Showing 249 changed files with 1,677 additions and 1,678 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ https://plus.google.com/u/0/b/113649577593294551754/113649577593294551754/posts

mb_spirals in Dart
by Dzenan Ridjanovic
2012-01-23 -- 2013-09-22
2012-01-23 -- 2013-11-09

updated for Dart beta on 2013-09-22

Learning Dart in spirals by developing
Learning Dart in spirals by developing
[Model Concepts](https://github.com/dzenanr/model_concepts).

Teaching Dart by using [spirals](https://github.com/dzenanr/mb_spirals) on Learning Dart.
Expand Down
2 changes: 1 addition & 1 deletion s00/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class mb {

void write(String message) {
// the HTML library defines a global "document" variable
document.query('#status').innerHtml = message;
document.querySelector('#status').innerHtml = message;
}
}

Expand Down
2 changes: 1 addition & 1 deletion s01/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:html';

main() {
// Get a reference to the canvas.
var canvas = document.query('#canvas');
var canvas = document.querySelector('#canvas');
var context = canvas.getContext("2d");
var width = canvas.width;
var height = canvas.height;
Expand Down
2 changes: 1 addition & 1 deletion s01/s01/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:html';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
CanvasRenderingContext2D context = canvas.getContext("2d");
int width = canvas.width;
int height = canvas.height;
Expand Down
2 changes: 1 addition & 1 deletion s01/s02/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ void displayBoxes(CanvasElement canvas) {

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
displayBoxes(canvas);
}
2 changes: 1 addition & 1 deletion s01/s03/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ void displayBord(CanvasElement canvas) {

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
displayBord(canvas);
}
2 changes: 1 addition & 1 deletion s01/s04/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ part 'board.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
new Board(canvas);
}
2 changes: 1 addition & 1 deletion s01/s05/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s02/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s02/s01/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s02/s02/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Box {

// Change a position of the box with mouse mouvements.
void onMouseMove(MouseEvent event) {
if (isPointInside(event.offsetX, event.offsetY)) {
if (isPointInside(event.offset.x, event.offset.y)) {
x = event.offset.x;
y = event.offset.y;
}
Expand Down
2 changes: 1 addition & 1 deletion s02/s02/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s02/s03/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Box {

// Change a position of the box with mouse mouvements.
void onMouseMove(MouseEvent event) {
if (isPointInside(event.offsetX, event.offsetY)) {
if (isPointInside(event.offset.x, event.offset.y)) {
x = event.offset.x - width / 2;
y = event.offset.y - height / 2;
}
Expand Down
2 changes: 1 addition & 1 deletion s02/s03/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s02/s04/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s03/s00/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Board {

// Create a box in the position of the mouse click on the board.
void onMouseDown(MouseEvent event) {
Box box = new Box(this, event.offsetX, event.offsetY, 60, 100);
Box box = new Box(this, event.offset.x, event.offset.y, 60, 100);
boxes.add(box);
}

Expand Down
2 changes: 1 addition & 1 deletion s03/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s03/s01/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s03/s02/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s03/s03/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s03/s04/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s03/s05/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s04/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s04/s01/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s04/s02/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s05/s00/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Board {
boxes = new List();

// Canvas event
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
// Redraw every INTERVAL ms.
new Timer.periodic(const Duration(milliseconds: INTERVAL), (t) => redraw());
}
Expand Down
6 changes: 3 additions & 3 deletions s05/s00/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Box {
titleNo = board.nextBoxNo;
draw();
// Box events (actually, canvas events).
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.query('#canvas').onMouseUp.listen(onMouseUp);
document.query('#canvas').onMouseMove.listen(onMouseMove);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseUp.listen(onMouseUp);
document.querySelector('#canvas').onMouseMove.listen(onMouseMove);
}

void draw() {
Expand Down
2 changes: 1 addition & 1 deletion s05/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ part 'box.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
2 changes: 1 addition & 1 deletion s05/s01/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Board {
toolBar = new ToolBar(this);

// Canvas event
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
// Redraw every INTERVAL ms.
new Timer.periodic(const Duration(milliseconds: INTERVAL), (t) => redraw());
}
Expand Down
6 changes: 3 additions & 3 deletions s05/s01/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Box {
titleNo = board.nextBoxNo;
draw();
// Box events (actually, canvas events).
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.query('#canvas').onMouseUp.listen(onMouseUp);
document.query('#canvas').onMouseMove.listen(onMouseMove);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseUp.listen(onMouseUp);
document.querySelector('#canvas').onMouseMove.listen(onMouseMove);
}

void draw() {
Expand Down
2 changes: 1 addition & 1 deletion s05/s01/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ part 'tool_bar.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
4 changes: 2 additions & 2 deletions s05/s01/tool_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ToolBar {
bool _boxToolDblClicked = false;

ToolBar(this.board) {
ButtonElement selectButton = document.query('#select');
ButtonElement boxButton = document.query('#box');
ButtonElement selectButton = document.querySelector('#select');
ButtonElement boxButton = document.querySelector('#box');

// Tool bar events.
selectButton.onClick.listen((MouseEvent e) {
Expand Down
2 changes: 1 addition & 1 deletion s05/s02/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Board {
toolBar = new ToolBar(this);

// Canvas event
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
// Redraw every INTERVAL ms.
new Timer.periodic(const Duration(milliseconds: INTERVAL), (t) => redraw());
}
Expand Down
8 changes: 4 additions & 4 deletions s05/s02/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Box {
titleNo = board.nextBoxNo;
draw();
// Box events (actually, canvas events).
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.query('#canvas').onMouseUp.listen(onMouseUp);
document.query('#canvas').onMouseMove.listen(onMouseMove);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseUp.listen(onMouseUp);
document.querySelector('#canvas').onMouseMove.listen(onMouseMove);
}

void draw() {
Expand Down Expand Up @@ -88,7 +88,7 @@ class Box {
// Change a position of the box with mouse mouvements.
void onMouseMove(MouseEvent e) {
if (contains(e.offset.x, e.offset.y) && isSelected() && _mouseDown &&
board.countSelectedBoxesContain(e.offsetX, e.offsetY) < 2) {
board.countSelectedBoxesContain(e.offset.x, e.offset.y) < 2) {
x = e.offset.x - width / 2;
if (x < 0) {
x = 1;
Expand Down
2 changes: 1 addition & 1 deletion s05/s02/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ part 'tool_bar.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
4 changes: 2 additions & 2 deletions s05/s02/tool_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ToolBar {
bool _boxToolDblClicked = false;

ToolBar(this.board) {
ButtonElement selectButton = document.query('#select');
ButtonElement boxButton = document.query('#box');
ButtonElement selectButton = document.querySelector('#select');
ButtonElement boxButton = document.querySelector('#box');

// Tool bar events.
selectButton.onClick.listen((MouseEvent e) {
Expand Down
2 changes: 1 addition & 1 deletion s06/s00/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Board {
toolBar = new ToolBar(this);

// Canvas event
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
// Redraw every INTERVAL ms.
new Timer.periodic(const Duration(milliseconds: INTERVAL), (t) => redraw());
}
Expand Down
6 changes: 3 additions & 3 deletions s06/s00/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Box {
titleNo = board.nextBoxNo;
draw();
// Box events (actually, canvas events).
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.query('#canvas').onMouseUp.listen(onMouseUp);
document.query('#canvas').onMouseMove.listen(onMouseMove);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseUp.listen(onMouseUp);
document.querySelector('#canvas').onMouseMove.listen(onMouseMove);
}

void draw() {
Expand Down
2 changes: 1 addition & 1 deletion s06/s00/mb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ part 'menu_bar.dart';

void main() {
// Get a reference to the canvas.
CanvasElement canvas = document.query('#canvas');
CanvasElement canvas = document.querySelector('#canvas');
Board board = new Board(canvas);
}
4 changes: 2 additions & 2 deletions s06/s00/menu_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class MenuBar {
ButtonElement deleteBoxesButton;

MenuBar(this.board) {
createBoxesButton = document.query('#create-boxes');
deleteBoxesButton = document.query('#delete-boxes');
createBoxesButton = document.querySelector('#create-boxes');
deleteBoxesButton = document.querySelector('#delete-boxes');

// Menu bar events.
createBoxesButton.onClick.listen((MouseEvent e) {
Expand Down
4 changes: 2 additions & 2 deletions s06/s00/tool_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ToolBar {
bool _boxToolDblClicked = false;

ToolBar(this.board) {
ButtonElement selectButton = document.query('#select');
ButtonElement boxButton = document.query('#box');
ButtonElement selectButton = document.querySelector('#select');
ButtonElement boxButton = document.querySelector('#box');

// Tool bar events.
selectButton.onClick.listen((MouseEvent e) {
Expand Down
2 changes: 1 addition & 1 deletion s06/s01/board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Board {
toolBar = new ToolBar(this);

// Canvas event
document.query('#canvas').onMouseDown.listen(onMouseDown);
document.querySelector('#canvas').onMouseDown.listen(onMouseDown);
// Redraw every INTERVAL ms.
new Timer.periodic(const Duration(milliseconds: INTERVAL), (t) => redraw());
}
Expand Down
Loading

0 comments on commit 5ff04d9

Please sign in to comment.