From b56953e0c37d385f3a88334b4587699ccefe493d Mon Sep 17 00:00:00 2001 From: samreid Date: Thu, 27 Feb 2020 11:40:05 -0700 Subject: [PATCH] ES6 module migration, see https://github.com/phetsims/chipper/issues/875 --- js/common/view/LevelSupportColumnNode.js | 102 +++++++++++------------ 1 file changed, 49 insertions(+), 53 deletions(-) diff --git a/js/common/view/LevelSupportColumnNode.js b/js/common/view/LevelSupportColumnNode.js index e3ab93b0..e815648b 100644 --- a/js/common/view/LevelSupportColumnNode.js +++ b/js/common/view/LevelSupportColumnNode.js @@ -5,65 +5,61 @@ * * @author John Blanco */ -define( require => { - 'use strict'; - // modules - const balancingAct = require( 'BALANCING_ACT/balancingAct' ); - const ColumnState = require( 'BALANCING_ACT/common/model/ColumnState' ); - const inherit = require( 'PHET_CORE/inherit' ); - const LinearGradient = require( 'SCENERY/util/LinearGradient' ); - const Node = require( 'SCENERY/nodes/Node' ); - const Path = require( 'SCENERY/nodes/Path' ); - const Rectangle = require( 'SCENERY/nodes/Rectangle' ); +import inherit from '../../../../phet-core/js/inherit.js'; +import Node from '../../../../scenery/js/nodes/Node.js'; +import Path from '../../../../scenery/js/nodes/Path.js'; +import Rectangle from '../../../../scenery/js/nodes/Rectangle.js'; +import LinearGradient from '../../../../scenery/js/util/LinearGradient.js'; +import balancingAct from '../../balancingAct.js'; +import ColumnState from '../model/ColumnState.js'; - /** - * @param modelViewTransform - * @param levelSupportColumn - * @param columnState - * @constructor - */ - function LevelSupportColumnNode( modelViewTransform, levelSupportColumn, columnState ) { - Node.call( this ); - const self = this; - - // Create and add the main body of the column. - const transformedColumnShape = modelViewTransform.modelToViewShape( levelSupportColumn.shape ); - const mainBodyGradient = new LinearGradient( transformedColumnShape.bounds.minX, 0, transformedColumnShape.bounds.maxX, 0 ).addColorStop( 0, 'rgb( 150, 150, 150 )' ).addColorStop( 0.25, 'rgb( 230, 230, 230 )' ).addColorStop( 0.65, 'rgb( 150, 150, 150 )' ).addColorStop( 1, 'rgb( 200, 200, 200 )' ); +/** + * @param modelViewTransform + * @param levelSupportColumn + * @param columnState + * @constructor + */ +function LevelSupportColumnNode( modelViewTransform, levelSupportColumn, columnState ) { + Node.call( this ); + const self = this; - const columnNode = new Path( transformedColumnShape, - { - fill: mainBodyGradient, - stroke: 'black', - lineWidth: 1 - } ); - self.addChild( columnNode ); + // Create and add the main body of the column. + const transformedColumnShape = modelViewTransform.modelToViewShape( levelSupportColumn.shape ); + const mainBodyGradient = new LinearGradient( transformedColumnShape.bounds.minX, 0, transformedColumnShape.bounds.maxX, 0 ).addColorStop( 0, 'rgb( 150, 150, 150 )' ).addColorStop( 0.25, 'rgb( 230, 230, 230 )' ).addColorStop( 0.65, 'rgb( 150, 150, 150 )' ).addColorStop( 1, 'rgb( 200, 200, 200 )' ); - // Create and add the column support. - const supportWidth = transformedColumnShape.bounds.width * 1.3; // Empirically determined. - const supportHeight = transformedColumnShape.bounds.height * 0.15; // Empirically determined. - const supportGradient = new LinearGradient( transformedColumnShape.bounds.centerX - supportWidth / 2, 0, transformedColumnShape.bounds.centerX + supportWidth / 2, 0 ).addColorStop( 0, 'rgb( 150, 150, 150 )' ).addColorStop( 0.25, 'rgb( 210, 210, 210 )' ).addColorStop( 0.65, 'rgb( 150, 150, 150 )' ).addColorStop( 1, 'rgb( 170, 170, 170 )' ); - const columnSupportNode = new Rectangle( - transformedColumnShape.bounds.centerX - supportWidth / 2, - transformedColumnShape.bounds.maxY - supportHeight, - supportWidth, - supportHeight, - 3, - 3, - { - fill: supportGradient, - stroke: 'black', - lineWidth: 1 - } ); - self.addChild( columnSupportNode ); + const columnNode = new Path( transformedColumnShape, + { + fill: mainBodyGradient, + stroke: 'black', + lineWidth: 1 + } ); + self.addChild( columnNode ); - columnState.link( function( state ) { - self.visible = state === ColumnState.DOUBLE_COLUMNS; + // Create and add the column support. + const supportWidth = transformedColumnShape.bounds.width * 1.3; // Empirically determined. + const supportHeight = transformedColumnShape.bounds.height * 0.15; // Empirically determined. + const supportGradient = new LinearGradient( transformedColumnShape.bounds.centerX - supportWidth / 2, 0, transformedColumnShape.bounds.centerX + supportWidth / 2, 0 ).addColorStop( 0, 'rgb( 150, 150, 150 )' ).addColorStop( 0.25, 'rgb( 210, 210, 210 )' ).addColorStop( 0.65, 'rgb( 150, 150, 150 )' ).addColorStop( 1, 'rgb( 170, 170, 170 )' ); + const columnSupportNode = new Rectangle( + transformedColumnShape.bounds.centerX - supportWidth / 2, + transformedColumnShape.bounds.maxY - supportHeight, + supportWidth, + supportHeight, + 3, + 3, + { + fill: supportGradient, + stroke: 'black', + lineWidth: 1 } ); - } + self.addChild( columnSupportNode ); - balancingAct.register( 'LevelSupportColumnNode', LevelSupportColumnNode ); + columnState.link( function( state ) { + self.visible = state === ColumnState.DOUBLE_COLUMNS; + } ); +} - return inherit( Node, LevelSupportColumnNode ); -} ); +balancingAct.register( 'LevelSupportColumnNode', LevelSupportColumnNode ); +inherit( Node, LevelSupportColumnNode ); +export default LevelSupportColumnNode; \ No newline at end of file