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