• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 Google LLC.
2 #ifndef Mouse_DEFINED
3 #define Mouse_DEFINED
4 #include <sstream>
5 #include "experimental/sktext/editor/Defaults.h"
6 #include "experimental/sktext/include/Text.h"
7 #include "experimental/sktext/include/Types.h"
8 #include "experimental/sktext/src/Paint.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkSurface.h"
11 #include "include/core/SkTime.h"
12 #include "tools/sk_app/Application.h"
13 #include "tools/sk_app/Window.h"
14 #include "tools/skui/ModifierKey.h"
15 
16 namespace skia {
17 namespace editor {
18 
19 using namespace skia::text;
20 
21 class Mouse {
22     const SkMSec MAX_DBL_TAP_INTERVAL = 300;
23     const float MAX_DBL_TAP_DISTANCE = 100;
24 public:
Mouse()25     Mouse() : fMouseDown(false), fLastTouchPoint(), fLastTouchTime() { }
26 
27     void down();
28     void up();
clearTouchInfo()29     void clearTouchInfo() {
30         fLastTouchPoint = SkPoint::Make(0, 0);
31         fLastTouchTime = 0.0;
32     }
isDown()33     bool isDown() { return fMouseDown; }
34     bool isDoubleClick(SkPoint touch);
35 
36 private:
37     bool fMouseDown;
38     SkPoint fLastTouchPoint;
39     double fLastTouchTime;
40 };
41 
42 } // namespace editor
43 } // namespace skia
44 #endif // Mouse_DEFINED
45