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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // TODO(jacobr): this assert fires asynchronously which could be confusing. | 239 // TODO(jacobr): this assert fires asynchronously which could be confusing. |
240 if (_scrollTechnique == ScrollerScrollTechnique.RELATIVE_POSITIONING) { | 240 if (_scrollTechnique == ScrollerScrollTechnique.RELATIVE_POSITIONING) { |
241 assert(_element.getComputedStyle().position != "static"); | 241 assert(_element.getComputedStyle().position != "static"); |
242 } | 242 } |
243 | 243 |
244 _initLayer(); | 244 _initLayer(); |
245 } | 245 } |
246 | 246 |
247 Stream<Event> get onScrollerStart { | 247 Stream<Event> get onScrollerStart { |
248 if (_onScrollerStart == null) { | 248 if (_onScrollerStart == null) { |
249 _onScrollerStart = new StreamController<Event>(); | 249 _onScrollerStart = new StreamController<Event>(sync: true); |
250 _onScrollerStartStream = _onScrollerStart.stream.asBroadcastStream(); | 250 _onScrollerStartStream = _onScrollerStart.stream.asBroadcastStream(); |
251 } | 251 } |
252 return _onScrollerStartStream; | 252 return _onScrollerStartStream; |
253 } | 253 } |
254 | 254 |
255 Stream<Event> get onScrollerEnd { | 255 Stream<Event> get onScrollerEnd { |
256 if (_onScrollerEnd == null) { | 256 if (_onScrollerEnd == null) { |
257 _onScrollerEnd = new StreamController<Event>(); | 257 _onScrollerEnd = new StreamController<Event>(sync: true); |
258 _onScrollerEndStream = _onScrollerEnd.stream.asBroadcastStream(); | 258 _onScrollerEndStream = _onScrollerEnd.stream.asBroadcastStream(); |
259 } | 259 } |
260 return _onScrollerEndStream; | 260 return _onScrollerEndStream; |
261 } | 261 } |
262 | 262 |
263 Stream<Event> get onScrollerDragEnd { | 263 Stream<Event> get onScrollerDragEnd { |
264 if (_onScrollerDragEnd == null) { | 264 if (_onScrollerDragEnd == null) { |
265 _onScrollerDragEnd = new StreamController<Event>(); | 265 _onScrollerDragEnd = new StreamController<Event>(sync: true); |
266 _onScrollerDragEndStream = _onScrollerDragEnd.stream.asBroadcastStream(); | 266 _onScrollerDragEndStream = _onScrollerDragEnd.stream.asBroadcastStream(); |
267 } | 267 } |
268 return _onScrollerDragEndStream; | 268 return _onScrollerDragEndStream; |
269 } | 269 } |
270 | 270 |
271 Stream<Event> get onContentMoved { | 271 Stream<Event> get onContentMoved { |
272 if (_onContentMoved == null) { | 272 if (_onContentMoved == null) { |
273 _onContentMoved = new StreamController<Event>(); | 273 _onContentMoved = new StreamController<Event>(sync: true); |
274 _onContentMovedStream = _onContentMoved.stream.asBroadcastStream(); | 274 _onContentMovedStream = _onContentMoved.stream.asBroadcastStream(); |
275 } | 275 } |
276 return _onContentMovedStream; | 276 return _onContentMovedStream; |
277 } | 277 } |
278 | 278 |
279 Stream<Event> get onDecelStart { | 279 Stream<Event> get onDecelStart { |
280 if (_onDecelStart == null) { | 280 if (_onDecelStart == null) { |
281 _onDecelStart = new StreamController<Event>(); | 281 _onDecelStart = new StreamController<Event>(sync: true); |
282 _onDecelStartStream = _onDecelStart.stream.asBroadcastStream(); | 282 _onDecelStartStream = _onDecelStart.stream.asBroadcastStream(); |
283 } | 283 } |
284 return _onDecelStartStream; | 284 return _onDecelStartStream; |
285 } | 285 } |
286 | 286 |
287 | 287 |
288 /** | 288 /** |
289 * Add a scroll listener. This allows other classes to subscribe to scroll | 289 * Add a scroll listener. This allows other classes to subscribe to scroll |
290 * notifications from this scroller. | 290 * notifications from this scroller. |
291 */ | 291 */ |
(...skipping 402 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 |