this.SystemEvents_UserPreferenceChanged(null, new UserPreferenceChangedEventArgs(UserPreferenceCategory.Keyboard));
this.CaretMoved += (s, e) => { };
+
+ this.IsManipulationEnabled = true;
}
/// <summary>
if (e.LeftButton == MouseButtonState.Pressed)
{
- this.Document.SelectWord(index);
+ this.Document.SelectWord((int)index);
this.textStore.NotifySelectionChanged();
if(this.peer != null)
this.peer.OnNotifyCaretChanged();
}
}
+ /// <inheritdoc/>
+ protected override void OnTouchDown(TouchEventArgs e)
+ {
+ var p = this.GetDipFromPoint(e.GetTouchPoint(this).Position);
+ TextPoint tp = this.View.GetTextPointFromPostion(p);
+ if (tp == TextPoint.Null)
+ return;
+ int index = this.View.LayoutLines.GetIndexFromTextPoint(tp);
+
+ FoldingItem foldingData = this.View.HitFoldingData(p.X, tp.row);
+ if (foldingData != null)
+ {
+ if (foldingData.Expand)
+ this.View.LayoutLines.FoldingCollection.Collapse(foldingData);
+ else
+ this.View.LayoutLines.FoldingCollection.Expand(foldingData);
+ this._Controller.JumpCaret(foldingData.Start, false);
+ }
+ else
+ {
+ this._Controller.JumpCaret(tp.row, tp.col, false);
+ }
+ if (this.peer != null)
+ this.peer.OnNotifyCaretChanged();
+ this.View.IsFocused = true;
+ this.Focus();
+ this.Refresh();
+ }
+
+ /// <inheritdoc/>
+ protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
+ {
+ Point translation = new Point(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
+
+ //Xの絶対値が大きければ横方向のスクロールで、そうでなければ縦方向らしい
+ if (Math.Abs(e.CumulativeManipulation.Translation.X) < Math.Abs(e.CumulativeManipulation.Translation.Y))
+ {
+ System.Diagnostics.Debug.WriteLine("tran y:{0}", translation.Y);
+ //下に動かした場合はマイナスの値が飛んでくる、上に動かした場合はプラスの値が飛んでくる
+ this.View.Scroll(this.Document.Src.X, this.Document.Src.Y - translation.Y);
+ this.View.IsFocused = false;
+ this.Refresh();
+ return;
+ }
+
+ int deltax = (int)Math.Abs(Math.Ceiling(translation.X));
+ if (deltax != 0)
+ {
+ if (translation.X < 0)
+ this._Controller.Scroll(ScrollDirection.Left, deltax, false, false);
+ else
+ this._Controller.Scroll(ScrollDirection.Right, deltax, false, false);
+ this.Refresh();
+ }
+ }
+
private Point GetDipFromPoint(Point p)
{
float dpi;