/// </remarks>
protected override void OnMouseDown(MouseButtonEventArgs e)
{
+ this.CaptureMouse();
+
var p = this.GetDipFromPoint(e.GetPosition(this));
TextPoint tp = this.View.GetTextPointFromPostion(p);
if (tp == TextPoint.Null)
}
/// <summary>
+ /// マウスのボタンが離されたときに呼ばれます
+ /// </summary>
+ /// <param name="e"></param>
+ protected override void OnMouseUp(MouseButtonEventArgs e)
+ {
+ this.ReleaseMouseCapture();
+ base.OnMouseUp(e);
+ }
+
+ /// <summary>
/// マウスが移動したときに呼ばれます
/// </summary>
/// <param name="e">イベントパラメーター</param>
/// </remarks>
protected override void OnMouseMove(MouseEventArgs e)
{
+ bool leftPressed = e.LeftButton == MouseButtonState.Pressed;
+
var p = this.GetDipFromPoint(e.GetPosition(this));
- TextPoint tp = this.View.GetTextPointFromPostion(p);
+
+ TextPointSearchRange searchRange;
+ if (this.View.HitTextArea(p.X, p.Y))
+ searchRange = TextPointSearchRange.TextAreaOnly;
+ else if (leftPressed)
+ searchRange = TextPointSearchRange.Full;
+ else
+ searchRange = TextPointSearchRange.TextAreaOnly;
+
+ TextPoint tp = this.View.GetTextPointFromPostion(p, searchRange);
+
if (tp == TextPoint.Null)
{
base.OnMouseMove(e);
return;
}
+
int index = this.View.GetIndexFromLayoutLine(tp);
FooMouseEventArgs newEventArgs = new FooMouseEventArgs(e.MouseDevice, e.Timestamp, e.StylusDevice, index);
if (newEventArgs.Handled)
return;
- if (this.View.HitTextArea(p.X,p.Y))
+ //この状態のときはカーソルがテキストエリア内にある
+ if (searchRange == TextPointSearchRange.TextAreaOnly)
{
if (this._Controller.IsMarker(tp, HilightType.Url))
this.Cursor = Cursors.Hand;
else
this.Cursor = Cursors.IBeam;
-
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- this._Controller.MoveCaretAndSelect(tp);
- if (this.peer != null)
- this.peer.OnNotifyCaretChanged();
- this.Refresh();
- }
}
else
{
this.Cursor = Cursors.Arrow;
}
+
+ if (leftPressed)
+ {
+ this._Controller.MoveCaretAndSelect(tp);
+ if (this.peer != null)
+ this.peer.OnNotifyCaretChanged();
+ this.Refresh();
+ }
}
Gripper hittedGripper;