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 class Tape { | 5 class Tape { |
6 static const int OP_NOOP = 0; | 6 static const int OP_NOOP = 0; |
7 static const int OP_PLUS = 1; | 7 static const int OP_PLUS = 1; |
8 static const int OP_MINUS = 2; | 8 static const int OP_MINUS = 2; |
9 static const int OP_MULTI = 3; | 9 static const int OP_MULTI = 3; |
10 static const int OP_DIV = 4; | 10 static const int OP_DIV = 4; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 tapeUI.tape.elements.add(element.elements[0]); | 180 tapeUI.tape.elements.add(element.elements[0]); |
181 | 181 |
182 scrollToTapeBottom(); | 182 scrollToTapeBottom(); |
183 | 183 |
184 currentOperator = null; | 184 currentOperator = null; |
185 currentRegister = ""; | 185 currentRegister = ""; |
186 total = 0.0; | 186 total = 0.0; |
187 } | 187 } |
188 | 188 |
189 void scrollToTapeBottom() { | 189 void scrollToTapeBottom() { |
190 tapeUI.tape.rect.then((ElementRect rect) { | 190 window.requestLayoutFrame(() { |
191 // theTape.rect.scroll.top = rect.scroll.height; | 191 // theTape.rect.scroll.top = rect.scroll.height; |
192 // TODO(terry): Would like to set scrollTop of tape doesn't seem to work | 192 // TODO(terry): Would like to set scrollTop of tape doesn't seem to work |
193 // so I scroll by max lines. | 193 // so I scroll by max lines. |
194 tapeUI.tape.scrollByLines(100000); | 194 tapeUI.tape.scrollByLines(100000); |
195 }); | 195 }); |
196 } | 196 } |
197 | 197 |
198 void removeActiveElements() { | 198 void removeActiveElements() { |
199 final element = new Element.tag('div'); | 199 final element = new Element.tag('div'); |
200 | 200 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 DivElement get activeInput => window.document.query("#activeInput"); | 235 DivElement get activeInput => window.document.query("#activeInput"); |
236 DivElement get activeTotal => window.document.query("#activeTotal"); | 236 DivElement get activeTotal => window.document.query("#activeTotal"); |
237 | 237 |
238 void clear() { | 238 void clear() { |
239 final element = new Element.tag('div'); | 239 final element = new Element.tag('div'); |
240 element.innerHTML = tapeUI.clearCalculation(); | 240 element.innerHTML = tapeUI.clearCalculation(); |
241 tapeUI.tape.elements.add(element.elements[0]); | 241 tapeUI.tape.elements.add(element.elements[0]); |
242 } | 242 } |
243 } | 243 } |
OLD | NEW |