OSDN Git Service

トリプルタップで単語業全体を選択できるようにした
authorgdkhd812 <test@yahoo.co.jp>
Sun, 14 May 2017 04:46:11 +0000 (13:46 +0900)
committergdkhd812 <test@yahoo.co.jp>
Sun, 14 May 2017 04:46:11 +0000 (13:46 +0900)
UWP/FooEditEngine.UWP/FooTextBox.cs

index f0c65b1..7b0578b 100644 (file)
@@ -1079,20 +1079,29 @@ namespace FooEditEngine.UWP
             }
         }
 
+        long lastDouleTapTick;
+        const long allowTripleTapTimeSpan = 500;
         void gestureRecongnizer_Tapped(GestureRecognizer sender, TappedEventArgs e)
         {
             bool touched = e.PointerDeviceType == PointerDeviceType.Touch;
             this.Document.SelectGrippers.BottomLeft.Enabled = false;
             this.Document.SelectGrippers.BottomRight.Enabled = touched;
             this.JumpCaret(e.Position);
-            if(e.TapCount == 2)
+            if(e.TapCount == 1 && System.DateTime.Now.Ticks - lastDouleTapTick < allowTripleTapTimeSpan * 10000)    //トリプルタップ
             {
-                //タッチスクリーンでトリプルタップした場合、アンカーインデックスを単語の先頭にしないとバグる
+                //タッチスクリーンで行選択した場合、アンカーインデックスを単語の先頭にしないとバグる
+                this.Document.SelectGrippers.BottomLeft.Enabled = touched;
+                this.Document.SelectLine(this.Controller.SelectionStart, touched);
+            }
+            else  if(e.TapCount == 2)   //ダブルタップ
+            {
+                //タッチスクリーンで単語選択した場合、アンカーインデックスを単語の先頭にしないとバグる
                 this.Document.SelectGrippers.BottomLeft.Enabled = touched;
                 if (e.Position.X < this.Render.TextArea.X)
                     this.Document.SelectLine(this.Controller.SelectionStart, touched);
                 else
                     this.Document.SelectWord(this.Controller.SelectionStart, touched);
+                this.lastDouleTapTick = System.DateTime.Now.Ticks;
                 this.Refresh();
             }
         }