OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 touch; | 5 part of touch; |
6 | 6 |
7 /** | 7 /** |
8 * Implementation of a custom scrolling behavior. | 8 * Implementation of a custom scrolling behavior. |
9 * This behavior overrides native scrolling for an area. This area can be a | 9 * This behavior overrides native scrolling for an area. This area can be a |
10 * single defined part of a page, the entire page, or several different parts | 10 * single defined part of a page, the entire page, or several different parts |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 _minOffset.x = 0; | 556 _minOffset.x = 0; |
557 _minOffset.y = 0; | 557 _minOffset.y = 0; |
558 reconfigure(() => _setContentOffset(_maxPoint.x, _maxPoint.y)); | 558 reconfigure(() => _setContentOffset(_maxPoint.x, _maxPoint.y)); |
559 } | 559 } |
560 | 560 |
561 /** | 561 /** |
562 * Recalculate dimensions of the frame and the content. Adjust the minPoint | 562 * Recalculate dimensions of the frame and the content. Adjust the minPoint |
563 * and maxPoint allowed for scrolling. | 563 * and maxPoint allowed for scrolling. |
564 */ | 564 */ |
565 void _resize(Callback callback) { | 565 void _resize(Callback callback) { |
566 window.setImmediate(() { | 566 scheduleMicrotask(() { |
567 if (_lookupContentSizeDelegate != null) { | 567 if (_lookupContentSizeDelegate != null) { |
568 _contentSize = _lookupContentSizeDelegate(); | 568 _contentSize = _lookupContentSizeDelegate(); |
569 } else { | 569 } else { |
570 _contentSize = new Size(_element.scrollWidth, _element.scrollHeight); | 570 _contentSize = new Size(_element.scrollWidth, _element.scrollHeight); |
571 } | 571 } |
572 | 572 |
573 _scrollSize = new Size(_frame.offset.width, | 573 _scrollSize = new Size(_frame.offset.width, |
574 _frame.offset.height); | 574 _frame.offset.height); |
575 Size adjusted = _getAdjustedContentSize(); | 575 Size adjusted = _getAdjustedContentSize(); |
576 _maxPoint = new Coordinate(-_maxOffset.x, -_maxOffset.y); | 576 _maxPoint = new Coordinate(-_maxOffset.x, -_maxOffset.y); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 static const SCROLLER_END = "scroller:scroll_end"; | 694 static const SCROLLER_END = "scroller:scroll_end"; |
695 static const DRAG_END = "scroller:drag_end"; | 695 static const DRAG_END = "scroller:drag_end"; |
696 static const CONTENT_MOVED = "scroller:content_moved"; | 696 static const CONTENT_MOVED = "scroller:content_moved"; |
697 static const DECEL_START = "scroller:decel_start"; | 697 static const DECEL_START = "scroller:decel_start"; |
698 } | 698 } |
699 | 699 |
700 class ScrollerScrollTechnique { | 700 class ScrollerScrollTechnique { |
701 static const TRANSFORM_3D = 1; | 701 static const TRANSFORM_3D = 1; |
702 static const RELATIVE_POSITIONING = 2; | 702 static const RELATIVE_POSITIONING = 2; |
703 } | 703 } |
OLD | NEW |