| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import '../animation/animated_value.dart'; | 8 import '../animation/animated_value.dart'; |
| 9 import '../animation/curves.dart'; | 9 import '../animation/curves.dart'; |
| 10 import '../rendering/box.dart'; | 10 import '../rendering/box.dart'; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 canvas.drawCircle(position.x, position.y, _radius.value, paint); | 58 canvas.drawCircle(position.x, position.y, _radius.value, paint); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 class RenderInkWell extends RenderProxyBox { | 62 class RenderInkWell extends RenderProxyBox { |
| 63 RenderInkWell({ RenderBox child }) : super(child); | 63 RenderInkWell({ RenderBox child }) : super(child); |
| 64 | 64 |
| 65 final List<InkSplash> _splashes = new List<InkSplash>(); | 65 final List<InkSplash> _splashes = new List<InkSplash>(); |
| 66 | 66 |
| 67 void handleEvent(sky.Event event, BoxHitTestEntry entry) { | 67 void handleEvent(sky.Event event, BoxHitTestEntry entry) { |
| 68 switch (event.type) { | 68 if (event is sky.GestureEvent) { |
| 69 case 'gesturetapdown': | 69 switch (event.type) { |
| 70 // TODO(abarth): We should position the splash at the location of the ta
p. | 70 case 'gesturetapdown': |
| 71 _startSplash(event.primaryPointer, entry.localPosition); | 71 _startSplash(event.primaryPointer, entry.localPosition); |
| 72 break; | 72 break; |
| 73 case 'gesturetap': | 73 case 'gesturetap': |
| 74 _confirmSplash(event.primaryPointer); | 74 _confirmSplash(event.primaryPointer); |
| 75 break; | 75 break; |
| 76 } |
| 76 } | 77 } |
| 77 } | 78 } |
| 78 | 79 |
| 79 void _startSplash(int pointer, Point position) { | 80 void _startSplash(int pointer, Point position) { |
| 80 _splashes.add(new InkSplash(pointer, position, this)); | 81 _splashes.add(new InkSplash(pointer, position, this)); |
| 81 markNeedsPaint(); | 82 markNeedsPaint(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 void _confirmSplash(int pointer) { | 85 void _confirmSplash(int pointer) { |
| 85 _splashes.where((splash) => splash.pointer == pointer) | 86 _splashes.where((splash) => splash.pointer == pointer) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 class InkWell extends OneChildRenderObjectWrapper { | 103 class InkWell extends OneChildRenderObjectWrapper { |
| 103 InkWell({ String key, Widget child }) | 104 InkWell({ String key, Widget child }) |
| 104 : super(key: key, child: child); | 105 : super(key: key, child: child); |
| 105 | 106 |
| 106 RenderInkWell get root => super.root; | 107 RenderInkWell get root => super.root; |
| 107 RenderInkWell createNode() => new RenderInkWell(); | 108 RenderInkWell createNode() => new RenderInkWell(); |
| 108 } | 109 } |
| OLD | NEW |