-
Notifications
You must be signed in to change notification settings - Fork 9
[nad-viewer] create style and footer for legends generated from metadata #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1879,12 +1879,18 @@ export class NetworkAreaDiagramViewer { | |
| newBusLegendElement.classList.add(cls); | ||
| }); | ||
| newBusLegendElement.classList.add('nad-legend-square'); | ||
|
|
||
| if (busNode.style) { | ||
| newBusLegendElement.setAttribute('style', busNode.style); | ||
| } | ||
| const textNode = document.createTextNode(busNode.legend ?? ''); | ||
| newBusDivElement?.appendChild(newBusLegendElement); | ||
| newBusDivElement?.appendChild(textNode); | ||
| newDivElement.appendChild(newBusDivElement); | ||
| } | ||
| node.legendFooter?.forEach((footer) => { | ||
| newDivElement.appendChild(this.createTextHeader(footer)); | ||
| }); | ||
|
Comment on lines
+1890
to
+1892
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the same thing as for legendHeader a bit above, line 1866
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback. It’s only used in those two places, I think it’s probably not worth extracting a helper for just those two lines that are involved. Why shouldn’t I put the footer after the loop on the nodes? A footer belongs at the bottom, don't you think? |
||
|
|
||
| return newTextElement; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createLegendBox is private. Do we need a public constructor, or is it usual in typescript to test private methods like that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it is an acceptable way to test a private method (note also that the very same approach is already used by PR 430 )