From 9cfe8ef5c3596078d52ea985d450da3a67ad4dbb Mon Sep 17 00:00:00 2001 From: Anton Mukhin Date: Tue, 3 Jun 2025 11:30:12 +0300 Subject: [PATCH] Version changed to 2.5; TODO feature: Straight line painting (hold Shift / Ctrl) --- McBitFont/Form1.cs | 18 ++++++++++++++---- McBitFont/McBitFont.csproj | 6 +++--- TODO.txt | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index 2114a0c..edca56b 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -416,10 +416,11 @@ namespace McBitFont { dotPanel.Refresh(); } - private bool mouseDown = false; - private bool fChanged = false; - private bool mouseDownMiddle = false; - private int mouseX, mouseY; + private bool mouseDown = false; // Used in canvas history tracking and rectangle selection logics + private bool fChanged = false; // Used in canvas history (undo / redo) tracking + private bool mouseDownMiddle = false; // Used in middle mouse dragging logic + private int mouseX, mouseY; // To remember last mouse X and Y (used in middle mouse dragging logic) + private int lastX = 0, lastY = 0; // Used for drawing straight lines private void dotPanel_MouseMove(object sender, MouseEventArgs e) { var rectSel = chkRectSelect.Checked; bool rectSelUpdated = false; @@ -551,6 +552,15 @@ namespace McBitFont { return; } + // Check for Shift / Ctrl keys for straight lines + if (ModifierKeys.HasFlag(Keys.Shift)) { + j = lastY; + } else if (ModifierKeys.HasFlag(Keys.Control)) { + i = lastX; + } + lastX = i; + lastY = j; + // Paint black / white if (e.Button == MouseButtons.Left && !f.data[i, j]) { f.data[i, j] = true; diff --git a/McBitFont/McBitFont.csproj b/McBitFont/McBitFont.csproj index 126e4a8..a3b3b66 100644 --- a/McBitFont/McBitFont.csproj +++ b/McBitFont/McBitFont.csproj @@ -20,9 +20,9 @@ true true icon_64.ico - 2.4.0.0 - 2.4.0.0 - $(VersionPrefix)2.4.0 + 2.5.0.0 + 2.5.0.0 + $(VersionPrefix)2.5.0 Anton Mukhin diff --git a/TODO.txt b/TODO.txt index d1571b3..a493be2 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,7 +4,7 @@ Application: Functionality: V Middle mouse - drag the canvas -- Straight line painting +V Straight line painting (hold Shift / Ctrl) V A button to Copy from Test font dialog to then paste into another frame Bugs: