From adfc4f2e8192d56056fdff8417a95affc00d2023 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Tue, 28 Sep 2021 17:07:07 -0600 Subject: [PATCH] encapsulate prevent:true workaround, https://github.com/phetsims/ph-scale/issues/226 --- js/common/PHScaleConstants.js | 8 +++++++- js/micro/view/MicroScreenView.js | 6 ------ js/mysolution/view/MySolutionScreenView.js | 6 ------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/js/common/PHScaleConstants.js b/js/common/PHScaleConstants.js index a52a65a2..f5ed4d24 100644 --- a/js/common/PHScaleConstants.js +++ b/js/common/PHScaleConstants.js @@ -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: { diff --git a/js/micro/view/MicroScreenView.js b/js/micro/view/MicroScreenView.js index f6e7c3cc..367afaa6 100644 --- a/js/micro/view/MicroScreenView.js +++ b/js/micro/view/MicroScreenView.js @@ -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(); diff --git a/js/mysolution/view/MySolutionScreenView.js b/js/mysolution/view/MySolutionScreenView.js index cdee6437..8bba0eef 100644 --- a/js/mysolution/view/MySolutionScreenView.js +++ b/js/mysolution/view/MySolutionScreenView.js @@ -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();