-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/spacers
- Loading branch information
Showing
16 changed files
with
533 additions
and
357 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using LemonUI.Extensions; | ||
using System.Drawing; | ||
using LemonUI.Tools; | ||
|
||
namespace LemonUI.Elements | ||
{ | ||
|
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 |
---|---|---|
@@ -1,53 +1,36 @@ | ||
using System; | ||
|
||
namespace LemonUI.Extensions | ||
{ | ||
/// <summary> | ||
/// Extensions for the float class. | ||
/// </summary> | ||
[Obsolete("Please use LemonUI.Tools.Extensions instead.", true)] | ||
public static class FloatExtensions | ||
{ | ||
#region Extensions | ||
|
||
/// <summary> | ||
/// Converts an absolute X or Width float to a relative one. | ||
/// Converts a scaled X or Width float to a relative one. | ||
/// </summary> | ||
/// <param name="fin">The float to convert.</param> | ||
/// <returns>A relative float between 0 and 1.</returns> | ||
public static float ToXRelative(this float fin) | ||
{ | ||
Screen.ToRelative(fin, 0, out float fout, out _); | ||
return fout; | ||
} | ||
public static float ToXRelative(this float fin) => Tools.Extensions.ToXRelative(fin); | ||
/// <summary> | ||
/// Converts an absolute Y or Height float to a relative one. | ||
/// Converts a scaled Y or Height float to a relative one. | ||
/// </summary> | ||
/// <param name="fin">The float to convert.</param> | ||
/// <returns>A relative float between 0 and 1.</returns> | ||
public static float ToYRelative(this float fin) | ||
{ | ||
Screen.ToRelative(0, fin, out _, out float fout); | ||
return fout; | ||
} | ||
public static float ToYRelative(this float fin) => Tools.Extensions.ToYRelative(fin); | ||
/// <summary> | ||
/// Converts an relative X or Width float to an absolute one. | ||
/// Converts an relative X or Width float to an scaled one. | ||
/// </summary> | ||
/// <param name="fin">The float to convert.</param> | ||
/// <returns>An absolute float.</returns> | ||
public static float ToXAbsolute(this float fin) | ||
{ | ||
Screen.ToAbsolute(fin, 0, out float fout, out _); | ||
return fout; | ||
} | ||
/// <returns>A scaled float.</returns> | ||
public static float ToXAbsolute(this float fin) => Tools.Extensions.ToXScaled(fin); | ||
/// <summary> | ||
/// Converts an relative Y or Height float to an absolute one. | ||
/// Converts an relative Y or Height float to an scaled one. | ||
/// </summary> | ||
/// <param name="fin">The float to convert.</param> | ||
/// <returns>An absolute float.</returns> | ||
public static float ToYAbsolute(this float fin) | ||
{ | ||
Screen.ToAbsolute(0, fin, out _, out float fout); | ||
return fout; | ||
} | ||
|
||
#endregion | ||
/// <returns>A scaled float.</returns> | ||
public static float ToYAbsolute(this float fin) => Tools.Extensions.ToYScaled(fin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,35 +1,25 @@ | ||
using System; | ||
using System.Drawing; | ||
|
||
namespace LemonUI.Extensions | ||
{ | ||
/// <summary> | ||
/// Extensions for the Point and PointF classes. | ||
/// </summary> | ||
[Obsolete("Please use LemonUI.Tools.Extensions instead.", true)] | ||
public static class PointExtensions | ||
{ | ||
#region Extensions | ||
|
||
/// <summary> | ||
/// Converts an absolute 1080-based position into a relative one. | ||
/// Converts a scaled 1080-based position into a relative one. | ||
/// </summary> | ||
/// <param name="point">The absolute PointF.</param> | ||
/// <param name="point">The scaled PointF.</param> | ||
/// <returns>A new PointF with relative values.</returns> | ||
public static PointF ToRelative(this PointF point) | ||
{ | ||
Screen.ToRelative(point.X, point.Y, out float x, out float y); | ||
return new PointF(x, y); | ||
} | ||
public static PointF ToRelative(this PointF point) => Tools.Extensions.ToRelative(point); | ||
/// <summary> | ||
/// Converts a normalized 0-1 position into an absolute one. | ||
/// Converts a normalized 0-1 position into a scaled one. | ||
/// </summary> | ||
/// <param name="point">The relative PointF.</param> | ||
/// <returns>A new PointF with absolute values.</returns> | ||
public static PointF ToAbsolute(this PointF point) | ||
{ | ||
Screen.ToAbsolute(point.X, point.Y, out float x, out float y); | ||
return new PointF(x, y); | ||
} | ||
|
||
#endregion | ||
/// <returns>A new PointF with scaled values.</returns> | ||
public static PointF ToAbsolute(this PointF point) => Tools.Extensions.ToScaled(point); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,35 +1,25 @@ | ||
using System; | ||
using System.Drawing; | ||
|
||
namespace LemonUI.Extensions | ||
{ | ||
/// <summary> | ||
/// Extensions for the Size and SizeF classes. | ||
/// </summary> | ||
[Obsolete("Please use LemonUI.Tools.Extensions instead.", true)] | ||
public static class SizeExtensions | ||
{ | ||
#region Extensions | ||
|
||
/// <summary> | ||
/// Converts an absolute 1080-based size into a relative one. | ||
/// Converts a scaled 1080-based size into a relative one. | ||
/// </summary> | ||
/// <param name="size">The absolute SizeF.</param> | ||
/// <param name="size">The scaled SizeF.</param> | ||
/// <returns>A new SizeF with relative values.</returns> | ||
public static SizeF ToRelative(this SizeF size) | ||
{ | ||
Screen.ToRelative(size.Width, size.Height, out float width, out float height); | ||
return new SizeF(width, height); | ||
} | ||
public static SizeF ToRelative(this SizeF size) => Tools.Extensions.ToRelative(size); | ||
/// <summary> | ||
/// Converts a normalized 0-1 size into an absolute one. | ||
/// Converts a normalized 0-1 size into a scaled one. | ||
/// </summary> | ||
/// <param name="size">The relative SizeF.</param> | ||
/// <returns>A new SizeF with absolute values.</returns> | ||
public static SizeF ToAbsolute(this SizeF size) | ||
{ | ||
Screen.ToAbsolute(size.Width, size.Height, out float width, out float height); | ||
return new SizeF(width, height); | ||
} | ||
|
||
#endregion | ||
/// <returns>A new SizeF with scaled values.</returns> | ||
public static SizeF ToAbsolute(this SizeF size) => Tools.Extensions.ToScaled(size); | ||
} | ||
} |
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
Oops, something went wrong.