Skip to content

Commit

Permalink
dynamic layout
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 22, 2024
1 parent 89935b2 commit 9fde43f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/common/view/ContinuumBarNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ export default class ContinuumBarNode extends Node {
} );

// 'Classical' at top
classicalText.centerX = barNode.centerX;
classicalText.top = barNode.top + options.yMargin;
classicalText.localBoundsProperty.link( () => {
classicalText.centerX = barNode.centerX;
classicalText.top = barNode.top + options.yMargin;
} );

// 'Quantum' at bottom
quantumText.centerX = barNode.centerX;
quantumText.bottom = barNode.bottom - options.yMargin;
quantumText.localBoundsProperty.link( () => {
quantumText.centerX = barNode.centerX;
quantumText.bottom = barNode.bottom - options.yMargin;
} );

options.children = [ barNode, classicalText, quantumText ];

Expand Down

1 comment on commit 9fde43f

@pixelzoom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#39

Please sign in to comment.