From df92fc61608ba303618008300f45343c3d095c6b Mon Sep 17 00:00:00 2001 From: jbphet Date: Tue, 31 Jan 2023 15:35:07 -0700 Subject: [PATCH] improve handling of max width for concentration data, see https://github.com/phetsims/greenhouse-effect/issues/246#issuecomment-1408841837 (cherry picked from commit 3fca466534a7f2bc888cdef69d41e30ea42e4c53) --- js/common/view/ConcentrationControlPanel.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/common/view/ConcentrationControlPanel.ts b/js/common/view/ConcentrationControlPanel.ts index 2ff60904..5bb6397a 100644 --- a/js/common/view/ConcentrationControlPanel.ts +++ b/js/common/view/ConcentrationControlPanel.ts @@ -154,7 +154,7 @@ class ConcentrationControlPanel extends Panel { let compositionDataNode: CompositionDataNode | null = null; if ( options.includeCompositionData ) { - compositionDataNode = new CompositionDataNode( concentrationModel.dateProperty ); + compositionDataNode = new CompositionDataNode( concentrationModel.dateProperty, width ); contentChildren.push( compositionDataNode ); } @@ -422,11 +422,11 @@ class ConcentrationSlider extends VBox { class CompositionDataNode extends VBox { - public constructor( dateProperty: EnumerationProperty ) { + public constructor( dateProperty: EnumerationProperty, panelWidth: number ) { const textOptions = { font: GreenhouseEffectConstants.CONTENT_FONT, - maxWidth: 200 + maxWidth: panelWidth - 2 * PANEL_MARGINS }; // Set up the data and text that will be used for the concentration display. Note that H2O is handled as a special