Skip to content

Commit

Permalink
comment out some vibration code for now, see #104
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Sep 16, 2022
1 parent e89f61a commit e4fbb67
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 28 deletions.
4 changes: 2 additions & 2 deletions js/quadrilateral-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Sim, { SimOptions } from '../../joist/js/Sim.js';
import simLauncher from '../../joist/js/simLauncher.js';
import { Node } from '../../scenery/js/imports.js';
import Tandem from '../../tandem/js/Tandem.js';
import vibrationManager from '../../tappi/js/vibrationManager.js';
import HapticsInfoDialog from './common/HapticsInfoDialog.js';
import QuadrilateralQueryParameters from './quadrilateral/QuadrilateralQueryParameters.js';
import QuadrilateralScreen from './quadrilateral/QuadrilateralScreen.js';
Expand Down Expand Up @@ -97,5 +96,6 @@ simLauncher.launch( () => {
// Initialize the vibration manager. This is necessary because the vibration manager needs certain things from the
// sim object instance to complete its setup. If the vibration feature becomes widely used, this may be moved into
// Sim.js, but as of now (May 2022) we don't want Sim.js to have a dependency on this library.
vibrationManager.initialize( sim.browserTabVisibleProperty, sim.activeProperty );
// Removed for now until we return to this work, see https://github.com/phetsims/quadrilateral/issues/104
// vibrationManager.initialize( sim.browserTabVisibleProperty, sim.activeProperty );
} );
2 changes: 1 addition & 1 deletion js/quadrilateral/QuadrilateralQueryParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const QuadrilateralQueryParameters = QueryStringMachine.getAll( {
staticAngleToleranceInterval: {
type: 'number',
isValidValue: ( value: number ) => value <= ( 2 * Math.PI ) && value >= 0,
defaultValue: 0.001
defaultValue: Math.PI
},

// TODO: Do we need this 'widening' of the tolerance interval when connected to a device still?
Expand Down
4 changes: 2 additions & 2 deletions js/quadrilateral/view/QuadrilateralScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import SideLengthAreaNode from './SideLengthAreaNode.js';
import QuadrilateralVisibilityControls from './QuadrilateralVisibilityControls.js';
import QuadrilateralGridNode from './QuadrilateralGridNode.js';
import QuadrilateralScreenSummaryContentNode from './QuadrilateralScreenSummaryContentNode.js';
import vibrationManager from '../../../../tappi/js/vibrationManager.js';
import QuadrilateralAlerter from './QuadrilateralAlerter.js';
import QuadrilateralBluetoothConnectionButton from './QuadrilateralBluetoothConnectionButton.js';
import QuadrilateralPreferencesModel from '../model/QuadrilateralPreferencesModel.js';
Expand Down Expand Up @@ -370,7 +369,8 @@ class QuadrilateralScreenView extends ScreenView {

this.quadrilateralNode && this.quadrilateralNode.step( dt );

vibrationManager.step( dt );
// Removed for now, see https://github.com/phetsims/quadrilateral/issues/104
// vibrationManager.step( dt );
}
}

Expand Down
23 changes: 11 additions & 12 deletions js/quadrilateral/view/SideNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import QuadrilateralShapeModel from '../model/QuadrilateralShapeModel.js';
import QuadrilateralModel from '../model/QuadrilateralModel.js';
import { Line, Shape } from '../../../../kite/js/imports.js';
import QuadrilateralColors from '../../common/QuadrilateralColors.js';
import vibrationManager from '../../../../tappi/js/vibrationManager.js';
import SideDescriber from './SideDescriber.js';
import Multilink from '../../../../axon/js/Multilink.js';
import optionize from '../../../../phet-core/js/optionize.js';
Expand Down Expand Up @@ -277,17 +276,17 @@ class SideNode extends Voicing( Path ) {
// vibration
// TODO: This code for vibration is a prototype, and only vibrates for a finite time. It will need to be improved
// and finalized before publication. See https://github.com/phetsims/quake/issues/13.
side.isPressedProperty.lazyLink( isPressed => {

if ( navigator !== undefined && navigator.vibrate !== undefined ) {
if ( isPressed ) {
vibrationManager.startVibrate( [ 200, 200 ] );
}
else {
vibrationManager.stopVibrate();
}
}
} );
// side.isPressedProperty.lazyLink( isPressed => {
//
// if ( navigator !== undefined && navigator.vibrate !== undefined ) {
// if ( isPressed ) {
// vibrationManager.startVibrate( [ 200, 200 ] );
// }
// else {
// vibrationManager.stopVibrate();
// }
// }
// } );
}

/**
Expand Down
21 changes: 10 additions & 11 deletions js/quadrilateral/view/VertexNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Vector2 from '../../../../dot/js/Vector2.js';
import QuadrilateralModel from '../model/QuadrilateralModel.js';
import QuadrilateralColors from '../../common/QuadrilateralColors.js';
import PhetFont from '../../../../scenery-phet/js/PhetFont.js';
import vibrationManager from '../../../../tappi/js/vibrationManager.js';
import VertexDescriber from './VertexDescriber.js';
import { Shape } from '../../../../kite/js/imports.js';
import optionize from '../../../../phet-core/js/optionize.js';
Expand Down Expand Up @@ -179,16 +178,16 @@ class VertexNode extends Voicing( Circle ) {
this.voicingObjectResponse = vertexDescriber.getVertexObjectResponse();

// vibration
vertex.isPressedProperty.lazyLink( isPressed => {
if ( navigator !== undefined && navigator.vibrate !== undefined ) {
if ( isPressed ) {
vibrationManager.startRepeatingVibrationPattern( [ 75, 75 ] );
}
else {
vibrationManager.stopRepeatingVibrationPattern();
}
}
} );
// vertex.isPressedProperty.lazyLink( isPressed => {
// if ( navigator !== undefined && navigator.vibrate !== undefined ) {
// if ( isPressed ) {
// vibrationManager.startRepeatingVibrationPattern( [ 75, 75 ] );
// }
// else {
// vibrationManager.stopRepeatingVibrationPattern();
// }
// }
// } );

this.mutate( options );
}
Expand Down

0 comments on commit e4fbb67

Please sign in to comment.