From 7e7e5bdd8b0970aef3eb9affb91d2bb9a713f490 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Wed, 16 Dec 2020 16:16:58 -0700 Subject: [PATCH] misc cleanup, https://github.com/phetsims/circuit-construction-kit-common/issues/620 --- js/MagnifyingGlassZoomButtonGroup.js | 2 +- js/PlusMinusZoomButtonGroup.js | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/js/MagnifyingGlassZoomButtonGroup.js b/js/MagnifyingGlassZoomButtonGroup.js index 942714c33..41493ff1f 100644 --- a/js/MagnifyingGlassZoomButtonGroup.js +++ b/js/MagnifyingGlassZoomButtonGroup.js @@ -26,7 +26,6 @@ class MagnifyingGlassZoomButtonGroup extends ZoomButtonGroup { } }, options ); - // plus or minus sign in middle of magnifying glass const signOptions = { size: new Dimension2( @@ -35,6 +34,7 @@ class MagnifyingGlassZoomButtonGroup extends ZoomButtonGroup { ) }; + assert && assert( !options.magnifyingGlassNodeOptions.icon, 'MagnifyingGlassZoomButtonGroup sets magnifyingGlassNodeOptions.icon' ); const zoomInIcon = new MagnifyingGlassNode( merge( {}, options.magnifyingGlassNodeOptions, { icon: new PlusNode( signOptions ) } ) ); const zoomOutIcon = new MagnifyingGlassNode( merge( {}, options.magnifyingGlassNodeOptions, { icon: new MinusNode( signOptions ) } ) ); super( zoomInIcon, zoomOutIcon, zoomLevelProperty, options ); diff --git a/js/PlusMinusZoomButtonGroup.js b/js/PlusMinusZoomButtonGroup.js index 5e3d4ab5d..1058e506b 100644 --- a/js/PlusMinusZoomButtonGroup.js +++ b/js/PlusMinusZoomButtonGroup.js @@ -10,7 +10,7 @@ import sceneryPhet from './sceneryPhet.js'; import ZoomButtonGroup from './ZoomButtonGroup.js'; // constants -const DEFAULT_SIZE = new Dimension2( 20 * 0.35, 3.6 * 0.35 ); +const DEFAULT_ICON_SIZE = new Dimension2( 7, 1.26 ); // chosen to match existing sim defaults /** * A ZoomButtonGroup that shows a "+" and "-" sign for the button icons. @@ -30,18 +30,16 @@ class PlusMinusZoomButtonGroup extends ZoomButtonGroup { yMargin: 10 }, iconOptions: { - size: DEFAULT_SIZE + size: DEFAULT_ICON_SIZE } }, options ); - // Make sure the + and - have the same dimensions - const alignGroup = new AlignGroup(); - const plusMinusNodeOptions = merge( { size: DEFAULT_SIZE }, options.iconOptions ); - const alignBoxOptions = { group: alignGroup }; + // To make the icons have the same effective size + const alignBoxOptions = { group: new AlignGroup() }; super( - new AlignBox( new PlusNode( plusMinusNodeOptions ), alignBoxOptions ), - new AlignBox( new MinusNode( plusMinusNodeOptions ), alignBoxOptions ), + new AlignBox( new PlusNode( options.iconOptions ), alignBoxOptions ), + new AlignBox( new MinusNode( options.iconOptions ), alignBoxOptions ), zoomLevelProperty, options ); }