Skip to content

Commit

Permalink
Adjusting dialog scaling for #586 in branch dialog-scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Jul 28, 2020
1 parent 843533a commit 695644f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
7 changes: 1 addition & 6 deletions js/AboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ import VBox from '../../scenery/js/nodes/VBox.js';
import VStrut from '../../scenery/js/nodes/VStrut.js';
import Dialog from '../../sun/js/Dialog.js';
import CreditsNode from './CreditsNode.js';
import HomeScreenView from './HomeScreenView.js';
import joist from './joist.js';
import joistStrings from './joistStrings.js';
import packageJSON from './packageJSON.js';
import ScreenView from './ScreenView.js';
import updateCheck from './updateCheck.js';
import UpdateNodes from './UpdateNodes.js';
import UpdateState from './UpdateState.js';
Expand Down Expand Up @@ -232,10 +230,7 @@ class AboutDialog extends Dialog {
tandem: tandem,
phetioReadOnly: true, // the AboutDialog should not be settable
phetioState: true,
phetioDynamicElement: true,

//TODO workaround for https://github.com/phetsims/joist/issues/586 and https://github.com/phetsims/joist/issues/639
scale: HomeScreenView.LAYOUT_BOUNDS.width / ScreenView.DEFAULT_LAYOUT_BOUNDS.width
phetioDynamicElement: true
} );

// @private
Expand Down
4 changes: 2 additions & 2 deletions js/PhetButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ function PhetButton( sim, backgroundFillProperty, tandem ) {
Property.multilink( [ sim.boundsProperty, sim.screenBoundsProperty, sim.scaleProperty ],
( bounds, screenBounds, scale ) => {
if ( bounds && screenBounds && scale ) {
phetMenu.right = bounds.right / scale - 2 / scale;
phetMenu.right = bounds.right - 2;
const navBarHeight = bounds.height - screenBounds.height;
phetMenu.bottom = screenBounds.bottom / scale + navBarHeight / 2 / scale;
phetMenu.bottom = screenBounds.bottom + navBarHeight / 2;
}
} );

Expand Down
7 changes: 4 additions & 3 deletions js/Sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ function Sim( name, allSimScreens, options ) {

// Layout each of the screens
_.each( this.screens, m => m.view.layout( width, screenHeight ) );

// Resize the layer with all of the dialogs, etc.
this.topLayer.setScaleMagnitude( scale );
this.topLayer.children.forEach( child => child.layout && child.layout( width, screenHeight ) );

// Fixes problems where the div would be way off center on iOS7
if ( platform.mobileSafari ) {
Expand Down Expand Up @@ -764,6 +762,9 @@ inherit( Object, Sim, {
if ( isModal ) {
this.modalNodeStack.push( node );
}
if ( node.layout ) {
node.layout( this.screenBoundsProperty.value.width, this.screenBoundsProperty.value.height );
}
this.topLayer.addChild( node );
},

Expand Down

1 comment on commit 695644f

@pixelzoom
Copy link
Contributor

Choose a reason for hiding this comment

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

Please sign in to comment.