Skip to content

Commit

Permalink
improve assertion message, #150
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Mar 29, 2024
1 parent 9c63e09 commit cfd3261
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions js/common/view/FELScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export default class FELScreenView extends ScreenView {
} );

this.fieldMeterNode = new FieldMeterNode( options.fieldMeter, {
dragBoundsProperty: this.visibleBoundsProperty,
tandem: options.tandem.createTandem( 'fieldMeterNode' )
} );
dragBoundsProperty: this.visibleBoundsProperty,
tandem: options.tandem.createTandem( 'fieldMeterNode' )
} );

this.resetAllButton = new ResetAllButton( {
listener: () => {
Expand Down Expand Up @@ -156,11 +156,12 @@ export default class FELScreenView extends ScreenView {
if ( isLockedToAxis ) {
// Dragging is locked to 1D, horizontally along the pickup coil's axis.

// Move the pickup coil and magnet to a usable position, which we assume is their initial position.
pickupCoilPositionProperty.reset();
// Move the magnet and pickup coil a usable position, which we assume is their initial position.
magnetPositionProperty.reset();
assert && assert( pickupCoilPositionProperty.value.y === magnetPositionProperty.value.y,
'magnet and pickup coil must have the same initial y coordinate' );
pickupCoilPositionProperty.reset();
assert && assert( magnetPositionProperty.value.y === pickupCoilPositionProperty.value.y,
'Lock to Axis feature requires the magnet and pickup coil to have the same y coordinate: ' +
`magnet.y=${magnetPositionProperty.value.y} !== pickupCoil.y=${pickupCoilPositionProperty.value.y}` );
const y = pickupCoilPositionProperty.value.y;

// Constrain to horizontal dragging.
Expand Down

0 comments on commit cfd3261

Please sign in to comment.