blob: 82d8c578e9843e71b1901837934d079341c3152f [file] [log] [blame]
// Copyright 2021 Google LLC.
#include "experimental/sktext/editor/Mouse.h"
using namespace skia::text;
namespace skia {
namespace editor {
void Mouse::down() {
fMouseDown = true;
}
void Mouse::up() {
fMouseDown = false;
}
bool Mouse::isDoubleClick(SkPoint touch) {
if ((touch - fLastTouchPoint).length() > MAX_DBL_TAP_DISTANCE) {
fLastTouchPoint = touch;
fLastTouchTime = SkTime::GetMSecs();
return false;
}
double now = SkTime::GetMSecs();
if (now - fLastTouchTime > MAX_DBL_TAP_INTERVAL) {
fLastTouchPoint = touch;
fLastTouchTime = SkTime::GetMSecs();
return false;
}
clearTouchInfo();
return true;
}
} // namespace editor
} // namespace skia