This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display Up/Down arrow when scrolling. **New options added in Settings/Overlays/Mouse:** - Display Scroll - Scroll Circle Color - Scroll Arrow Color fixes #480 #### Known Issues - Horizontal scroll is displayed incorrectly as vertical scroll. The MouseKeyHook library doesn't tell whether the scroll was vertical or horizontal. - Some touchpad scrolls may not be detected. This is an issue with how the touchpad drivers work. I can't really do much about that.
- Loading branch information
1 parent
d778ae4
commit b0cc467
Showing
6 changed files
with
144 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
using Captura.Video; | ||
|
||
namespace Captura.MouseKeyHook | ||
{ | ||
// TODO: Shows horizontal scroll incorrectly as vertical. | ||
// The MouseKeyHook library doesn't provide an option | ||
// to distinguish between horizontal and vertical scrolls. | ||
public class ScrollOverlay : IOverlay | ||
{ | ||
readonly MouseClickSettings _settings; | ||
MouseEventArgs _lastArgs; | ||
|
||
public ScrollOverlay(IMouseKeyHook Hook, | ||
MouseClickSettings Settings) | ||
{ | ||
_settings = Settings; | ||
|
||
Hook.MouseWheel += (S, E) => _lastArgs = E; | ||
} | ||
|
||
public void Dispose() { } | ||
|
||
public void Draw(IEditableFrame Editor, Func<Point, Point> PointTransform = null) | ||
{ | ||
if (!_settings.DisplayScroll) | ||
return; | ||
|
||
if (_lastArgs is { } args) | ||
{ | ||
var p = args.Location; | ||
var r = _settings.Radius; | ||
var d = 2 * r; | ||
|
||
Editor.FillEllipse(_settings.ScrollCircleColor, new RectangleF(p.X - r, p.Y - r, d, d)); | ||
|
||
var above = new Point(p.X, p.Y + r / 2); | ||
var below = new Point(p.X, p.Y - r / 2); | ||
|
||
// Scroll down | ||
if (args.Delta < 0) | ||
{ | ||
(above, below) = (below, above); | ||
} | ||
|
||
Editor.DrawArrow(above, below, _settings.ScrollArrowColor, r / 4f); | ||
|
||
_lastArgs = null; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters