skia2/experimental/sktext/editor/Mouse.h
Julia Lavrova ad5944cf8d Refactoring Text Editor (in progress)
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>
2021-08-09 15:06:56 +00:00

45 lines
1.1 KiB
C++

// Copyright 2021 Google LLC.
#ifndef Mouse_DEFINED
#define Mouse_DEFINED
#include <sstream>
#include "experimental/sktext/editor/Defaults.h"
#include "experimental/sktext/include/Text.h"
#include "experimental/sktext/include/Types.h"
#include "experimental/sktext/src/Paint.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTime.h"
#include "tools/sk_app/Application.h"
#include "tools/sk_app/Window.h"
#include "tools/skui/ModifierKey.h"
namespace skia {
namespace editor {
using namespace skia::text;
class Mouse {
const SkMSec MAX_DBL_TAP_INTERVAL = 300;
const float MAX_DBL_TAP_DISTANCE = 100;
public:
Mouse() : fMouseDown(false), fLastTouchPoint(), fLastTouchTime() { }
void down();
void up();
void clearTouchInfo() {
fLastTouchPoint = SkPoint::Make(0, 0);
fLastTouchTime = 0.0;
}
bool isDown() { return fMouseDown; }
bool isDoubleClick(SkPoint touch);
private:
bool fMouseDown;
SkPoint fLastTouchPoint;
double fLastTouchTime;
};
} // namespace editor
} // namespace skia
#endif // Mouse_DEFINED