Skip to content

Commit

Permalink
Allow Changing FontSize by ctrl+mousewheel
Browse files Browse the repository at this point in the history
Added the ability to change fontsize by leftctrl+mousewheel
  • Loading branch information
JulienKluge committed Mar 9, 2015
1 parent c0e6c86 commit 8715ed6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions UI/Components/EditorElement.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ public void Save(bool Force = false)

public void UpdateFontSize(double size)
{
editor.FontSize = size;
StatusLine_FontSize.Text = size.ToString("n0") + " pt";
if (size > 2 && size < 31)
{
editor.FontSize = size;
StatusLine_FontSize.Text = size.ToString("n0") + " pt";
}
}

public async void Close(bool ForcedToSave = false, bool CheckSavings = true)
Expand Down Expand Up @@ -203,7 +206,14 @@ private void TextArea_SelectionChanged(object sender, EventArgs e)

private void PrevMouseWheel(object sender, MouseWheelEventArgs e)
{
editor.ScrollToVerticalOffset(editor.VerticalOffset - ((double)e.Delta * editor.FontSize * Program.OptionsObject.Editor_ScrollSpeed));
if (Keyboard.IsKeyDown(Key.LeftCtrl))
{
UpdateFontSize(editor.FontSize + Math.Sign(e.Delta));
}
else
{
editor.ScrollToVerticalOffset(editor.VerticalOffset - ((double)e.Delta * editor.FontSize * Program.OptionsObject.Editor_ScrollSpeed));
}
e.Handled = true;
HideISAC();
}
Expand Down

0 comments on commit 8715ed6

Please sign in to comment.