forked from fluffy-mods/WorkTab
-
Notifications
You must be signed in to change notification settings - Fork 0
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 fluffy-mods#201 from sineme/1.4
Fix horizontal scroll area
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using RimWorld; | ||
using RimWorld.BaseGen; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace WorkTab.Extensions { | ||
internal static class PawnTable_Extensions { | ||
private static ConditionalWeakTable<PawnTable, StrongBox<Rect>> outRectDictionary=new ConditionalWeakTable<PawnTable, StrongBox<Rect>>(); | ||
/// <summary> | ||
/// Sets the rectangle the <see cref="PawnTable"/> is drawn in. | ||
/// </summary> | ||
/// <param name="pawnTable">The <see cref="PawnTable"/> being extended.</param> | ||
/// <param name="outRect">The rectangle the <see cref="PawnTable"/> will be drawn in.</param> | ||
internal static void set_OutRect(this PawnTable pawnTable, Rect outRect) { | ||
var value = outRectDictionary.GetValue( | ||
pawnTable, | ||
a => new StrongBox<Rect>(outRect) | ||
); | ||
value.Value = outRect; | ||
} | ||
/// <summary> | ||
/// Gets the rectangle the <see cref="PawnTable"/> will be drawn in. | ||
/// </summary> | ||
/// <param name="pawnTable">The <see cref="PawnTable"/> being extended.</param> | ||
/// <returns>The rectangle the <see cref="PawnTable"/> will be drawn in.</returns> | ||
internal static Rect get_OutRect(this PawnTable pawnTable) { | ||
return outRectDictionary.GetOrCreateValue(pawnTable).Value; | ||
} | ||
} | ||
} |
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