phetsims / geometric-optics

Geometric Optics is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 5 forks source link

Missing dependencies for DerivedProperties #486

Closed pixelzoom closed 10 months ago

pixelzoom commented 11 months ago

Discovered in https://github.com/phetsims/axon/issues/441 ...

    this.opacityProperty = new DerivedProperty( [ this.indexOfRefractionProperty ],
      indexOfRefraction => {

        // Use the indirect model's IOR range in all cases, because the direct model's IOR is fixed.
        phet.skipit = true;
        const range = this.indirectFocalLengthModel.indexOfRefractionProperty.range;
        phet.skipit = false;
        return Utils.linear( range.min, range.max, 0.2, 1, indexOfRefraction );
      } );
    this.transmittedAngleProperty = new DerivedProperty(
      [ optic.focalLengthProperty, optic.diameterProperty, this.incidentAngleProperty ],
...
        const deflectedAngle = ( optic.opticSurfaceTypeProperty.value === 'convex' ) ?
    const positionAndDiameterProperty = new DerivedProperty(
      [ optic.positionProperty, optic.diameterProperty, projectionScreen.positionProperty, lightObjectPositionProperty, opticalImagePositionProperty ],
      ( opticPosition, opticDiameter, projectionScreenPosition, lightObjectPosition, opticalImagePosition ) =>
        getPositionAndDiameter( optic, projectionScreenPosition, lightObjectPosition, opticalImagePosition )
    );
    this.intensityProperty = new DerivedProperty( [ this.diameterProperty, optic.diameterProperty ],
...
          const opticDiameterRange = optic.diameterProperty.range;
    const dragBoundsProperty = new DerivedProperty(
      [ sceneBoundsProperty, objectDragModeProperty ],
...
        const maxX = optic.positionProperty.value.x - GOConstants.MIN_DISTANCE_FROM_OBJECT_TO_OPTIC;
...
          minY = Math.max( sceneBounds.minY, optic.positionProperty.value.x - ArrowObject.MAX_MAGNITUDE );
          maxY = Math.min( sceneBounds.maxY, optic.positionProperty.value.x + ArrowObject.MAX_MAGNITUDE );
...
          minY = arrowObject.positionProperty.value.y;
          maxY = arrowObject.positionProperty.value.y;
const dragBoundsProperty = new DerivedProperty(
      [ htmlImageElementObject.boundsProperty, sceneBoundsProperty, objectDragModeProperty ],
...
        const htmlImageElementObjectPosition = htmlImageElementObject.positionProperty.value;
...
        const maxX = Math.floor( opticPositionProperty.value.x - GOConstants.MIN_DISTANCE_FROM_OBJECT_TO_OPTIC );
    const opticalAxisLabelPositionProperty = new DerivedProperty(
      [ optic.positionProperty, modelVisibleBoundsProperty ],
      ( opticPosition, modelVisibleBounds ) => {
        const modelXOffset = zoomTransformProperty.value.viewToModelDeltaX( 10 );
        return new Vector2( modelVisibleBounds.x + modelXOffset, opticPosition.y );
      } );
pixelzoom commented 11 months ago

In https://github.com/phetsims/geometric-optics/commit/84b714a9c46de2439f9df38acc747f7931404e21, @samreid added accessNonDependencies: true to temporarily silence these problems.

pixelzoom commented 10 months ago

One case remaining, positionAndDiameterProperty in LightSpot.

pixelzoom commented 10 months ago

All occurrences of accessNonDependencies have been addressed. Closing.