this.SelectWithMoveCaret(isSelected);
}
- double noti;
/// <summary>
/// スクロールする
/// </summary>
/// <param name="delta">ピクセル単位の値でスクロール量を指定する</param>
/// <param name="isSelected">選択状態にするなら真</param>
/// <param name="withCaret">同時にキャレットを移動させるなら真</param>
- public void ScrollByPixel(ScrollDirection dir,int delta, bool isSelected, bool withCaret)
+ public void ScrollByPixel(ScrollDirection dir,double delta, bool isSelected, bool withCaret)
{
if (this.Document.FireUpdateEvent == false)
throw new InvalidOperationException("");
return;
}
- if(dir == ScrollDirection.Up || dir == ScrollDirection.Down)
+ if(dir == ScrollDirection.Up)
+ {
+ this.View.TryScroll(0, -delta);
+ }
+ else if (dir == ScrollDirection.Down)
{
- noti += delta;
-
- if (noti < this.View.render.emSize.Height)
- return;
-
- int delta_row = (int)(noti / this.View.render.emSize.Height + 1.0);
-
- noti = 0;
-
this.View.TryScroll(0, delta);
}
if (withCaret)
{
//カーソルを適切な位置に移動させる必要がある
+ TextPoint tp = this.View.GetTextPointFromPostion(this.View.CaretLocation);
+ this.View.JumpCaret(tp.row, tp.col);
this.View.AdjustCaretAndSrc();
this.SelectWithMoveCaret(isSelected);
}
if (autocomplete != null && autocomplete.ProcessKeyDown(this, e, isControlPressed, isShiftPressed))
return;
+ double alignedPage = (int)(this.Render.TextArea.Height / this.Render.emSize.Height) * this.Render.emSize.Height;
switch (e.Key)
{
case VirtualKey.Up:
isMovedCaret = true;
break;
case VirtualKey.PageUp:
- this._Controller.Scroll(ScrollDirection.Up, this._View.LineCountOnScreen, isShiftPressed, true);
+ this._Controller.ScrollByPixel(ScrollDirection.Up, alignedPage, isShiftPressed, true);
this.Refresh();
isMovedCaret = true;
break;
case VirtualKey.PageDown:
- this._Controller.Scroll(ScrollDirection.Down, this._View.LineCountOnScreen, isShiftPressed, true);
+ this._Controller.ScrollByPixel(ScrollDirection.Down, alignedPage, isShiftPressed, true);
this.Refresh();
isMovedCaret = true;
break;
}
bool movedCaret = false;
+ double alignedPage = (int)(this.Render.TextArea.Height / this.Render.emSize.Height) * this.Render.emSize.Height;
switch (e.Key)
{
case Key.Up:
movedCaret = true;
break;
case Key.PageUp:
- this._Controller.Scroll(ScrollDirection.Up,this._View.LineCountOnScreen, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift),true);
+ this._Controller.ScrollByPixel(ScrollDirection.Up, alignedPage, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift), true);
this.Refresh();
movedCaret = true;
break;
case Key.PageDown:
- this._Controller.Scroll(ScrollDirection.Down,this._View.LineCountOnScreen, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift),true);
+ this._Controller.ScrollByPixel(ScrollDirection.Down, alignedPage, this.IsPressedModifierKey(modiferKeys, ModifierKeys.Shift), true);
this.Refresh();
movedCaret = true;
break;
if (e.Handled)
return;
+ double alignedPage = (int)(this.render.TextArea.Height / this.render.emSize.Height) * this.render.emSize.Height;
switch (e.KeyCode)
{
case Keys.Up:
this.Refresh();
break;
case Keys.PageUp:
- this.Controller.Scroll(ScrollDirection.Up, this.VScrollBar.LargeChange,e.Shift,true);
+ this.Controller.ScrollByPixel(ScrollDirection.Up, alignedPage,e.Shift,true);
this.Refresh();
break;
case Keys.PageDown:
- this.Controller.Scroll(ScrollDirection.Down, this.VScrollBar.LargeChange,e.Shift,true);
+ this.Controller.ScrollByPixel(ScrollDirection.Down, alignedPage, e.Shift, true);
this.Refresh();
break;
case Keys.Insert: