const int UpdateAreaPaddingWidth = 2;
const int UpdateAreaWidth = 4;
const int UpdateAreaTotalWidth = UpdateAreaWidth + UpdateAreaPaddingWidth;
- GripperView[] selectionGrippers = new GripperView[2];
/// <summary>
/// コンストラクター
this.HideLineMarker = true;
this.IsFocused = false;
this.Selections = new SelectCollection();
- this.selectionGrippers[0] = new GripperView(this.render);
- this.selectionGrippers[1] = new GripperView(this.render);
+ this.SelectGrippers = new GripperRectangle(new GripperView(this.render), new GripperView(this.render));
}
/// <summary>
/// <summary>
/// 選択範囲にあるグリッパーのリスト
/// </summary>
- public IList<GripperView> SelectGrippers
+ public GripperRectangle SelectGrippers
{
- get
- {
- return this.selectionGrippers;
- }
+ private set;
+ get;
}
/// <summary>
this.DrawCaret();
- foreach (GripperView gripper in this.selectionGrippers)
- gripper.Draw();
+ this.SelectGrippers.BottomLeft.Draw();
+ this.SelectGrippers.BottomRight.Draw();
}
void DrawUpdateArea(int row,double ypos)
public GripperView HitGripperFromPoint(Point p)
{
- for(int i = 0; i < this.selectionGrippers.Length; i++)
- {
- if (this.selectionGrippers[i].IsHit(p))
- {
- System.Diagnostics.Debug.WriteLine("gripper hitted number:{0}", i);
- return selectionGrippers[i];
- }
- }
+ if (this.SelectGrippers.BottomLeft.IsHit(p))
+ return this.SelectGrippers.BottomLeft;
+ if (this.SelectGrippers.BottomRight.IsHit(p))
+ return this.SelectGrippers.BottomRight;
return null;
}
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);
+ this.View.SelectGrippers.BottomLeft.MoveByIndex(this.View, this.Controller.SelectionStart);
+ this.View.SelectGrippers.BottomRight.MoveByIndex(this.View, this.Controller.SelectionStart + this.Controller.SelectionLength);
if (this.textStore.IsLocked() == false)
this.textStore.NotifySelectionChanged();
}
TextPoint tp = this.View.GetTextPointFromPostion(p);
if (this._Controller.IsReverseSelect())
{
- if (Object.ReferenceEquals(hittedGripper,this.View.SelectGrippers[1]))
+ if (Object.ReferenceEquals(hittedGripper,this.View.SelectGrippers.BottomRight))
this._Controller.MoveSelectBefore(tp);
else
this._Controller.MoveCaretAndSelect(tp);
}
else
{
- if (Object.ReferenceEquals(hittedGripper, this.View.SelectGrippers[0]))
+ if (Object.ReferenceEquals(hittedGripper, this.View.SelectGrippers.BottomLeft))
this._Controller.MoveSelectBefore(tp);
else
this._Controller.MoveCaretAndSelect(tp);
}
if (this.peer != null)
this.peer.OnNotifyCaretChanged();
- this.View.SelectGrippers[0].Enabled = this._Controller.SelectionLength != 0;
+ this.View.SelectGrippers.BottomLeft.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.View.SelectGrippers[0].Enabled = false;
- this.View.SelectGrippers[1].Enabled = false;
+ this.View.SelectGrippers.BottomLeft.Enabled = false;
+ this.View.SelectGrippers.BottomRight.Enabled = false;
this.Refresh();
return;
}
this._Controller.Scroll(ScrollDirection.Left, deltax, false, false);
else
this._Controller.Scroll(ScrollDirection.Right, deltax, false, false);
- this.View.SelectGrippers[0].Enabled = false;
- this.View.SelectGrippers[1].Enabled = false;
+ this.View.SelectGrippers.BottomLeft.Enabled = false;
+ this.View.SelectGrippers.BottomRight.Enabled = false;
this.Refresh();
}
}
void gestureRecongnizer_Tapped(GestureRecognizer sender, TappedEventArgs e)
{
bool touched = e.PointerDeviceType == PointerDeviceType.Touch;
- this.View.SelectGrippers[0].Enabled = false;
- this.View.SelectGrippers[1].Enabled = touched;
+ this.View.SelectGrippers.BottomLeft.Enabled = false;
+ this.View.SelectGrippers.BottomRight.Enabled = touched;
this.JumpCaret(e.Position);
System.Diagnostics.Debug.WriteLine(e.TapCount);
if (e.TapCount == 2)
{
- this.View.SelectGrippers[0].Enabled = touched;
+ this.View.SelectGrippers.BottomLeft.Enabled = touched;
//タッチスクリーンでダブルタップした場合、アンカーインデックスを単語の先頭にしないとバグる
this.Controller.SelectWord(this.Controller.SelectionStart, touched);
}
else
toX = -this.horizontalScrollBar.Value;
this._Controller.Scroll(toX, this.View.Src.Row, false, false);
- this.View.SelectGrippers[0].Enabled = false;
- this.View.SelectGrippers[1].Enabled = false;
+ this.View.SelectGrippers.BottomLeft.Enabled = false;
+ this.View.SelectGrippers.BottomRight.Enabled = false;
this.Refresh();
}
if (newRow >= this.View.LayoutLines.Count)
return;
this._Controller.Scroll(this.View.Src.X, newRow, false, false);
- this.View.SelectGrippers[0].Enabled = false;
- this.View.SelectGrippers[1].Enabled = false;
+ this.View.SelectGrippers.BottomLeft.Enabled = false;
+ this.View.SelectGrippers.BottomRight.Enabled = false;
this.Refresh();
}