forked from firka/flutter
Ink splashes should start at the touch point
Previously, they always started at the center of the RenderInkWell. Now we remember the local coordinates we computed during the hit test and provide that information when handling the event. R=ianh@google.com Review URL: https://codereview.chromium.org/1180553002.
This commit is contained in:
@@ -14,7 +14,7 @@ class GameBox extends SpriteBox {
|
||||
int _secondPointer = -1;
|
||||
Vector2 _firstPointerDownPos;
|
||||
|
||||
void handleEvent(Event event) {
|
||||
void handleEvent(Event event, BoxHitTestEntry entry) {
|
||||
if (event is PointerEvent) {
|
||||
Vector2 pointerPos = new Vector2(event.x, event.y);
|
||||
int pointer = event.pointer;
|
||||
|
||||
@@ -56,7 +56,7 @@ class SpriteBox extends RenderBox {
|
||||
size = constraints.constrain(Size.infinite);
|
||||
}
|
||||
|
||||
void handleEvent(Event event) {
|
||||
void handleEvent(Event event, BoxHitTestEntry entry) {
|
||||
switch (event.type) {
|
||||
case 'pointerdown':
|
||||
print("pointerdown");
|
||||
|
||||
@@ -90,7 +90,7 @@ abstract class RenderSector extends RenderObject {
|
||||
theta < parentData.theta || theta >= parentData.theta + deltaTheta)
|
||||
return false;
|
||||
hitTestChildren(result, radius: radius, theta: theta);
|
||||
result.add(this);
|
||||
result.add(new HitTestEntry(this));
|
||||
return true;
|
||||
}
|
||||
void hitTestChildren(HitTestResult result, { double radius, double theta }) { }
|
||||
@@ -454,7 +454,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox {
|
||||
if (theta > child.deltaTheta)
|
||||
return false;
|
||||
child.hitTest(result, radius: radius, theta: theta);
|
||||
result.add(this);
|
||||
result.add(new BoxHitTestEntry(this, position));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ class RenderSolidColor extends RenderDecoratedSector {
|
||||
deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
|
||||
}
|
||||
|
||||
void handleEvent(sky.Event event) {
|
||||
void handleEvent(sky.Event event, HitTestEntry entry) {
|
||||
if (event.type == 'pointerdown')
|
||||
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000));
|
||||
else if (event.type == 'pointerup')
|
||||
|
||||
@@ -42,7 +42,7 @@ class RenderTouchDemo extends RenderBox {
|
||||
|
||||
RenderTouchDemo();
|
||||
|
||||
void handleEvent(sky.Event event) {
|
||||
void handleEvent(Event event, BoxHitTestEntry entry) {
|
||||
switch (event.type) {
|
||||
case 'pointerdown':
|
||||
int color = colors[event.pointer.remainder(colors.length)];
|
||||
|
||||
Reference in New Issue
Block a user