-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from James-LG/james/margin
feat: Add per-application margin settings
- Loading branch information
Showing
8 changed files
with
140 additions
and
30 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/AutoCursorLock.App/Models/BorderDimensionsExtensions.cs
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,29 @@ | ||
// Copyright (c) James La Novara-Gsell. All Rights Reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
namespace AutoCursorLock.App.Models; | ||
|
||
using AutoCursorLock.Native; | ||
using AutoCursorLock.Sdk.Models; | ||
|
||
/// <summary> | ||
/// Extensions for <see cref="BorderDimensions"/>. | ||
/// </summary> | ||
internal static class BorderDimensionsExtensions | ||
{ | ||
/// <summary> | ||
/// Applies a margin to the border dimensions. | ||
/// </summary> | ||
/// <param name="dimensions">The dimensions to adjust.</param> | ||
/// <param name="margin">The margin to apply.</param> | ||
/// <returns>The adjusted dimensions.</returns> | ||
public static BorderDimensions ApplyMargin(this BorderDimensions dimensions, AppLockMargin margin) | ||
{ | ||
return new BorderDimensions( | ||
dimensions.Top + margin.Top, | ||
dimensions.Bottom - margin.Bottom, | ||
dimensions.Left + margin.Left, | ||
dimensions.Right - margin.Right | ||
); | ||
} | ||
} |
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
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,18 @@ | ||
// Copyright (c) James La Novara-Gsell. All Rights Reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
namespace AutoCursorLock.Sdk.Models; | ||
|
||
/// <summary> | ||
/// Represents the margin around a window for an app lock. | ||
/// </summary> | ||
/// <param name="Left">The left-side margin.</param> | ||
/// <param name="Top">The top-side margin.</param> | ||
/// <param name="Right">The right-side margin.</param> | ||
/// <param name="Bottom">THe bottom-side margin.</param> | ||
public record AppLockMargin( | ||
int Left, | ||
int Top, | ||
int Right, | ||
int Bottom | ||
); |
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