ad5944cf8d
Insert/Delete/Backspace Status line Change-Id: I38727ddb86bf20cdd6c64363c33ffda03ab3c2c7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431179 Reviewed-by: Julia Lavrova <jlavrova@google.com> Commit-Queue: Julia Lavrova <jlavrova@google.com>
35 lines
736 B
C++
35 lines
736 B
C++
// 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
|