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 '../animation/animated_value.dart'; | 5 import '../animation/animated_value.dart'; |
6 import '../animation/curves.dart'; | 6 import '../animation/curves.dart'; |
7 import '../fn2.dart'; | 7 import '../fn2.dart'; |
8 import '../rendering/box.dart'; | 8 import '../rendering/box.dart'; |
9 import '../rendering/flex.dart'; | 9 import '../rendering/flex.dart'; |
10 import '../rendering/object.dart'; | 10 import '../rendering/object.dart'; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24); | 59 sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24); |
60 canvas.drawCircle(position.x, position.y, _radius.value, paint); | 60 canvas.drawCircle(position.x, position.y, _radius.value, paint); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 class RenderInkWell extends RenderProxyBox { | 64 class RenderInkWell extends RenderProxyBox { |
65 RenderInkWell({ RenderBox child }) : super(child); | 65 RenderInkWell({ RenderBox child }) : super(child); |
66 | 66 |
67 final List<InkSplash> _splashes = new List<InkSplash>(); | 67 final List<InkSplash> _splashes = new List<InkSplash>(); |
68 | 68 |
69 void handleEvent(sky.Event event) { | 69 void handleEvent(sky.Event event, BoxHitTestData data) { |
70 switch (event.type) { | 70 switch (event.type) { |
71 case 'gesturetapdown': | 71 case 'gesturetapdown': |
72 // TODO(abarth): We should position the splash at the location of the ta
p. | 72 // TODO(abarth): We should position the splash at the location of the ta
p. |
73 _startSplash(event.primaryPointer, new Point(size.width / 2.0, size.heig
ht / 2.0)); | 73 _startSplash(event.primaryPointer, data.localPosition); |
74 break; | 74 break; |
75 case 'gesturetap': | 75 case 'gesturetap': |
76 _confirmSplash(event.primaryPointer); | 76 _confirmSplash(event.primaryPointer); |
77 break; | 77 break; |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void _startSplash(int pointer, Point position) { | 81 void _startSplash(int pointer, Point position) { |
82 _splashes.add(new InkSplash(pointer, position, this)); | 82 _splashes.add(new InkSplash(pointer, position, this)); |
83 markNeedsPaint(); | 83 markNeedsPaint(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 UINode build() { | 118 UINode build() { |
119 return new InkWellWrapper( | 119 return new InkWellWrapper( |
120 child: new FlexContainer( | 120 child: new FlexContainer( |
121 direction: FlexDirection.horizontal, | 121 direction: FlexDirection.horizontal, |
122 justifyContent: FlexJustifyContent.center, | 122 justifyContent: FlexJustifyContent.center, |
123 children: children | 123 children: children |
124 ) | 124 ) |
125 ); | 125 ); |
126 } | 126 } |
127 } | 127 } |
OLD | NEW |