Skip to content

Commit

Permalink
encapsulate prevent:true workaround, #226
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Sep 28, 2021
1 parent 314edb3 commit adfc4f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
8 changes: 7 additions & 1 deletion js/common/PHScaleConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ import phScale from '../phScale.js';
const PHScaleConstants = {

// ScreenView
SCREEN_VIEW_OPTIONS: { layoutBounds: new Bounds2( 0, 0, 1100, 700 ) },
SCREEN_VIEW_OPTIONS: {
layoutBounds: new Bounds2( 0, 0, 1100, 700 ),

// Workaround for things shifting around while dragging
// See https://github.com/phetsims/scenery/issues/1289 and https://github.com/phetsims/ph-scale/issues/226
preventFit: true
},

// Credits, shared by ph-scale and ph-scale-basics
CREDITS: {
Expand Down
6 changes: 0 additions & 6 deletions js/micro/view/MicroScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ class MicroScreenView extends ScreenView {
} );

const resetAllButton = new ResetAllButton( {

// preventFit was added as a workaround for https://github.com/phetsims/ph-scale/issues/226.
// Setting preventFit on any Node resolves a problem where some UI elements shift up and down
// while interacting with the sim. If layer splits are needed in the future and preventFit:true
// is added elsewhere, this workaround should be revisited, and you might be able to delete it.
preventFit: true,
scale: 1.32,
listener: () => {
this.interruptSubtreeInput();
Expand Down
6 changes: 0 additions & 6 deletions js/mysolution/view/MySolutionScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ class MySolutionScreenView extends ScreenView {
} );

const resetAllButton = new ResetAllButton( {

// preventFit was added as a workaround for https://github.com/phetsims/ph-scale/issues/226.
// Setting preventFit on any Node resolves a problem where some UI elements shift up and down
// while interacting with the sim. If layer splits are needed in the future and preventFit:true
// is added elsewhere, this workaround should be revisited, and you might be able to delete it.
preventFit: true,
scale: 1.32,
listener: () => {
this.interruptSubtreeInput();
Expand Down

0 comments on commit adfc4f2

Please sign in to comment.