refactor: pull out constant

This commit is contained in:
Anna 2024-02-18 00:28:51 -05:00
parent 25d156c20f
commit ff5d3100be
Signed by: anna
GPG Key ID: D0943384CD9F87D1
1 changed files with 3 additions and 2 deletions

View File

@ -16,6 +16,7 @@ internal class PluginUi : IDisposable {
internal bool Visible;
private const int RefreshSeconds = 5;
private readonly Stopwatch _metaUpdate = Stopwatch.StartNew();
internal PluginUi(Plugin plugin) {
@ -47,7 +48,7 @@ internal class PluginUi : IDisposable {
return;
}
if (this._metaUpdate.Elapsed >= TimeSpan.FromSeconds(5)) {
if (this._metaUpdate.Elapsed >= TimeSpan.FromSeconds(RefreshSeconds)) {
this.Metadata = ScreenshotMetadata.Capture(this.Plugin);
this._metaUpdate.Restart();
@ -113,7 +114,7 @@ internal class PluginUi : IDisposable {
}
ImGui.ProgressBar(
(float) (TimeSpan.FromSeconds(5) - this._metaUpdate.Elapsed).TotalSeconds / 5,
(float) (TimeSpan.FromSeconds(RefreshSeconds) - this._metaUpdate.Elapsed).TotalSeconds / RefreshSeconds,
new Vector2(-1, 1)
);