Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Dec 16, 2020
1 parent 126c62a commit 7e7e5bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion js/MagnifyingGlassZoomButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class MagnifyingGlassZoomButtonGroup extends ZoomButtonGroup {
}
}, options );


// plus or minus sign in middle of magnifying glass
const signOptions = {
size: new Dimension2(
Expand All @@ -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 );
Expand Down
14 changes: 6 additions & 8 deletions js/PlusMinusZoomButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
);
}
Expand Down

0 comments on commit 7e7e5bd

Please sign in to comment.