| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:html'; | 6 import 'dart:html'; |
| 7 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 7 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 8 import 'package:observatory/src/elements/helpers/tag.dart'; | 8 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 9 | 9 |
| 10 typedef HtmlElement VirtualCollectionCreateCallback(); | 10 typedef HtmlElement VirtualCollectionCreateCallback(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 @override | 71 @override |
| 72 detached() { | 72 detached() { |
| 73 super.detached(); | 73 super.detached(); |
| 74 _r.disable(notify: true); | 74 _r.disable(notify: true); |
| 75 children = const []; | 75 children = const []; |
| 76 _onScrollSubscription.cancel(); | 76 _onScrollSubscription.cancel(); |
| 77 _onResizeSubscription.cancel(); | 77 _onResizeSubscription.cancel(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 final DivElement _header = new DivElement()..classes = const ['header']; | 80 final DivElement _header = new DivElement()..classes = ['header']; |
| 81 final DivElement _scroller = new DivElement()..classes = const ['scroller']; | 81 final DivElement _scroller = new DivElement()..classes = ['scroller']; |
| 82 final DivElement _shifter = new DivElement()..classes = const ['shifter']; | 82 final DivElement _shifter = new DivElement()..classes = ['shifter']; |
| 83 | 83 |
| 84 dynamic getItemFromElement(HtmlElement element) { | 84 dynamic getItemFromElement(HtmlElement element) { |
| 85 final el_index = _shifter.children.indexOf(element); | 85 final el_index = _shifter.children.indexOf(element); |
| 86 if (el_index < 0) { | 86 if (el_index < 0) { |
| 87 return null; | 87 return null; |
| 88 } | 88 } |
| 89 final item_index = | 89 final item_index = |
| 90 _top + el_index - (_shifter.children.length * _inverse_preload).floor(); | 90 _top + el_index - (_shifter.children.length * _inverse_preload).floor(); |
| 91 if (0 <= item_index && item_index < items.length) { | 91 if (0 <= item_index && item_index < items.length) { |
| 92 return _items[item_index]; | 92 return _items[item_index]; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 void _onResize(_) { | 181 void _onResize(_) { |
| 182 final newHeight = getBoundingClientRect().height; | 182 final newHeight = getBoundingClientRect().height; |
| 183 if (newHeight > _height) { | 183 if (newHeight > _height) { |
| 184 _height = newHeight; | 184 _height = newHeight; |
| 185 _r.dirty(); | 185 _r.dirty(); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 } | 188 } |
| OLD | NEW |