OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of clock; | 5 part of clock; |
6 | 6 |
7 class ClockNumber { | 7 class ClockNumber { |
8 static const int WIDTH = 4; | 8 static const int WIDTH = 4; |
9 static const int HEIGHT = 7; | 9 static const int HEIGHT = 7; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 void setPixels(List<List<int>> px) { | 39 void setPixels(List<List<int>> px) { |
40 for (int y = 0; y < HEIGHT; ++y) { | 40 for (int y = 0; y < HEIGHT; ++y) { |
41 for (int x = 0; x < WIDTH; ++x) { | 41 for (int x = 0; x < WIDTH; ++x) { |
42 ImageElement img = imgs[y][x]; | 42 ImageElement img = imgs[y][x]; |
43 | 43 |
44 if (pixels != null) { | 44 if (pixels != null) { |
45 if ((pixels[y][x] != 0) && (px[y][x] == 0)) { | 45 if ((pixels[y][x] != 0) && (px[y][x] == 0)) { |
46 img.rect.then((ElementRect r) { | 46 window.requestLayoutFrame(() { |
47 double absx = r.bounding.left; | 47 var r = img.getBoundingClientRect(); |
48 double absy = r.bounding.top; | 48 double absx = r.left; |
| 49 double absy = r.top; |
49 | 50 |
50 app.balls.add(absx, absy, ballColor); | 51 app.balls.add(absx, absy, ballColor); |
51 }); | 52 }); |
52 } | 53 } |
53 } | 54 } |
54 | 55 |
55 img.src = px[y][x] != 0 ? Balls.PNGS[ballColor] : Balls.PNGS[6]; | 56 img.src = px[y][x] != 0 ? Balls.PNGS[ballColor] : Balls.PNGS[6]; |
56 } | 57 } |
57 } | 58 } |
58 | 59 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const[ 1, 1, 1, 1 ], | 159 const[ 1, 1, 1, 1 ], |
159 const[ 1, 0, 0, 1 ], | 160 const[ 1, 0, 0, 1 ], |
160 const[ 1, 0, 0, 1 ], | 161 const[ 1, 0, 0, 1 ], |
161 const[ 1, 1, 1, 1 ], | 162 const[ 1, 1, 1, 1 ], |
162 const[ 0, 0, 0, 1 ], | 163 const[ 0, 0, 0, 1 ], |
163 const[ 0, 0, 0, 1 ], | 164 const[ 0, 0, 0, 1 ], |
164 const[ 1, 1, 1, 1 ] | 165 const[ 1, 1, 1, 1 ] |
165 ] | 166 ] |
166 ]; | 167 ]; |
167 } | 168 } |
OLD | NEW |