Skip to content

Commit 547efee

Browse files
authored
Merge pull request #231 from tonyhallett/invoke-script-fontchanges-when-changed
prevent unnecessary invokeScript
2 parents 6a2822c + 5f41872 commit 547efee

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ internal partial class ReportGeneratorUtil : IReportGeneratorUtil
6969
private readonly Base64ReportImage downInactiveBase64ReportImage = new Base64ReportImage(".icon-down-dir", "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNDA4IDcwNHEwIDI2LTE5IDQ1bC00NDggNDQ4cS0xOSAxOS00NSAxOXQtNDUtMTlsLTQ0OC00NDhxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5aDg5NnEyNiAwIDQ1IDE5dDE5IDQ1eiIvPjwvc3ZnPg==");
7070
private readonly Base64ReportImage upActiveBase64ReportImage = new Base64ReportImage(".icon-up-dir_active", "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgd2lkdGg9IjE3OTIiIGhlaWdodD0iMTc5MiIgdmlld0JveD0iMCAwIDE3OTIgMTc5MiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA3OEQ0IiBkPSJNMTQwOCAxMjE2cTAgMjYtMTkgNDV0LTQ1IDE5aC04OTZxLTI2IDAtNDUtMTl0LTE5LTQ1IDE5LTQ1bDQ0OC00NDhxMTktMTkgNDUtMTl0NDUgMTlsNDQ4IDQ0OHExOSAxOSAxOSA0NXoiLz48L3N2Zz4=");
7171
private readonly IScriptManager scriptManager;
72-
72+
private string previousFontSizeName;
7373
private IReportColours reportColours;
7474
private JsThemeStyling jsReportColours;
7575
private IReportColours ReportColours
@@ -878,8 +878,14 @@ private string HackGroupingToAllowAll(int groupingLevel)
878878
879879
}
880880
881+
private string GetFontNameSize()
882+
{
883+
return $"{FontSize}{FontName}";
884+
}
885+
881886
public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFolder)
882887
{
888+
previousFontSizeName = GetFontNameSize();
883889
var previousLogMessages = $"[{string.Join(",",logs.Select(l => $"'{l}'"))}]";
884890
var appOptions = appOptionsProvider.Get();
885891
var namespacedClasses = appOptions.NamespacedClasses;
@@ -1601,7 +1607,10 @@ public async System.Threading.Tasks.Task EndOfCoverageRunAsync()
16011607

16021608
public void UpdateReportWithDpiFontChanges()
16031609
{
1604-
scriptManager.InvokeScript(FontChangedJSFunctionName, $"{FontName}:{FontSize}");
1610+
if (previousFontSizeName != GetFontNameSize())
1611+
{
1612+
scriptManager.InvokeScript(FontChangedJSFunctionName, $"{FontName}:{FontSize}");
1613+
}
16051614
}
16061615

16071616
//private string ToJsColour(System.Drawing.Color colour)

0 commit comments

Comments
 (0)