Adam Barth 97abc0dadd Improve Material ink effects
1) Factors InkWell out of Material so that components can use an ink well
   without needing the shadow/level machinery.

2) Makes the ink effect move at a different velocity once the tap has actually
   occurred, converging with the spec. We don't have the right speeds yet, but
   at least we're approaching the right shape.

3) To support (2), added a primaryPointer attribute to GestureEvents to let
   authors coorelate gesturetapdown events with later gesturetap events.

4) To support (2), modernized SplashAnimation to used AnimatedValue and friends.

5) Added more constants to view-configuration.dart that match Android.

I've also removed the cancelling of the ink effect on scroll. The proper way to
do that is to notice that someone in the event chain is listening for
scrollstart and delay the beginning of the ink effect for some period of time.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1019023003
2015-03-19 11:17:48 -07:00

67 lines
1.8 KiB
C++

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_
#define SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_
#include "sky/engine/core/events/Event.h"
#include "sky/engine/public/platform/WebInputEvent.h"
namespace blink {
struct GestureEventInit : public EventInit {
int primaryPointer = 0;
double x = 0;
double y = 0;
double dx = 0;
double dy = 0;
double velocityX = 0;
double velocityY = 0;
};
class GestureEvent : public Event {
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtr<GestureEvent> create()
{
return adoptRef(new GestureEvent);
}
static PassRefPtr<GestureEvent> create(const WebGestureEvent& event)
{
return adoptRef(new GestureEvent(event));
}
static PassRefPtr<GestureEvent> create(const AtomicString& type, const GestureEventInit& initializer)
{
return adoptRef(new GestureEvent(type, initializer));
}
~GestureEvent() override;
const AtomicString& interfaceName() const override;
int primaryPointer() const { return m_primaryPointer; }
float x() const { return m_x; }
float y() const { return m_y; }
float dx() const { return m_dx; }
float dy() const { return m_dy; }
float velocityX() const { return m_velocityX; }
float velocityY() const { return m_velocityY; }
private:
GestureEvent();
explicit GestureEvent(const WebGestureEvent&);
GestureEvent(const AtomicString& type, const GestureEventInit&);
int m_primaryPointer;
float m_x;
float m_y;
float m_dx;
float m_dy;
float m_velocityX;
float m_velocityY;
};
} // namespace blink
#endif // SKY_ENGINE_CORE_EVENTS_GESTUREEVENT_H_