Skip to content

Commit

Permalink
fix display of documentation browser with display scaling. (#10600) (#…
Browse files Browse the repository at this point in the history
…10610)

* inject dpi adapt js functions
call functions when dpi changes in wpf
update html files with embedded images
update html with smaller font.

* remove hardcoded widths
inject global image styles
fix issues with urls

* dont inject style for all pages

* update test

* new test
  • Loading branch information
mjkkirschner authored Apr 27, 2020
1 parent 8a638a1 commit 79839be
Show file tree
Hide file tree
Showing 38 changed files with 218 additions and 114 deletions.

Large diffs are not rendered by default.

26 changes: 16 additions & 10 deletions src/DocumentationBrowserViewExtension/Docs/CustomNodeNotLoaded.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/DocumentationBrowserViewExtension/Docs/Deprecated.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
25 changes: 15 additions & 10 deletions src/DocumentationBrowserViewExtension/Docs/ExcelNotInstalled.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
There are two versions of this HTML file. One that is part of the Dynamo Dictionary
codebase and one that is part of the Dynamo codebase, used for displaying additional
error information in the Dynamo side panel.
Expand All @@ -19,7 +19,7 @@
<style>
body {
color: white;
font-size: 20px;
font-size: 14px;
font-family: "Artifakt Element";
src: url("fonts/ArtifaktElement-Regular.woff") format("woff");
padding: 1%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Dynamo.Logging;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -31,8 +32,22 @@ public DocumentationBrowserView(DocumentationBrowserViewModel viewModel)
// handle browser component events & disable certain features that are not needed
this.documentationBrowser.AllowDrop = false;
this.documentationBrowser.Navigating += ShouldAllowNavigation;
this.documentationBrowser.DpiChanged += DocumentationBrowser_DpiChanged;
}

private void DocumentationBrowser_DpiChanged(object sender, DpiChangedEventArgs args)
{
try
{
// it's possible we're trying to invoke this before the adaptDPI function is
// injected into the script scope, wrap this in a try catch.
documentationBrowser.InvokeScript("adaptDPI()");
}
catch (Exception e)
{
viewModel.MessageLogged?.Invoke(LogMessage.Info($"failed to set DPI,{e.Message}"));
}
}
/// <summary>
/// Redirect the user to the browser if they press a link in the documentation browser
/// </summary>
Expand Down Expand Up @@ -84,6 +99,7 @@ public void Dispose()
this.viewModel.LinkChanged -= NavigateToPage;
this.documentationBrowser.Navigating -= ShouldAllowNavigation;
this.documentationBrowser.Dispose();
this.documentationBrowser.DpiChanged -= DocumentationBrowser_DpiChanged;
}
}
}
Loading

0 comments on commit 79839be

Please sign in to comment.