1 // Copyright 2021 Google LLC. 2 #include "experimental/sktext/editor/Mouse.h" 3 4 using namespace skia::text; 5 6 namespace skia { 7 namespace editor { 8 down()9void Mouse::down() { 10 fMouseDown = true; 11 } 12 up()13void Mouse::up() { 14 fMouseDown = false; 15 } 16 isDoubleClick(SkPoint touch)17bool Mouse::isDoubleClick(SkPoint touch) { 18 if ((touch - fLastTouchPoint).length() > MAX_DBL_TAP_DISTANCE) { 19 fLastTouchPoint = touch; 20 fLastTouchTime = SkTime::GetMSecs(); 21 return false; 22 } 23 double now = SkTime::GetMSecs(); 24 if (now - fLastTouchTime > MAX_DBL_TAP_INTERVAL) { 25 fLastTouchPoint = touch; 26 fLastTouchTime = SkTime::GetMSecs(); 27 return false; 28 } 29 30 clearTouchInfo(); 31 return true; 32 } 33 } // namespace editor 34 } // namespace skia 35