phetsims / masses-and-springs-basics

"Masses and Springs: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 3 forks source link

Masses can be dragged behind springNodes and springHangerNode #4

Closed Denz1994 closed 5 years ago

Denz1994 commented 5 years ago

The mass should be the most forward node when dragging. Currently, we can produce this behavior: image

Denz1994 commented 5 years ago

Consider the below code from BounceScreenView.js

    // TODO: We are reinitializing this.springNodes. Is this the best way to handle this? Ask JO
    // @public {Array.<OscillatingSpringNode>} Initialize a new array of springNodes with a different color selection.
    this.springNodes = model.springs.map( function( spring ) {
      var springNode = new OscillatingSpringNode(
        spring,
        self.modelViewTransform,
        tandem.createTandem( 'oscillatingSpringNode' ), {
          leftEndLength: -10,
          frontColor: new Color('rgb( 227, 153, 221 )'),
          middleColor: new Color('rgb( 185, 0, 169 )'),
          backColor: new Color('rgb( 93, 0, 85 )')
        }
      );
      self.addChild( springNode );
      return springNode;
    } );
    this.springSystemControlsNode.moveToFront();

I will ask @jonathanolson for a closer look at this section during our next collab. We shouldn't have to redeclare our springNodes just because the colors are different in this one instance. Perhaps this is a limit of the current options implementation.

Denz1994 commented 5 years ago

The order of adding view components to the scene graph has changed. Please review @arouinfar for the above correction.

The masses should not be able to be dragged behind the springs or controls.

arouinfar commented 5 years ago

@Denz1994 the Stretch and Lab screens look good, but I'm still seeing this on Bounce:

screen shot 2018-10-10 at 3 02 04 pm
Denz1994 commented 5 years ago

Just pushed a fix. Review in master @arouinfar?

arouinfar commented 5 years ago

👍