phetsims / fractions-intro

"Fractions Intro" is an educational simulation in HTML5, by PhET Interactive Simulations.
MIT License
1 stars 3 forks source link

Add Horizontal Bar Representation #85

Closed veillette closed 7 years ago

veillette commented 7 years ago

The Horizontal bar Representation look like this image

Currently the CellSceneView display the containerNode inside an HBox,

    /**
     * add a container node to the scene graph
     * @param {Container} container
     * @private
     */
    addContainer: function( container ) {
      var containerNode = this.createContainerNode( container, this.onExistingCellDragStart.bind( this ) );

      this.containerNodes.push( containerNode );
      this.containerLayer.addChild( containerNode );
    },

It should be generalized to have an VBox inside an HBox.

One should be able to leverage this code to use for the equality lab.

image

image

coledu commented 7 years ago

We use rectangle to make the horizontal bar.

michaelm396 commented 7 years ago

I have committed features that enables a new HBox to be created inside of the current containerLayer VBox once the maxHorizontalContainers condition is satisfied for the containerNode. This allows containers to lie horizontally parallel to one another. I have also correctly left aligned the containerLayer VBox, that places the new containerNode in alignment with the VBox. These features will be essiential for the life of the horizontal bar node and the equality lab. Assigning this issue back to @veillette for futher review. Thanks for being the best research professor ever! :1st_place_medal:

veillette commented 7 years ago

Thanks @michaelm396 , this implementation works well and avoid a lot of duplication. Closing.