this._Controller = new Controller(this.Document, this.View);
this._Controller.SelectionChanged += Controller_SelectionChanged;
- this.FirstGripper = new GripperView(this._Controller, this.View, GripperPostion.BottomLeft);
- this.SecondGripper = new GripperView(this._Controller, this.View, GripperPostion.BottomRight);
-
this.gestureRecongnizer.GestureSettings = GestureSettings.Drag |
GestureSettings.RightTap |
GestureSettings.Tap |
SetValue(SelectionProperty, new TextRange(this._Controller.SelectionStart, this._Controller.SelectionLength));
SetValue(CaretPostionPropertyKey, this.View.CaretPostion);
this.nowCaretMove = false;
+ this.View.SelectGrippers[0].MoveByIndex(this.View, this.Controller.SelectionStart);
+ this.View.SelectGrippers[1].MoveByIndex(this.View, this.Controller.SelectionStart + this.Controller.SelectionLength);
if (this.textStore.IsLocked() == false)
this.textStore.NotifySelectionChanged();
}
- GripperView FirstGripper, SecondGripper;
bool HittedCaret;
GripperView hittedGripper;
private void gestureRecongnizer_ManipulationInertiaStarting(GestureRecognizer sender, ManipulationInertiaStartingEventArgs e)
void gestureRecongnizer_ManipulationStarted(GestureRecognizer sender, ManipulationStartedEventArgs e)
{
this.HittedCaret = false;
- this.hittedGripper = null;
Point p = e.Position;
TextPoint tp = this.View.GetTextPointFromPostion(p);
{
HittedCaret = true;
}
-
- if (this.FirstGripper.IsHit(p))
- {
- hittedGripper = this.FirstGripper;
- HittedCaret = true;
- System.Diagnostics.Debug.WriteLine("first gripper hitted");
- }
-
- else if (this.SecondGripper.IsHit(p))
+
+ this.hittedGripper = this.View.HitGripperFromPoint(e.Position);
+ if (this.hittedGripper != null)
{
- hittedGripper = this.SecondGripper;
- HittedCaret = true;
- System.Diagnostics.Debug.WriteLine("second gripper hitted");
+ this.HittedCaret = true;
}
}
TextPoint tp = this.View.GetTextPointFromPostion(p);
if (this._Controller.IsReverseSelect())
{
- if (Object.ReferenceEquals(hittedGripper,this.SecondGripper))
+ if (Object.ReferenceEquals(hittedGripper,this.View.SelectGrippers[1]))
this._Controller.MoveSelectBefore(tp);
else
this._Controller.MoveCaretAndSelect(tp);
}
else
{
- if (Object.ReferenceEquals(hittedGripper,this.FirstGripper))
+ if (Object.ReferenceEquals(hittedGripper, this.View.SelectGrippers[0]))
this._Controller.MoveSelectBefore(tp);
else
this._Controller.MoveCaretAndSelect(tp);
}
+ this.hittedGripper.Move(this.View, tp);
}
else
{
}
if (this.peer != null)
this.peer.OnNotifyCaretChanged();
- if (this._Controller.SelectionLength != 0)
- this.FirstGripper.Enabled = true;
- else
- this.FirstGripper.Enabled = false;
+ this.View.SelectGrippers[0].Enabled = this._Controller.SelectionLength != 0;
this.Refresh();
this._Controller.Scroll(ScrollDirection.Up, scrollCount, false, false);
else
this._Controller.Scroll(ScrollDirection.Down, scrollCount, false, false);
- this.FirstGripper.Enabled = false;
- this.SecondGripper.Enabled = false;
+ this.View.SelectGrippers[0].Enabled = false;
+ this.View.SelectGrippers[1].Enabled = false;
this.Refresh();
return;
}
this._Controller.Scroll(ScrollDirection.Left, deltax, false, false);
else
this._Controller.Scroll(ScrollDirection.Right, deltax, false, false);
- this.FirstGripper.Enabled = false;
- this.SecondGripper.Enabled = false;
+ this.View.SelectGrippers[0].Enabled = false;
+ this.View.SelectGrippers[1].Enabled = false;
this.Refresh();
}
}
void gestureRecongnizer_Tapped(GestureRecognizer sender, TappedEventArgs e)
{
bool touched = e.PointerDeviceType == PointerDeviceType.Touch;
- this.FirstGripper.Enabled = false;
- this.SecondGripper.Enabled = touched;
+ this.View.SelectGrippers[0].Enabled = false;
+ this.View.SelectGrippers[1].Enabled = touched;
this.JumpCaret(e.Position);
System.Diagnostics.Debug.WriteLine(e.TapCount);
if (e.TapCount == 2)
{
- this.FirstGripper.Enabled = touched;
+ this.View.SelectGrippers[0].Enabled = touched;
//タッチスクリーンでダブルタップした場合、アンカーインデックスを単語の先頭にしないとバグる
this.Controller.SelectWord(this.Controller.SelectionStart, touched);
}
this.View.Draw(updateRect);
else
this.Render.FillBackground(updateRect);
- this.FirstGripper.Draw();
- this.SecondGripper.Draw();
this.Render.EndDraw();
}
else
toX = -this.horizontalScrollBar.Value;
this._Controller.Scroll(toX, this.View.Src.Row, false, false);
- this.FirstGripper.Enabled = false;
- this.SecondGripper.Enabled = false;
+ this.View.SelectGrippers[0].Enabled = false;
+ this.View.SelectGrippers[1].Enabled = false;
this.Refresh();
}
if (newRow >= this.View.LayoutLines.Count)
return;
this._Controller.Scroll(this.View.Src.X, newRow, false, false);
- this.FirstGripper.Enabled = false;
- this.SecondGripper.Enabled = false;
+ this.View.SelectGrippers[0].Enabled = false;
+ this.View.SelectGrippers[1].Enabled = false;
this.Refresh();
}